@@ -193,15 +193,12 @@ export namespace Utils {
193
193
194
194
if ( operation . value === undefined ) {
195
195
throw new InvalidSep10ChallengeError (
196
- "The transaction's operation value should not be null" ,
196
+ "The transaction's operation values should not be null" ,
197
197
) ;
198
198
}
199
199
200
200
// verify base64
201
- if (
202
- ! operation . value ||
203
- Buffer . from ( operation . value . toString ( ) , "base64" ) . length !== 48
204
- ) {
201
+ if ( Buffer . from ( operation . value . toString ( ) , "base64" ) . length !== 48 ) {
205
202
throw new InvalidSep10ChallengeError (
206
203
"The transaction's operation value should be a 64 bytes base64 random string" ,
207
204
) ;
@@ -248,14 +245,17 @@ export namespace Utils {
248
245
"The transaction has operations that are unrecognized" ,
249
246
) ;
250
247
}
248
+ if ( op . value === undefined ) {
249
+ throw new InvalidSep10ChallengeError (
250
+ "The transaction's operation values should not be null" ,
251
+ ) ;
252
+ }
251
253
if (
252
254
op . name === "web_auth_domain" &&
253
- ( ! op . value || op . value . toString ( ) !== webAuthDomain )
255
+ ! op . value . compare ( Buffer . from ( webAuthDomain ) )
254
256
) {
255
257
throw new InvalidSep10ChallengeError (
256
- `Invalid 'web_auth_domain' value. Expected: ${ webAuthDomain } ; Contained: ${
257
- op . value ? op . value . toString ( ) : op . value
258
- } `,
258
+ `'web_auth_domain' operation value does not match ${ webAuthDomain } ` ,
259
259
) ;
260
260
}
261
261
}
0 commit comments