@@ -41,7 +41,10 @@ func TestNewClientSymKey(t *testing.T) {
41
41
rand .Read (id )
42
42
rand .Read (k )
43
43
44
- c , err := NewClient (& SymIDAndKey {ID : id , Key : k }, NewMemoryStore (nil ))
44
+ c , err := NewClient (& SymIDAndKey {
45
+ ID : id ,
46
+ Key : k ,
47
+ }, NewInMemoryStore (nil ))
45
48
if err != nil {
46
49
t .Fatal (err )
47
50
}
@@ -77,7 +80,9 @@ func TestNewClientSymKey(t *testing.T) {
77
80
}
78
81
79
82
func TestProtectUnprotectMessageSymKey (t * testing.T ) {
80
- client , err := NewClient (& SymIDAndKey {Key : e4crypto .RandomKey ()}, NewMemoryStore (nil ))
83
+ client , err := NewClient (& SymIDAndKey {
84
+ Key : e4crypto .RandomKey (),
85
+ }, NewInMemoryStore (nil ))
81
86
if err != nil {
82
87
t .Fatalf ("Failed to create client: %v" , err )
83
88
}
@@ -98,7 +103,7 @@ func TestProtectUnprotectMessagePubKey(t *testing.T) {
98
103
ID : clientID ,
99
104
Key : privateKey ,
100
105
C2PubKey : generateCurve25519PubKey (t ),
101
- }, NewMemoryStore (nil ))
106
+ }, NewInMemoryStore (nil ))
102
107
if err != nil {
103
108
t .Fatalf ("Failed to create client: %v" , err )
104
109
}
@@ -200,7 +205,10 @@ func TestKeyTransition(t *testing.T) {
200
205
clientKey := e4crypto .RandomKey ()
201
206
topic := "topic"
202
207
203
- c , err := NewClient (& SymIDAndKey {ID : clientID , Key : clientKey }, NewMemoryStore (nil ))
208
+ c , err := NewClient (& SymIDAndKey {
209
+ ID : clientID ,
210
+ Key : clientKey ,
211
+ }, NewInMemoryStore (nil ))
204
212
if err != nil {
205
213
t .Fatalf ("Failed to create client: %v" , err )
206
214
}
@@ -257,8 +265,10 @@ func TestKeyTransition(t *testing.T) {
257
265
}
258
266
259
267
func TestClientWriteRead (t * testing.T ) {
260
- store := NewMemoryStore (nil )
261
- gc , err := NewClient (& SymIDAndKey {Key : e4crypto .RandomKey ()}, store )
268
+ store := NewInMemoryStore (nil )
269
+ gc , err := NewClient (& SymIDAndKey {
270
+ Key : e4crypto .RandomKey (),
271
+ }, store )
262
272
if err != nil {
263
273
t .Fatalf ("Failed to create client: %v" , err )
264
274
}
@@ -321,7 +331,11 @@ func TestProtectUnprotectCommandsPubKey(t *testing.T) {
321
331
}
322
332
323
333
clientID := e4crypto .RandomID ()
324
- gc , err := NewClient (& PubIDAndKey {ID : clientID , Key : clientEdSk , C2PubKey : c2PublicCurveKey }, NewMemoryStore (nil ))
334
+ gc , err := NewClient (& PubIDAndKey {
335
+ ID : clientID ,
336
+ Key : clientEdSk ,
337
+ C2PubKey : c2PublicCurveKey ,
338
+ }, NewInMemoryStore (nil ))
325
339
if err != nil {
326
340
t .Fatalf ("Failed to create client: %v" , err )
327
341
}
@@ -354,7 +368,7 @@ func TestClientPubKeys(t *testing.T) {
354
368
t .Fatalf ("failed to get pubkey from config: %v" , err )
355
369
}
356
370
357
- store := NewMemoryStore (nil )
371
+ store := NewInMemoryStore (nil )
358
372
c , err := NewClient (config , store )
359
373
if err != nil {
360
374
t .Fatalf ("Failed to create client: %v" , err )
@@ -449,7 +463,7 @@ func TestClientPubKeys(t *testing.T) {
449
463
t .Fatalf ("failed to get pubkey from config: %v" , err )
450
464
}
451
465
452
- c , err := NewClient (config , NewMemoryStore (nil ))
466
+ c , err := NewClient (config , NewInMemoryStore (nil ))
453
467
if err != nil {
454
468
t .Fatalf ("Failed to create client: %v" , err )
455
469
}
@@ -473,7 +487,10 @@ func TestClientPubKeys(t *testing.T) {
473
487
})
474
488
475
489
t .Run ("symClient must return unsupported operations on pubKey methods" , func (t * testing.T ) {
476
- symClient , err := NewClient (& SymNameAndPassword {Name : "testClient" , Password : "passwordTestRandom" }, NewMemoryStore (nil ))
490
+ symClient , err := NewClient (& SymNameAndPassword {
491
+ Name : "testClient" ,
492
+ Password : "passwordTestRandom" ,
493
+ }, NewInMemoryStore (nil ))
477
494
if err != nil {
478
495
t .Fatalf ("Failed to create symClient: %v" , err )
479
496
}
@@ -498,7 +515,10 @@ func TestClientPubKeys(t *testing.T) {
498
515
499
516
func TestClientTopics (t * testing.T ) {
500
517
t .Run ("topic key operations properly update client state" , func (t * testing.T ) {
501
- symClient , err := NewClient (& SymNameAndPassword {Name : "clientID" , Password : "passwordTestRandom" }, NewMemoryStore (nil ))
518
+ symClient , err := NewClient (& SymNameAndPassword {
519
+ Name : "clientID" ,
520
+ Password : "passwordTestRandom" ,
521
+ }, NewInMemoryStore (nil ))
502
522
if err != nil {
503
523
t .Fatalf ("Failed to create client: %v" , err )
504
524
}
@@ -550,7 +570,10 @@ func TestClientTopics(t *testing.T) {
550
570
})
551
571
552
572
t .Run ("topic key operations returns errors when invoked with bad topic hashes" , func (t * testing.T ) {
553
- symClient , err := NewClient (& SymNameAndPassword {Name : "clientID" , Password : "passwordTestRandom" }, NewMemoryStore (nil ))
573
+ symClient , err := NewClient (& SymNameAndPassword {
574
+ Name : "clientID" ,
575
+ Password : "passwordTestRandom" ,
576
+ }, NewInMemoryStore (nil ))
554
577
if err != nil {
555
578
t .Fatalf ("Failed to create client: %v" , err )
556
579
}
@@ -572,7 +595,10 @@ func TestClientSetIDKey(t *testing.T) {
572
595
validKey := e4crypto .RandomKey ()
573
596
invalidKey := make ([]byte , e4crypto .KeyLen )
574
597
575
- c , err := NewClient (& SymIDAndKey {ID : clientID , Key : validKey }, NewMemoryStore (nil ))
598
+ c , err := NewClient (& SymIDAndKey {
599
+ ID : clientID ,
600
+ Key : validKey ,
601
+ }, NewInMemoryStore (nil ))
576
602
if err != nil {
577
603
t .Fatalf ("Failed to create client: %v" , err )
578
604
}
@@ -588,7 +614,10 @@ func TestCommandsSymClient(t *testing.T) {
588
614
clientKey := e4crypto .RandomKey ()
589
615
topic := "topic1"
590
616
591
- c , err := NewClient (& SymIDAndKey {ID : clientID , Key : clientKey }, NewMemoryStore (nil ))
617
+ c , err := NewClient (& SymIDAndKey {
618
+ ID : clientID ,
619
+ Key : clientKey ,
620
+ }, NewInMemoryStore (nil ))
592
621
if err != nil {
593
622
t .Fatalf ("Failed to create client: %v" , err )
594
623
}
0 commit comments