carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package hostbox
2
3import (
4 "crypto/sha256"
5 "encoding/hex"
6 "encoding/json"
7 "github.com/carlosframework/platform/internal/hostwrite"
8)
9
10// LaunchSpec is a digest preimage, never authority. Root compares its digest
11// with the authoritative attempt and hashes the executable independently.
12type LaunchSpec struct {
13 Identity hostwrite.Identity
14 Executable, Digest string
15 Args, Env []string
16}
17
18func (s LaunchSpec) Hash() (string, error) {
19 raw, err := json.Marshal(s)
20 if err != nil {
21 return "", err
22 }
23 sum := sha256.Sum256(raw)
24 return hex.EncodeToString(sum[:]), nil
25}
26