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)
| 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. |
| 47 | func 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. |
searching dependent graphs…