forked from Concordium/concordium-go-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
credentials_test.go
46 lines (41 loc) · 1.28 KB
/
credentials_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
package concordium
import (
"reflect"
"testing"
)
var (
testCredSignKey = DecryptedSignKey("b53af4521a678b015bbae217277933e87b978a48a9a07d55cc369cdf5e1ac215")
testCredSignKeyBytes = []byte{
181, 58, 244, 82, 26, 103, 139, 1, 91, 186, 226, 23, 39, 121, 51, 232,
123, 151, 138, 72, 169, 160, 125, 85, 204, 54, 156, 223, 94, 26, 194, 21,
}
testCredEncryptedSignKey = EncryptedSignKey{
Metadata: EncryptedSignKeyMetadata{
Iterations: 100000,
Salt: "QsY4+h31LMs974pPN6QfsA==",
InitializationVector: "kzyQ24xum3WibCKfvngMlg==",
},
Password: "111111",
CipherText: "9hTfvFaDb/AYD9xXZ2LVnJ2FrHQhP+daUOP3l6m1tKdP6sPrpvucnA1xcuSgjiX3jfLWCJYEvUMv8oubObe410tJU/PfRZeQeB4xUDs04eE=",
}
)
func TestDecryptedSignKey_Decode(t *testing.T) {
got, err := testCredSignKey.Decode()
if err != nil {
t.Errorf("Decode() error = %v", err)
return
}
if !reflect.DeepEqual(got, testCredSignKeyBytes) {
t.Errorf("Decode() got = %v, want %v", got, testCredSignKeyBytes)
}
}
func TestEncryptedSignKey_Decode(t *testing.T) {
got, err := testCredEncryptedSignKey.Decode()
if err != nil {
t.Errorf("Decode() error = %v", err)
return
}
if !reflect.DeepEqual(got, testCredSignKeyBytes) {
t.Errorf("Decode() got = %v, want %v", got, testCredSignKeyBytes)
}
}