Skip to content

Commit

Permalink
fix(deps): bump ethr-did-resolver to 4.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceanis committed Apr 16, 2021
1 parent 0ea66e6 commit 9b4e1b2
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 34 deletions.
32 changes: 19 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
},
"dependencies": {
"@ethersproject/abstract-signer": "^5.1.0",
"@ethersproject/address": "^5.1.0",
"@ethersproject/base64": "^5.1.0",
"@ethersproject/basex": "^5.1.0",
"@ethersproject/bytes": "^5.1.0",
Expand All @@ -83,6 +82,6 @@
"@ethersproject/wallet": "^5.1.0",
"did-jwt": "^5.1.2",
"did-resolver": "^3.1.0",
"ethr-did-resolver": "^4.1.0"
"ethr-did-resolver": "^4.2.0"
}
}
20 changes: 1 addition & 19 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,13 @@ import { Signer as TxSigner } from '@ethersproject/abstract-signer'
import { CallOverrides } from '@ethersproject/contracts'
import { computeAddress } from '@ethersproject/transactions'
import { computePublicKey } from '@ethersproject/signing-key'
import { getAddress } from '@ethersproject/address'
import { Provider } from '@ethersproject/providers'
import { Wallet } from '@ethersproject/wallet'
import * as base64 from '@ethersproject/base64'
import { hexlify, hexValue, isBytes } from '@ethersproject/bytes'
import { Base58 } from '@ethersproject/basex'
import { toUtf8Bytes } from '@ethersproject/strings'
import { REGISTRY, EthrDidController } from 'ethr-did-resolver'
import { REGISTRY, EthrDidController, interpretIdentifier } from 'ethr-did-resolver'
import { Resolvable } from 'did-resolver'

export enum DelegateTypes {
Expand Down Expand Up @@ -225,23 +224,6 @@ export class EthrDID {
}
}

function interpretIdentifier(identifier: string): { address: string; publicKey?: string; network?: string } {
let input = identifier
let network = undefined
if (input.startsWith('did:ethr')) {
const components = input.split(':')
input = components[components.length - 1]
if (components.length >= 4) {
network = components.splice(2, components.length - 3).join(':')
}
}
if (input.length > 42) {
return { address: computeAddress(input), publicKey: input, network }
} else {
return { address: getAddress(input), network } // checksum address
}
}

function attributeToHex(key: string, value: string | Uint8Array): string {
if (value instanceof Uint8Array || isBytes(value)) {
return hexlify(value)
Expand Down

0 comments on commit 9b4e1b2

Please sign in to comment.