MasterKeysFromRecipients takes a comma-separated list of Bech32-encoded public keys, parses them, and returns a slice of new MasterKeys.
(commaSeparatedRecipients string)
| 85 | // MasterKeysFromRecipients takes a comma-separated list of Bech32-encoded |
| 86 | // public keys, parses them, and returns a slice of new MasterKeys. |
| 87 | func 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. |
| 106 | type errSet []error |