Skip to content

Commit

Permalink
fix(iam): remove unneeded import and clarify comment
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-schultz committed Jan 5, 2023
1 parent 9f5c876 commit 12da79f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions iam/__tests__/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import {

import * as identityMock from "@gitcoin/passport-identity/dist/commonjs/src/credentials";

import { utils } from "ethers";

jest.mock("ethers", () => {
return {
utils: {
Expand Down
4 changes: 2 additions & 2 deletions iam/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ app.post("/api/v0.0.0/verify", (req: Request, res: Response): void => {
const isSigner = challenge.credentialSubject.id === `did:pkh:eip155:1:${address}`;
const isType = challenge.credentialSubject.provider === `challenge-${payload.type}`;

// if an additional signer is passed verify that the challenge credential is valid
// if an additional signer is passed verify that message was signed by passed signer address
if (payload.signer) {
const additionalChallenge = payload.signer.challenge;

Expand All @@ -231,7 +231,7 @@ app.post("/api/v0.0.0/verify", (req: Request, res: Response): void => {
.getAddress(utils.verifyMessage(additionalChallenge.credentialSubject.challenge, payload.signer.signature))
.toLocaleLowerCase();

// if verifiedaddress does not equal the additional signer address throw an error because additional signer is invalid
// if verifiedAddress does not equal the additional signer address throw an error because signature is invalid
if (!additionalSignerCredential || verifiedAddress !== payload.signer.address) {
return void errorRes(res, "Unable to verify payload", 401);
}
Expand Down

0 comments on commit 12da79f

Please sign in to comment.