From 706a08201a4aeefe6c8a0deb9b72ffba0cff0018 Mon Sep 17 00:00:00 2001 From: knzeng-e Date: Wed, 6 Oct 2021 11:23:31 +0200 Subject: [PATCH] feat(createDelegateProof): using ew-did-registry/jwt --- package.json | 1 - src/iam.ts | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 5b771bdc..e5154baf 100644 --- a/package.json +++ b/package.json @@ -77,7 +77,6 @@ "eth-ens-namehash": "^2.0.8", "ethers": "^5.4.4", "js-sha3": "^0.8.0", - "jsonwebtoken": "^8.5.1", "lodash.difference": "^4.5.0", "nats.ws": "^1.3.0", "qs": "^6.9.4", diff --git a/src/iam.ts b/src/iam.ts index ad7452b6..0d6a908a 100644 --- a/src/iam.ts +++ b/src/iam.ts @@ -15,7 +15,7 @@ // @authors: Kim Honoridez // @authors: Daniel Wojno -import { providers, Signer, utils } from "ethers"; +import { providers, Signer, utils, Wallet } from "ethers"; import { IRoleDefinition, IAppDefinition, @@ -71,7 +71,7 @@ import { addressOf } from "@ew-did-registry/did-ethr-resolver"; import { isValidDID, parseDID } from "./utils/did"; import { chainConfigs } from "./iam/chainConfig"; import { canonizeSig } from "./utils/enrollment"; -import jwt from "jsonwebtoken"; +import { JWT } from "@ew-did-registry/jwt"; const { id, keccak256, defaultAbiCoder, solidityKeccak256, arrayify, namehash } = utils; export type InitializeData = { @@ -577,7 +577,8 @@ export class IAM extends IAMBase { blockNumber, }, }; - const identityToken = jwt.sign(payload, delegateKey); + const jwt = new JWT(new Wallet(delegateKey)); + const identityToken = jwt.sign(payload, { algorithm: "ES256" }); return identityToken; }