Skip to content

Commit c27dafa

Browse files
committed
add private additional key tests
1 parent 1ba4641 commit c27dafa

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

primitives/ec/privatekey_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@ func TestBRC42PrivateVectors(t *testing.T) {
116116
}
117117
}
118118

119+
func TestPrivateKeyFromInvalidHex(t *testing.T) {
120+
hex := ""
121+
_, err := PrivateKeyFromHex(hex)
122+
require.Error(t, err)
123+
124+
wif := "L4o1GXuUSHauk19f9Cfpm1qfSXZuGLBUAC2VZM6vdmfMxRxAYkWq"
125+
_, err = PrivateKeyFromHex(wif)
126+
require.Error(t, err)
127+
}
128+
129+
func TestPrivateKeyFromInvalidWif(t *testing.T) {
130+
wif := "L401GXuUSHauk19f9Cfpm1qfSXZuGLBUAC2VZM6vdmfMxRxAYkWq"
131+
_, err := PrivateKeyFromWif(wif)
132+
require.Error(t, err)
133+
134+
wif = "L4o1GXuUSHauk19f9Cfpm1qfSXZuGLBUAC2VZM6vdmfMxRxAYkW"
135+
_, err = PrivateKeyFromWif(wif)
136+
require.Error(t, err)
137+
}
138+
119139
// TestPolynomialFromPrivateKey checks if a polynomial is correctly created from a private key
120140
func TestPolynomialFromPrivateKey(t *testing.T) {
121141

0 commit comments

Comments
 (0)