Skip to content

Commit

Permalink
refactor: remove private key and use signing key (#20)
Browse files Browse the repository at this point in the history
Signed-off-by: Sai Ranjit Tummalapalli <[email protected]>
  • Loading branch information
sairanjit authored Jan 30, 2024
1 parent ea93d04 commit 9ca265d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/registrar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { Contract, JsonRpcProvider, Wallet, computeAddress } from 'ethers'
import {
Contract,
JsonRpcProvider,
SigningKey,
Wallet,
computeAddress,
} from 'ethers'
import { wrapDidDocument } from './polygon-did-registrar'
import { parseDid, validateDid } from './utils/did'
import { validateResourcePayload } from './utils/linkedResource'
Expand All @@ -10,7 +16,7 @@ import { v4 as uuidv4 } from 'uuid'
export type PolygonDidInitOptions = {
contractAddress: string
rpcUrl: string
privateKey: string
signingKey: SigningKey
}

export type PolygonDidRegisterOptions = {
Expand Down Expand Up @@ -38,10 +44,10 @@ export class PolygonDID {
public constructor({
contractAddress,
rpcUrl,
privateKey,
signingKey,
}: PolygonDidInitOptions) {
const provider = new JsonRpcProvider(rpcUrl)
const wallet = new Wallet(privateKey, provider)
const wallet = new Wallet(signingKey, provider)
this.registry = new Contract(
contractAddress,
DidRegistryContract.abi,
Expand Down

0 comments on commit 9ca265d

Please sign in to comment.