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

Function EncodeRecipient

plugin/encode.go:47–53  ·  view source on GitHub ↗

EncodeRecipient encodes a plugin recipient string for a plugin with the given name. If the name is invalid, it returns an empty string.

(name string, data []byte)

Source from the content-addressed store, hash-verified

45// EncodeRecipient encodes a plugin recipient string for a plugin with the given
46// name. If the name is invalid, it returns an empty string.
47func EncodeRecipient(name string, data []byte) string {
48 if !validPluginName(name) {
49 return ""
50 }
51 s, _ := bech32.Encode("age1"+strings.ToLower(name), data)
52 return s
53}
54
55// ParseRecipient decodes a plugin recipient string. It returns the plugin name
56// in lowercase and the encoded data.

Callers 4

StringMethod · 0.92
TestNotFoundFunction · 0.85
TestPluginErrorFunction · 0.85

Calls 2

EncodeFunction · 0.92
validPluginNameFunction · 0.85

Tested by 2

TestNotFoundFunction · 0.68
TestPluginErrorFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…