1
0
Fork 0
mirror of https://github.com/anyproto/anytype-heart.git synced 2025-06-08 13:57:12 +09:00
anytype-heart/util/encode/base58.go
2024-04-07 20:44:39 +02:00

22 lines
446 B
Go

package encode
import (
"github.com/anyproto/any-sync/util/crypto"
"github.com/mr-tron/base58/base58"
)
func EncodeKeyToBase58(key crypto.SymKey) (string, error) {
raw, err := key.Raw()
if err != nil {
return "", err
}
return base58.Encode(raw), nil
}
func DecodeKeyFromBase58(rawString string) (crypto.SymKey, error) {
raw, err := base58.Decode(rawString)
if err != nil {
return nil, err
}
return crypto.UnmarshallAESKey(raw)
}