Download this file
| 1 | //go:build linux |
| 2 | |
| 3 | package operator |
| 4 | |
| 5 | import "amadan.net/carlos/platform.git/launchctx/controlname" |
| 6 | |
| 7 | type schemaCommandConfigV2 struct { |
| 8 | commandConfig |
| 9 | SchemaProfile string `json:"schema_profile"` |
| 10 | SchemaManifestDigest string `json:"schema_manifest_digest"` |
| 11 | } |
| 12 | |
| 13 | func parseSchemaCommandConfigV2(raw []byte) (schemaCommandConfigV2, *schemaVerifierV2, error) { |
| 14 | var c schemaCommandConfigV2 |
| 15 | if len(raw) == 0 || len(raw) > 8192 || strict(raw, &c) != nil || c.Version != 2 || !controlname.ValidAccount(c.Account) || !controlname.ValidApp(c.App) || !controlname.ValidHostShape(c.Host) { |
| 16 | return schemaCommandConfigV2{}, nil, ErrRefused |
| 17 | } |
| 18 | v, err := newSchemaVerifierV2(Pins{c.Role, c.Origin, c.Installation, c.Registry, c.Device, c.PublicKey, c.Actions}, c.SchemaProfile, c.SchemaManifestDigest) |
| 19 | if err != nil || c.KeyID != v.base.kid { |
| 20 | return schemaCommandConfigV2{}, nil, ErrRefused |
| 21 | } |
| 22 | return c, v, nil |
| 23 | } |
| 24 | |