ethr-did-resolver
Advanced tools
Comparing version 4.3.5 to 5.0.1
@@ -54,2 +54,3 @@ import { BigNumber } from '@ethersproject/bignumber'; | ||
export declare const legacyAlgoMap: Record<string, string>; | ||
export declare function strip0x(input: string): string; | ||
export declare function bytes32toString(input: bytes32 | Uint8Array): string; | ||
@@ -56,0 +57,0 @@ export declare function stringToBytes32(str: string): string; |
@@ -75,2 +75,5 @@ var basex = require('@ethersproject/basex'); | ||
}; | ||
function strip0x(input) { | ||
return input.startsWith('0x') ? input.slice(2) : input; | ||
} | ||
function bytes32toString(input) { | ||
@@ -899,3 +902,3 @@ const buff = typeof input === 'string' ? Buffer.from(input.slice(2), 'hex') : Buffer.from(input); | ||
case 'hex': | ||
pk.publicKeyHex = currentEvent.value.slice(2); | ||
pk.publicKeyHex = strip0x(currentEvent.value); | ||
break; | ||
@@ -916,3 +919,3 @@ | ||
default: | ||
pk.value = currentEvent.value; | ||
pk.value = strip0x(currentEvent.value); | ||
} | ||
@@ -975,3 +978,3 @@ | ||
controller: did, | ||
publicKeyHex: controllerKey | ||
publicKeyHex: strip0x(controllerKey) | ||
}); | ||
@@ -1034,3 +1037,3 @@ authentication.push(`${did}#controllerKey`); | ||
didDocument | ||
}; | ||
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} | ||
@@ -1037,0 +1040,0 @@ |
@@ -68,2 +68,5 @@ import { Base58 } from '@ethersproject/basex'; | ||
}; | ||
function strip0x(input) { | ||
return input.startsWith('0x') ? input.slice(2) : input; | ||
} | ||
function bytes32toString(input) { | ||
@@ -591,3 +594,3 @@ const buff = typeof input === 'string' ? Buffer.from(input.slice(2), 'hex') : Buffer.from(input); | ||
case 'hex': | ||
pk.publicKeyHex = currentEvent.value.slice(2); | ||
pk.publicKeyHex = strip0x(currentEvent.value); | ||
break; | ||
@@ -608,3 +611,3 @@ | ||
default: | ||
pk.value = currentEvent.value; | ||
pk.value = strip0x(currentEvent.value); | ||
} | ||
@@ -667,3 +670,3 @@ | ||
controller: did, | ||
publicKeyHex: controllerKey | ||
publicKeyHex: strip0x(controllerKey) | ||
}); | ||
@@ -792,3 +795,3 @@ authentication.push(`${did}#controllerKey`); | ||
didDocument | ||
}; | ||
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} catch (e) { | ||
@@ -795,0 +798,0 @@ return { |
@@ -50,2 +50,5 @@ import { Base58 } from '@ethersproject/basex'; | ||
}; | ||
function strip0x(input) { | ||
return input.startsWith('0x') ? input.slice(2) : input; | ||
} | ||
function bytes32toString(input) { | ||
@@ -874,3 +877,3 @@ const buff = typeof input === 'string' ? Buffer.from(input.slice(2), 'hex') : Buffer.from(input); | ||
case 'hex': | ||
pk.publicKeyHex = currentEvent.value.slice(2); | ||
pk.publicKeyHex = strip0x(currentEvent.value); | ||
break; | ||
@@ -891,3 +894,3 @@ | ||
default: | ||
pk.value = currentEvent.value; | ||
pk.value = strip0x(currentEvent.value); | ||
} | ||
@@ -950,3 +953,3 @@ | ||
controller: did, | ||
publicKeyHex: controllerKey | ||
publicKeyHex: strip0x(controllerKey) | ||
}); | ||
@@ -1009,3 +1012,3 @@ authentication.push(`${did}#controllerKey`); | ||
didDocument | ||
}; | ||
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} | ||
@@ -1012,0 +1015,0 @@ |
@@ -71,2 +71,5 @@ (function (global, factory) { | ||
}; | ||
function strip0x(input) { | ||
return input.startsWith('0x') ? input.slice(2) : input; | ||
} | ||
function bytes32toString(input) { | ||
@@ -895,3 +898,3 @@ const buff = typeof input === 'string' ? Buffer.from(input.slice(2), 'hex') : Buffer.from(input); | ||
case 'hex': | ||
pk.publicKeyHex = currentEvent.value.slice(2); | ||
pk.publicKeyHex = strip0x(currentEvent.value); | ||
break; | ||
@@ -912,3 +915,3 @@ | ||
default: | ||
pk.value = currentEvent.value; | ||
pk.value = strip0x(currentEvent.value); | ||
} | ||
@@ -971,3 +974,3 @@ | ||
controller: did, | ||
publicKeyHex: controllerKey | ||
publicKeyHex: strip0x(controllerKey) | ||
}); | ||
@@ -1030,3 +1033,3 @@ authentication.push(`${did}#controllerKey`); | ||
didDocument | ||
}; | ||
}; // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} | ||
@@ -1033,0 +1036,0 @@ |
{ | ||
"name": "ethr-did-resolver", | ||
"version": "4.3.5", | ||
"version": "5.0.1", | ||
"description": "Resolve DID documents for ethereum addresses and public keys", | ||
@@ -70,13 +70,13 @@ "source": "src/index.ts", | ||
"@babel/preset-typescript": "7.14.5", | ||
"@semantic-release/changelog": "5.0.1", | ||
"@semantic-release/git": "9.0.0", | ||
"@types/jest": "26.0.23", | ||
"@typescript-eslint/eslint-plugin": "4.28.0", | ||
"@typescript-eslint/parser": "4.28.0", | ||
"@semantic-release/changelog": "6.0.1", | ||
"@semantic-release/git": "10.0.1", | ||
"@types/jest": "27.0.2", | ||
"@typescript-eslint/eslint-plugin": "5.3.1", | ||
"@typescript-eslint/parser": "5.3.1", | ||
"babel-jest": "27.0.5", | ||
"codecov": "3.8.2", | ||
"eslint": "7.29.0", | ||
"eslint": "8.2.0", | ||
"eslint-config-prettier": "8.3.0", | ||
"eslint-plugin-jest": "24.3.6", | ||
"eslint-plugin-prettier": "3.4.0", | ||
"eslint-plugin-jest": "25.2.4", | ||
"eslint-plugin-prettier": "4.0.0", | ||
"ganache-cli": "6.12.2", | ||
@@ -86,3 +86,3 @@ "jest": "27.0.5", | ||
"prettier": "2.3.2", | ||
"semantic-release": "17.4.4", | ||
"semantic-release": "18.0.0", | ||
"typescript": "4.3.4" | ||
@@ -99,3 +99,3 @@ }, | ||
"@ethersproject/transactions": "^5.1.0", | ||
"did-resolver": "^3.1.0", | ||
"did-resolver": "^3.1.3", | ||
"ethr-did-registry": "^0.0.3", | ||
@@ -102,0 +102,0 @@ "querystring": "^0.2.1" |
@@ -215,3 +215,3 @@ import { Resolver } from 'did-resolver' | ||
controller: did, | ||
publicKeyHex: '0x03fdd57adec3d438ea237fe46b33ee1e016eda6b585c3e27ea66686c2ea5358479', | ||
publicKeyHex: '03fdd57adec3d438ea237fe46b33ee1e016eda6b585c3e27ea66686c2ea5358479', | ||
}, | ||
@@ -218,0 +218,0 @@ ], |
@@ -76,4 +76,4 @@ import { Contract, ContractFactory } from '@ethersproject/contracts' | ||
expect.assertions(1) | ||
const pubKey = '0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798' | ||
const pubdid = `did:ethr:dev:${pubKey}` | ||
const pubKey = '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798' | ||
const pubdid = `did:ethr:dev:0x${pubKey}` | ||
await expect(didResolver.resolve(pubdid)).resolves.toEqual({ | ||
@@ -140,4 +140,4 @@ didDocumentMetadata: {}, | ||
expect.assertions(3) | ||
const pubKey = '0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798' | ||
const pubdid = `did:ethr:dev:${pubKey}` | ||
const pubKey = '0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798' | ||
const pubdid = `did:ethr:dev:0x${pubKey}` | ||
const { didDocument } = await didResolver.resolve(pubdid) | ||
@@ -144,0 +144,0 @@ expect(didDocument).toEqual({ |
@@ -84,2 +84,6 @@ import { getAddress } from '@ethersproject/address' | ||
export function strip0x(input: string): string { | ||
return input.startsWith('0x') ? input.slice(2) : input | ||
} | ||
export function bytes32toString(input: bytes32 | Uint8Array): string { | ||
@@ -86,0 +90,0 @@ const buff: Buffer = typeof input === 'string' ? Buffer.from(input.slice(2), 'hex') : Buffer.from(input) |
@@ -31,2 +31,3 @@ import { Base58 } from '@ethersproject/basex' | ||
Errors, | ||
strip0x, | ||
} from './helpers' | ||
@@ -202,3 +203,3 @@ import { logDecoder } from './logParser' | ||
case 'hex': | ||
pk.publicKeyHex = currentEvent.value.slice(2) | ||
pk.publicKeyHex = strip0x(currentEvent.value) | ||
break | ||
@@ -215,3 +216,3 @@ case 'base64': | ||
default: | ||
pk.value = currentEvent.value | ||
pk.value = strip0x(currentEvent.value) | ||
} | ||
@@ -277,3 +278,3 @@ pks[eventIndex] = pk | ||
controller: did, | ||
publicKeyHex: controllerKey, | ||
publicKeyHex: strip0x(controllerKey), | ||
}) | ||
@@ -391,3 +392,4 @@ authentication.push(`${did}#controllerKey`) | ||
} | ||
} catch (e) { | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
} catch (e: any) { | ||
return { | ||
@@ -394,0 +396,0 @@ didResolutionMetadata: { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
518144
6445
Updateddid-resolver@^3.1.3