added function to get yubihsm public key base64-encoded addr
@@ -3,6 +3,7 @@ package crypto
import (
"bytes"
"encoding/asn1"
+ "encoding/base64"
"encoding/json"
"errors"
"fmt"
@@ -374,6 +375,15 @@ func (privKey *YubiHsmPrivateKey) GetPubKeyAddr() string {
return loom.LocalAddressFromPublicKey(privKey.pubKeyBytes).String()
}
+// get base64 encoded pubkey address
+func (privKey *YubiHsmPrivateKey) GetPubKeyAddrB64Encoded() string {
+ if privKey.privKeyType == PrivateKeyTypeEd25519 {
+ return base64.StdEncoding.EncodeToString(loom.LocalAddressFromPublicKey(privKey.pubKeyBytes))
+ }
+
+ return "Not supported"
+}
+
// get key type
func (privKey *YubiHsmPrivateKey) GetKeyType() string {
return privKey.privKeyType
