better error management + shortcode overflow control

This commit is contained in:
ycc
2026-02-04 18:28:14 +01:00
parent bb3640c1c3
commit b1ecd04a28
6 changed files with 105 additions and 65 deletions

View File

@@ -57,12 +57,21 @@ func TestGetKey(t *testing.T) {
}
// fmt.Println(kp.Public)
// fmt.Println(kp.Private)
key := kp.GetCryptoKeyObject()
key, err := kp.GetCryptoKeyObject()
if err != nil {
t.Fatal(err)
}
// fmt.Println(key.Armor())
Armpubkey, _ := key.GetArmoredPublicKey()
Armpubkey, err := key.GetArmoredPublicKey()
if err != nil {
t.Fatal(err)
}
pubkey := base64.StdEncoding.EncodeToString([]byte(Armpubkey))
println(len([]byte(pubkey)))
binpubkey, _ := key.GetPublicKey()
binpubkey, err := key.GetPublicKey()
if err != nil {
t.Fatal(err)
}
println(len(binpubkey))
assert.Equal(t, kp.Public, pubkey, "The two public keys should be the same.")
//if kp.Public != pubkey {