MCPcopy
hub / github.com/getsops/sops / keyToString

Function keyToString

keyservice/server.go:247–264  ·  view source on GitHub ↗
(key *Key)

Source from the content-addressed store, hash-verified

245}
246
247func keyToString(key *Key) string {
248 switch k := key.KeyType.(type) {
249 case *Key_PgpKey:
250 return fmt.Sprintf("PGP key with fingerprint %s", k.PgpKey.Fingerprint)
251 case *Key_KmsKey:
252 return fmt.Sprintf("AWS KMS key with ARN %s", k.KmsKey.Arn)
253 case *Key_GcpKmsKey:
254 return fmt.Sprintf("GCP KMS key with resource ID %s", k.GcpKmsKey.ResourceId)
255 case *Key_AzureKeyvaultKey:
256 return fmt.Sprintf("Azure Key Vault key with URL %s/keys/%s/%s", k.AzureKeyvaultKey.VaultUrl, k.AzureKeyvaultKey.Name, k.AzureKeyvaultKey.Version)
257 case *Key_VaultKey:
258 return fmt.Sprintf("Hashicorp Vault key with URI %s/v1/%s/keys/%s", k.VaultKey.VaultAddress, k.VaultKey.EnginePath, k.VaultKey.KeyName)
259 case *Key_HckmsKey:
260 return fmt.Sprintf("HuaweiCloud KMS key with ID %s", k.HckmsKey.KeyId)
261 default:
262 return "Unknown key type"
263 }
264}
265
266func (ks Server) prompt(key *Key, requestType string) error {
267 keyString := keyToString(key)

Callers 1

promptMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected