@@ -5,6 +5,7 @@ import { getPublicKey } from "./crypto/index.js";
5
5
import { createDecoder , createEncoder } from "./symmetric.js" ;
6
6
7
7
const TestContentTopic = "/test/1/waku-message/utf8" ;
8
+ const TestPubSubTopic = "/test/pubsub/topic" ;
8
9
9
10
describe ( "Symmetric Encryption" , function ( ) {
10
11
it ( "Round trip binary encryption [symmetric, no signature]" , async function ( ) {
@@ -22,10 +23,14 @@ describe("Symmetric Encryption", function () {
22
23
const decoder = createDecoder ( TestContentTopic , symKey ) ;
23
24
const protoResult = await decoder . fromWireToProtoObj ( bytes ! ) ;
24
25
if ( ! protoResult ) throw "Failed to proto decode" ;
25
- const result = await decoder . fromProtoObj ( protoResult ) ;
26
+ const result = await decoder . fromProtoObj (
27
+ TestPubSubTopic ,
28
+ protoResult
29
+ ) ;
26
30
if ( ! result ) throw "Failed to decode" ;
27
31
28
32
expect ( result . contentTopic ) . to . equal ( TestContentTopic ) ;
33
+ expect ( result . pubSubTopic ) . to . equal ( TestPubSubTopic ) ;
29
34
expect ( result . version ) . to . equal ( 1 ) ;
30
35
expect ( result ?. payload ) . to . deep . equal ( payload ) ;
31
36
expect ( result . signature ) . to . be . undefined ;
@@ -54,10 +59,14 @@ describe("Symmetric Encryption", function () {
54
59
const decoder = createDecoder ( TestContentTopic , symKey ) ;
55
60
const protoResult = await decoder . fromWireToProtoObj ( bytes ! ) ;
56
61
if ( ! protoResult ) throw "Failed to proto decode" ;
57
- const result = await decoder . fromProtoObj ( protoResult ) ;
62
+ const result = await decoder . fromProtoObj (
63
+ TestPubSubTopic ,
64
+ protoResult
65
+ ) ;
58
66
if ( ! result ) throw "Failed to decode" ;
59
67
60
68
expect ( result . contentTopic ) . to . equal ( TestContentTopic ) ;
69
+ expect ( result . pubSubTopic ) . to . equal ( TestPubSubTopic ) ;
61
70
expect ( result . version ) . to . equal ( 1 ) ;
62
71
expect ( result ?. payload ) . to . deep . equal ( payload ) ;
63
72
expect ( result . signature ) . to . not . be . undefined ;
0 commit comments