EncodeIdentity encodes a plugin identity string for a plugin with the given name. If the name is invalid, it returns an empty string.
(name string, data []byte)
| 17 | // EncodeIdentity encodes a plugin identity string for a plugin with the given |
| 18 | // name. If the name is invalid, it returns an empty string. |
| 19 | func EncodeIdentity(name string, data []byte) string { |
| 20 | if !validPluginName(name) { |
| 21 | return "" |
| 22 | } |
| 23 | s, _ := bech32.Encode("AGE-PLUGIN-"+strings.ToUpper(name)+"-", data) |
| 24 | return s |
| 25 | } |
| 26 | |
| 27 | // ParseIdentity decodes a plugin identity string. It returns the plugin name |
| 28 | // in lowercase and the encoded data. |
searching dependent graphs…