keyWithNameFrom returns a specific key by name from the Context
(ctx context.Context, name string)
| 84 | |
| 85 | // keyWithNameFrom returns a specific key by name from the Context |
| 86 | func keyWithNameFrom(ctx context.Context, name string) (*cosign.KeysBytes, error) { |
| 87 | keys := allKeysFrom(ctx) |
| 88 | |
| 89 | key := keys[name] |
| 90 | if key != nil { |
| 91 | return key, nil |
| 92 | } |
| 93 | |
| 94 | return nil, fmt.Errorf("can't find key named %s, did you create the key pair beforehand", name) |
| 95 | } |
| 96 | |
| 97 | // SignerWithKey configures a SignerVerifier with the provided key by name |
| 98 | func SignerWithKey(ctx context.Context, keyName string) (signature.SignerVerifier, error) { |
no test coverage detected