Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Single signer check #152

Closed

Conversation

rajakash-dev
Copy link
Contributor

No description provided.

@@ -99,6 +99,8 @@ export async function authenticate(jws: GeneralJws, didResolver: DidResolver): P
// TODO: should we add an explicit check to ensure that there's only 1 signer?, Issue #65 https://github.com/TBD54566975/dwn-sdk-js/issues/65
const verifier = new GeneralJwsVerifier(jws);
const { signers } = await verifier.verify(didResolver);
if (signers.length!=1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: should wrap all if statements with {... }, looks like a linting rule needs to be added, feel free to add the rule, but that's optional, I can add it in later.

@@ -99,6 +99,8 @@ export async function authenticate(jws: GeneralJws, didResolver: DidResolver): P
// TODO: should we add an explicit check to ensure that there's only 1 signer?, Issue #65 https://github.com/TBD54566975/dwn-sdk-js/issues/65
const verifier = new GeneralJwsVerifier(jws);
const { signers } = await verifier.verify(didResolver);
if (signers.length!=1)
throw new Error('There must be just 1 signer');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A test needs to be added for this new line.

Copy link
Member

@thehenrytsai thehenrytsai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rajakash-dev, thanks for the PR, a couple of comments to address.

@thehenrytsai
Copy link
Member

Upon further inspection of the code, the issue is already fix by this line of code:
https://github.com/TBD54566975/dwn-sdk-js/blob/main/src/core/auth.ts#L45

Thus closing!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants