Skip to content

Commit f6728c9

Browse files
committed
revoke user keys and check
1 parent 571234c commit f6728c9

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

tests/handlers/auth.test.ts

+28-1
Original file line numberDiff line numberDiff line change
@@ -2239,7 +2239,34 @@ describe('auth', () => {
22392239
'no auth credentials found'
22402240
);
22412241

2242-
// should this work?
2242+
// this should this work because we haven't revoked user keys
22432243
await handleAuthorizationRequest(userDID, authReqBody);
2244+
2245+
// get actual auth credential for user
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+
);
22442271
});
22452272
});

0 commit comments

Comments
 (0)