MCPcopy
hub / github.com/FiloSottile/age / ParseHybridRecipient

Function ParseHybridRecipient

pq.go:45–58  ·  view source on GitHub ↗

ParseHybridRecipient returns a new [HybridRecipient] from a Bech32 public key encoding with the "age1pq1" prefix.

(s string)

Source from the content-addressed store, hash-verified

43// ParseHybridRecipient returns a new [HybridRecipient] from a Bech32 public key
44// encoding with the "age1pq1" prefix.
45func 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
60func (r *HybridRecipient) Wrap(fileKey []byte) ([]*Stanza, error) {
61 s, _, err := r.WrapWithLabels(fileKey)

Callers 4

TestHybridRoundTripFunction · 0.92
mainFunction · 0.92
parseRecipientFunction · 0.92
parseRecipientFunction · 0.85

Calls 2

DecodeFunction · 0.92
newHybridRecipientFunction · 0.85

Tested by 1

TestHybridRoundTripFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…