MCPcopy Create free account
hub / github.com/conforma/cli / SignStatement

Function SignStatement

acceptance/attestation/attestation.go:114–128  ·  view source on GitHub ↗

SignStatement signs the provided statement with the named key. The key needs to be previously generated with the functionality from the crypto package.

(ctx context.Context, keyName string, statement any)

Source from the content-addressed store, hash-verified

112// SignStatement signs the provided statement with the named key. The key needs
113// to be previously generated with the functionality from the crypto package.
114func SignStatement(ctx context.Context, keyName string, statement any) ([]byte, error) {
115 payload, err := json.Marshal(statement)
116 if err != nil {
117 return nil, err
118 }
119
120 signer, err := crypto.SignerWithKey(ctx, keyName)
121 if err != nil {
122 return nil, err
123 }
124
125 dsseSigner := dsse.WrapSigner(signer, types.IntotoPayloadType)
126
127 return dsseSigner.SignMessage(bytes.NewReader(payload), options.WithContext(ctx))
128}

Calls 2

SignerWithKeyFunction · 0.92
SignMessageMethod · 0.45

Tested by

no test coverage detected