Skip to content

Commit

Permalink
revoke user keys and check
Browse files Browse the repository at this point in the history
  • Loading branch information
daveroga committed Apr 9, 2024
1 parent 571234c commit 1b7bc8f
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion tests/handlers/auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2239,7 +2239,34 @@ describe('auth', () => {
'no auth credentials found'
);

// should this work?
// this should this work because we haven't revoked user keys
await handleAuthorizationRequest(userDID, authReqBody);

// get actual auth credential for user
const { authCredential: userAuthCredential } = await idWallet.getActualAuthCredential(userDID);

const treesModel3 = await idWallet.getDIDTreeModel(userDID);
const [ctrHex3, rtrHex3, rorTrHex3] = await Promise.all([
treesModel3.claimsTree.root(),
treesModel3.revocationTree.root(),
treesModel3.rootsTree.root()
]);

const oldTreeState3 = {
state: treesModel3.state,
claimsRoot: ctrHex3,
revocationRoot: rtrHex3,
rootOfRoots: rorTrHex3
};

// revoke user keys
const nonce3 = await idWallet.revokeCredential(userDID, userAuthCredential);
await idWallet.publishStateToRHS(userDID, RHS_URL, [nonce3]);
await proofService.transitState(userDID, oldTreeState3, false, dataStorage.states, ethSigner);

// this should not work because we revoked user keys
await expect(handleAuthorizationRequest(userDID, authReqBody)).to.rejectedWith(
'no auth credentials found'
);
});
});

0 comments on commit 1b7bc8f

Please sign in to comment.