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

Function MasterKeysFromRecipients

age/keysource.go:87–103  ·  view source on GitHub ↗

MasterKeysFromRecipients takes a comma-separated list of Bech32-encoded public keys, parses them, and returns a slice of new MasterKeys.

(commaSeparatedRecipients string)

Source from the content-addressed store, hash-verified

85// MasterKeysFromRecipients takes a comma-separated list of Bech32-encoded
86// public keys, parses them, and returns a slice of new MasterKeys.
87func MasterKeysFromRecipients(commaSeparatedRecipients string) ([]*MasterKey, error) {
88 if commaSeparatedRecipients == "" {
89 // otherwise Split returns [""] and MasterKeyFromRecipient is unhappy
90 return make([]*MasterKey, 0), nil
91 }
92 recipients := strings.Split(commaSeparatedRecipients, ",")
93
94 var keys []*MasterKey
95 for _, recipient := range recipients {
96 key, err := MasterKeyFromRecipient(recipient)
97 if err != nil {
98 return nil, err
99 }
100 keys = append(keys, key)
101 }
102 return keys, nil
103}
104
105// errSet is a collection of captured errors.
106type errSet []error

Callers 6

mainFunction · 0.92
getMasterKeysFunction · 0.92
keyGroupsFunction · 0.92
extractMasterKeysFunction · 0.92

Calls 1

MasterKeyFromRecipientFunction · 0.85

Tested by 1