ParseHybridRecipient returns a new [HybridRecipient] from a Bech32 public key encoding with the "age1pq1" prefix.
(s string)
| 43 | // ParseHybridRecipient returns a new [HybridRecipient] from a Bech32 public key |
| 44 | // encoding with the "age1pq1" prefix. |
| 45 | func ParseHybridRecipient(s string) (*HybridRecipient, error) { |
| 46 | t, k, err := bech32.Decode(s) |
| 47 | if err != nil { |
| 48 | return nil, fmt.Errorf("malformed recipient %q: %v", s, err) |
| 49 | } |
| 50 | if t != "age1pq" { |
| 51 | return nil, fmt.Errorf("malformed recipient %q: invalid type %q", s, t) |
| 52 | } |
| 53 | r, err := newHybridRecipient(k) |
| 54 | if err != nil { |
| 55 | return nil, fmt.Errorf("malformed recipient %q: %v", s, err) |
| 56 | } |
| 57 | return r, nil |
| 58 | } |
| 59 | |
| 60 | func (r *HybridRecipient) Wrap(fileKey []byte) ([]*Stanza, error) { |
| 61 | s, _, err := r.WrapWithLabels(fileKey) |
searching dependent graphs…