@@ -46,6 +46,9 @@ func TestRPC_RegisterSession(t *testing.T) {
46
46
intentBuilderFn func (t * testing.T , data intents.IntentDataOpenSession ) * proto.Intent
47
47
}{
48
48
"Basic" : {
49
+ tokBuilderFn : func (b * jwt.Builder , url string ) {
50
+ b .Claim ("sequence:session_hash" , sessHash )
51
+ },
49
52
assertFn : func (t * testing.T , sess * proto.Session , err error , p assertionParams ) {
50
53
require .NoError (t , err )
51
54
require .NotNil (t , sess )
@@ -83,6 +86,12 @@ func TestRPC_RegisterSession(t *testing.T) {
83
86
require .ErrorContains (t , err , "JWT validation: nonce not satisfied" )
84
87
},
85
88
},
89
+ "WithMissingNonce" : {
90
+ assertFn : func (t * testing.T , sess * proto.Session , err error , p assertionParams ) {
91
+ require .Nil (t , sess )
92
+ require .ErrorContains (t , err , "JWT validation: nonce not satisfied" )
93
+ },
94
+ },
86
95
"WithInvalidNonceButValidSessionAddressClaim" : {
87
96
tokBuilderFn : func (b * jwt.Builder , url string ) {
88
97
b .Claim ("nonce" , "0x1234567890abcdef" ).
@@ -97,7 +106,9 @@ func TestRPC_RegisterSession(t *testing.T) {
97
106
},
98
107
"WithVerifiedEmail" : {
99
108
tokBuilderFn : func (b * jwt.Builder , url string ) {
100
- b .
Claim (
"email" ,
"[email protected] " ).
Claim (
"email_verified" ,
"true" )
109
+ b .
Claim (
"email" ,
"[email protected] " ).
110
+ Claim ("email_verified" , "true" ).
111
+ Claim ("sequence:session_hash" , sessHash )
101
112
},
102
113
assertFn : func (t * testing.T , sess * proto.Session , err error , p assertionParams ) {
103
114
require .NoError (t , err )
@@ -108,7 +119,9 @@ func TestRPC_RegisterSession(t *testing.T) {
108
119
},
109
120
"WithUnverifiedEmail" : {
110
121
tokBuilderFn : func (b * jwt.Builder , url string ) {
111
- b .
Claim (
"email" ,
"[email protected] " ).
Claim (
"email_verified" ,
"false" )
122
+ b .
Claim (
"email" ,
"[email protected] " ).
123
+ Claim ("email_verified" , "false" ).
124
+ Claim ("sequence:session_hash" , sessHash )
112
125
},
113
126
assertFn : func (t * testing.T , sess * proto.Session , err error , p assertionParams ) {
114
127
require .NoError (t , err )
@@ -134,7 +147,8 @@ func TestRPC_RegisterSession(t *testing.T) {
134
147
},
135
148
"IssuerMissingScheme" : {
136
149
tokBuilderFn : func (b * jwt.Builder , url string ) {
137
- b .Issuer (strings .TrimPrefix (url , "http://" ))
150
+ b .Issuer (strings .TrimPrefix (url , "http://" )).
151
+ Claim ("sequence:session_hash" , sessHash )
138
152
},
139
153
assertFn : func (t * testing.T , sess * proto.Session , err error , p assertionParams ) {
140
154
require .NoError (t , err )
0 commit comments