@@ -337,6 +337,60 @@ describe("torus utils sapphire mainnet", function () {
337
337
} ) ;
338
338
} ) ;
339
339
340
+ it ( "should be able to login without commitments" , async function ( ) {
341
+ const token = generateIdToken ( TORUS_TEST_EMAIL , "ES256" ) ;
342
+ const verifierDetails = { verifier : TORUS_TEST_VERIFIER , verifierId : TORUS_TEST_EMAIL } ;
343
+ const { torusNodeEndpoints, torusIndexes, torusNodePub } = await TORUS_NODE_MANAGER . getNodeDetails ( verifierDetails ) ;
344
+ const result = await torus . retrieveShares (
345
+ getRetrieveSharesParams (
346
+ torusNodeEndpoints ,
347
+ torusIndexes ,
348
+ TORUS_TEST_VERIFIER ,
349
+ { verifier_id : TORUS_TEST_EMAIL } ,
350
+ token ,
351
+ torusNodePub ,
352
+ { } ,
353
+ true ,
354
+ false
355
+ )
356
+ ) ;
357
+ expect ( result . finalKeyData . privKey ) . to . be . equal ( "dfb39b84e0c64b8c44605151bf8670ae6eda232056265434729b6a8a50fa3419" ) ;
358
+ expect ( result . metadata . serverTimeOffset ) . lessThan ( 20 ) ;
359
+
360
+ delete result . metadata . serverTimeOffset ;
361
+
362
+ expect ( result ) . eql ( {
363
+ finalKeyData : {
364
+ walletAddress : "0x70520A7F04868ACad901683699Fa32765C9F6871" ,
365
+ X : "adff099b5d3b1e238b43fba1643cfa486e8d9e8de22c1e6731d06a5303f9025b" ,
366
+ Y : "21060328e7889afd303acb63201b6493e3061057d1d81279931ab4a6cabf94d4" ,
367
+ privKey : "dfb39b84e0c64b8c44605151bf8670ae6eda232056265434729b6a8a50fa3419" ,
368
+ } ,
369
+ oAuthKeyData : {
370
+ walletAddress : "0x925c97404F1aBdf4A8085B93edC7B9F0CEB3C673" ,
371
+ X : "5cd8625fc01c7f7863a58c914a8c43b2833b3d0d5059350bab4acf6f4766a33d" ,
372
+ Y : "198a4989615c5c2c7fa4d49c076ea7765743d09816bb998acb9ff54f5db4a391" ,
373
+ privKey : "90a219ac78273e82e36eaa57c15f9070195e436644319d6b9aea422bb4d31906" ,
374
+ } ,
375
+ postboxKeyData : {
376
+ X : "5cd8625fc01c7f7863a58c914a8c43b2833b3d0d5059350bab4acf6f4766a33d" ,
377
+ Y : "198a4989615c5c2c7fa4d49c076ea7765743d09816bb998acb9ff54f5db4a391" ,
378
+ privKey : "90a219ac78273e82e36eaa57c15f9070195e436644319d6b9aea422bb4d31906" ,
379
+ } ,
380
+ sessionData : { sessionTokenData : result . sessionData . sessionTokenData , sessionAuthKey : result . sessionData . sessionAuthKey } ,
381
+ metadata : {
382
+ pubNonce : {
383
+ X : "ab4d287c263ab1bb83c37646d0279764e50fe4b0c34de4da113657866ddcf318" ,
384
+ Y : "ad35db2679dfad4b62d77cf753d7b98f73c902e5d101cc2c3c1209ece6d94382" ,
385
+ } ,
386
+ nonce : new BN ( "4f1181d8689f0d0960f1a6f9fe26e03e557bdfba11f4b6c8d7b1285e9c271b13" , "hex" ) ,
387
+ typeOfUser : "v2" ,
388
+ upgraded : false ,
389
+ } ,
390
+ nodesData : result . nodesData ,
391
+ } ) ;
392
+ } ) ;
393
+
340
394
it ( "should be able to aggregate login" , async function ( ) {
341
395
const email = faker . internet . email ( ) ;
342
396
const idToken = generateIdToken ( email , "ES256" ) ;
@@ -367,6 +421,39 @@ describe("torus utils sapphire mainnet", function () {
367
421
expect ( result . metadata . upgraded ) . to . equal ( false ) ;
368
422
} ) ;
369
423
424
+ it ( "should be able to aggregate login without commitment" , async function ( ) {
425
+ const email = faker . internet . email ( ) ;
426
+ const idToken = generateIdToken ( email , "ES256" ) ;
427
+ const hashedIdToken = keccak256 ( Buffer . from ( idToken , "utf8" ) ) ;
428
+ const verifierDetails = { verifier : TORUS_TEST_AGGREGATE_VERIFIER , verifierId : email } ;
429
+
430
+ const nodeDetails = await TORUS_NODE_MANAGER . getNodeDetails ( verifierDetails ) ;
431
+ const torusNodeEndpoints = nodeDetails . torusNodeSSSEndpoints ;
432
+ const result = await torus . retrieveShares (
433
+ getRetrieveSharesParams (
434
+ torusNodeEndpoints ,
435
+ nodeDetails . torusIndexes ,
436
+ TORUS_TEST_AGGREGATE_VERIFIER ,
437
+ {
438
+ verify_params : [ { verifier_id : email , idtoken : idToken } ] ,
439
+ sub_verifier_ids : [ TORUS_TEST_VERIFIER ] ,
440
+ verifier_id : email ,
441
+ } ,
442
+ hashedIdToken . substring ( 2 ) ,
443
+ nodeDetails . torusNodePub ,
444
+ { } ,
445
+ true ,
446
+ false
447
+ )
448
+ ) ;
449
+ expect ( result . finalKeyData . walletAddress ) . to . not . equal ( null ) ;
450
+ expect ( result . finalKeyData . walletAddress ) . to . not . equal ( "" ) ;
451
+ expect ( result . oAuthKeyData . walletAddress ) . to . not . equal ( null ) ;
452
+ expect ( result . metadata . typeOfUser ) . to . equal ( "v2" ) ;
453
+ expect ( result . metadata . nonce ) . to . not . equal ( null ) ;
454
+ expect ( result . metadata . upgraded ) . to . equal ( false ) ;
455
+ } ) ;
456
+
370
457
it ( "should be able to update the `sessionTime` of the token signature data" , async function ( ) {
371
458
const email = faker . internet . email ( ) ;
372
459
const token = generateIdToken ( TORUS_TEST_EMAIL , "ES256" ) ;
0 commit comments