@@ -2239,7 +2239,34 @@ describe('auth', () => {
2239
2239
'no auth credentials found'
2240
2240
) ;
2241
2241
2242
- // should this work?
2242
+ // this should this work because we haven't revoked user keys
2243
2243
await handleAuthorizationRequest ( userDID , authReqBody ) ;
2244
+
2245
+ // get actual auth credential (k2)
2246
+ const { authCredential : userAuthCredential } = await idWallet . getActualAuthCredential ( userDID ) ;
2247
+
2248
+ const treesModel3 = await idWallet . getDIDTreeModel ( userDID ) ;
2249
+ const [ ctrHex3 , rtrHex3 , rorTrHex3 ] = await Promise . all ( [
2250
+ treesModel3 . claimsTree . root ( ) ,
2251
+ treesModel3 . revocationTree . root ( ) ,
2252
+ treesModel3 . rootsTree . root ( )
2253
+ ] ) ;
2254
+
2255
+ const oldTreeState3 = {
2256
+ state : treesModel3 . state ,
2257
+ claimsRoot : ctrHex3 ,
2258
+ revocationRoot : rtrHex3 ,
2259
+ rootOfRoots : rorTrHex3
2260
+ } ;
2261
+
2262
+ // revoke user keys
2263
+ const nonce3 = await idWallet . revokeCredential ( userDID , userAuthCredential ) ;
2264
+ await idWallet . publishStateToRHS ( userDID , RHS_URL , [ nonce3 ] ) ;
2265
+ await proofService . transitState ( userDID , oldTreeState3 , true , dataStorage . states , ethSigner ) ;
2266
+
2267
+ // this should not work because we revoked user keys
2268
+ await expect ( handleAuthorizationRequest ( userDID , authReqBody ) ) . to . rejectedWith (
2269
+ 'no auth credentials found'
2270
+ ) ;
2244
2271
} ) ;
2245
2272
} ) ;
0 commit comments