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

Function NewMasterKeyFromKeyIDString

hckms/keysource.go:79–96  ·  view source on GitHub ↗

NewMasterKeyFromKeyIDString takes a comma separated list of HuaweiCloud KMS key IDs in format "region:key-uuid", and returns a slice of new MasterKeys.

(keyID string)

Source from the content-addressed store, hash-verified

77// NewMasterKeyFromKeyIDString takes a comma separated list of HuaweiCloud KMS
78// key IDs in format "region:key-uuid", and returns a slice of new MasterKeys.
79func NewMasterKeyFromKeyIDString(keyID string) ([]*MasterKey, error) {
80 var keys []*MasterKey
81 if keyID == "" {
82 return keys, nil
83 }
84 for _, s := range strings.Split(keyID, ",") {
85 s = strings.TrimSpace(s)
86 if s == "" {
87 continue
88 }
89 k, err := NewMasterKey(s)
90 if err != nil {
91 return nil, err
92 }
93 keys = append(keys, k)
94 }
95 return keys, nil
96}
97
98// parseKeyID parses a key ID in format "region:key-uuid" and returns the region and UUID.
99func parseKeyID(keyID string) (string, string, error) {

Callers 4

getMasterKeysFunction · 0.92
keyGroupsFunction · 0.92

Calls 1

NewMasterKeyFunction · 0.70

Tested by 1