Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ethr-did-resolver

Package Overview
Dependencies
Maintainers
5
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ethr-did-resolver - npm Package Compare versions

Comparing version 6.0.2 to 6.1.0

10

lib/index.modern.js

@@ -507,2 +507,3 @@ import { Base58 } from '@ethersproject/basex';

let serviceCount = 0;
let endpoint = '';
const auth = {};

@@ -608,6 +609,13 @@ const keyAgreementRefs = {};

serviceCount++;
try {
endpoint = JSON.parse(Buffer.from(currentEvent.value.slice(2), 'hex').toString());
} catch (_unused2) {
endpoint = Buffer.from(currentEvent.value.slice(2), 'hex').toString();
}
services[eventIndex] = {
id: `${did}#service-${serviceCount}`,
type: algorithm,
serviceEndpoint: Buffer.from(currentEvent.value.slice(2), 'hex').toString()
serviceEndpoint: endpoint
};

@@ -614,0 +622,0 @@ break;

@@ -791,2 +791,3 @@ import { Base58 } from '@ethersproject/basex';

let serviceCount = 0;
let endpoint = '';
const auth = {};

@@ -892,6 +893,13 @@ const keyAgreementRefs = {};

serviceCount++;
try {
endpoint = JSON.parse(Buffer.from(currentEvent.value.slice(2), 'hex').toString());
} catch {
endpoint = Buffer.from(currentEvent.value.slice(2), 'hex').toString();
}
services[eventIndex] = {
id: `${did}#service-${serviceCount}`,
type: algorithm,
serviceEndpoint: Buffer.from(currentEvent.value.slice(2), 'hex').toString()
serviceEndpoint: endpoint
};

@@ -898,0 +906,0 @@ break;

@@ -788,2 +788,3 @@ (function (global, factory) {

let serviceCount = 0;
let endpoint = '';
const auth = {};

@@ -889,6 +890,13 @@ const keyAgreementRefs = {};

serviceCount++;
try {
endpoint = JSON.parse(Buffer.from(currentEvent.value.slice(2), 'hex').toString());
} catch {
endpoint = Buffer.from(currentEvent.value.slice(2), 'hex').toString();
}
services[eventIndex] = {
id: `${did}#service-${serviceCount}`,
type: algorithm,
serviceEndpoint: Buffer.from(currentEvent.value.slice(2), 'hex').toString()
serviceEndpoint: endpoint
};

@@ -895,0 +903,0 @@ break;

32

package.json
{
"name": "ethr-did-resolver",
"version": "6.0.2",
"version": "6.1.0",
"description": "Resolve DID documents for ethereum addresses and public keys",

@@ -72,21 +72,21 @@ "type": "module",

"devDependencies": {
"@babel/core": "7.18.2",
"@babel/preset-env": "7.18.2",
"@babel/preset-typescript": "7.17.12",
"@babel/core": "7.18.9",
"@babel/preset-env": "7.18.9",
"@babel/preset-typescript": "7.18.6",
"@semantic-release/changelog": "6.0.1",
"@semantic-release/git": "10.0.1",
"@types/jest": "28.1.1",
"@typescript-eslint/eslint-plugin": "5.27.1",
"@typescript-eslint/parser": "5.27.1",
"babel-jest": "28.1.1",
"eslint": "8.17.0",
"@types/jest": "28.1.6",
"@typescript-eslint/eslint-plugin": "5.30.7",
"@typescript-eslint/parser": "5.30.7",
"babel-jest": "28.1.3",
"eslint": "8.20.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-jest": "26.5.3",
"eslint-plugin-prettier": "4.0.0",
"ganache": "7.3.0",
"jest": "28.1.1",
"eslint-plugin-jest": "26.6.0",
"eslint-plugin-prettier": "4.2.1",
"ganache": "7.3.2",
"jest": "28.1.3",
"microbundle": "0.15.0",
"prettier": "2.6.2",
"prettier": "2.7.1",
"semantic-release": "19.0.3",
"typescript": "4.7.3"
"typescript": "4.7.4"
},

@@ -102,5 +102,5 @@ "dependencies": {

"@ethersproject/transactions": "^5.6.2",
"did-resolver": "^3.2.2",
"did-resolver": "^4.0.0",
"ethr-did-registry": "^1.0.0"
}
}

@@ -571,2 +571,170 @@ import { Contract, ContractFactory } from '@ethersproject/contracts'

})
describe('add expanded service endpoints', () => {
it('resolves document', async () => {
expect.assertions(2)
await new EthrDidController(identity, registryContract).setAttribute(
stringToBytes32('did/svc/HubService'),
JSON.stringify({ uri: 'https://hubs.uport.me', transportType: 'http' }),
86405,
{ from: controller }
)
const { didDocument } = await didResolver.resolve(did)
expect(didDocument).toEqual({
'@context': expect.anything(),
id: did,
verificationMethod: [
{
id: `${did}#controller`,
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: did,
blockchainAccountId: `eip155:1337:${controller}`,
},
{
id: `${did}#delegate-4`,
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: did,
blockchainAccountId: `eip155:1337:${delegate2}`,
},
{
id: `${did}#delegate-5`,
type: 'EcdsaSecp256k1VerificationKey2019',
controller: did,
publicKeyHex: '02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71',
},
{
id: `${did}#delegate-6`,
type: 'Ed25519VerificationKey2018',
controller: did,
publicKeyBase64: Buffer.from(
'02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71',
'hex'
).toString('base64'),
},
{
id: `${did}#delegate-7`,
type: 'RSAVerificationKey2018',
controller: did,
publicKeyPem: '-----BEGIN PUBLIC KEY...END PUBLIC KEY-----\r\n',
},
],
authentication: [`${did}#controller`, `${did}#delegate-4`],
assertionMethod: [
`${did}#controller`,
`${did}#delegate-4`,
`${did}#delegate-5`,
`${did}#delegate-6`,
`${did}#delegate-7`,
],
service: [
{
id: `${did}#service-1`,
type: 'HubService',
serviceEndpoint: 'https://hubs.uport.me',
},
{
id: `${did}#service-2`,
type: 'HubService',
serviceEndpoint: { uri: 'https://hubs.uport.me', transportType: 'http' },
},
],
})
await new EthrDidController(identity, registryContract).setAttribute(
stringToBytes32('did/svc/HubService'),
JSON.stringify([
{ uri: 'https://hubs.uport.me', transportType: 'http' },
{ uri: 'libp2p.star/123', transportType: 'libp2p' },
]),
86405,
{ from: controller }
)
const { didDocument: updatedDidDocument } = await didResolver.resolve(did)
expect(updatedDidDocument).toEqual({
'@context': expect.anything(),
id: did,
verificationMethod: [
{
id: `${did}#controller`,
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: did,
blockchainAccountId: `eip155:1337:${controller}`,
},
{
id: `${did}#delegate-4`,
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: did,
blockchainAccountId: `eip155:1337:${delegate2}`,
},
{
id: `${did}#delegate-5`,
type: 'EcdsaSecp256k1VerificationKey2019',
controller: did,
publicKeyHex: '02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71',
},
{
id: `${did}#delegate-6`,
type: 'Ed25519VerificationKey2018',
controller: did,
publicKeyBase64: Buffer.from(
'02b97c30de767f084ce3080168ee293053ba33b235d7116a3263d29f1450936b71',
'hex'
).toString('base64'),
},
{
id: `${did}#delegate-7`,
type: 'RSAVerificationKey2018',
controller: did,
publicKeyPem: '-----BEGIN PUBLIC KEY...END PUBLIC KEY-----\r\n',
},
],
authentication: [`${did}#controller`, `${did}#delegate-4`],
assertionMethod: [
`${did}#controller`,
`${did}#delegate-4`,
`${did}#delegate-5`,
`${did}#delegate-6`,
`${did}#delegate-7`,
],
service: [
{
id: `${did}#service-1`,
type: 'HubService',
serviceEndpoint: 'https://hubs.uport.me',
},
{
id: `${did}#service-2`,
type: 'HubService',
serviceEndpoint: { uri: 'https://hubs.uport.me', transportType: 'http' },
},
{
id: `${did}#service-3`,
type: 'HubService',
serviceEndpoint: [
{ uri: 'https://hubs.uport.me', transportType: 'http' },
{ uri: 'libp2p.star/123', transportType: 'libp2p' },
],
},
],
})
// undo side effects of this test
await new EthrDidController(identity, registryContract).revokeAttribute(
stringToBytes32('did/svc/HubService'),
JSON.stringify([
{ uri: 'https://hubs.uport.me', transportType: 'http' },
{ uri: 'libp2p.star/123', transportType: 'libp2p' },
]),
{ from: controller }
)
// undo side effects of this test
await new EthrDidController(identity, registryContract).revokeAttribute(
stringToBytes32('did/svc/HubService'),
JSON.stringify({ uri: 'https://hubs.uport.me', transportType: 'http' }),
{ from: controller }
)
})
})
})

@@ -573,0 +741,0 @@

@@ -13,3 +13,3 @@ import { Base58 } from '@ethersproject/basex'

Resolvable,
ServiceEndpoint,
Service,
VerificationMethod,

@@ -138,6 +138,7 @@ } from 'did-resolver'

let serviceCount = 0
let endpoint = ''
const auth: Record<string, string> = {}
const keyAgreementRefs: Record<string, string> = {}
const pks: Record<string, VerificationMethod> = {}
const services: Record<string, ServiceEndpoint> = {}
const services: Record<string, Service> = {}
for (const event of history) {

@@ -222,6 +223,11 @@ if (blockHeight !== -1 && event.blockNumber > blockHeight) {

serviceCount++
try {
endpoint = JSON.parse(Buffer.from(currentEvent.value.slice(2), 'hex').toString())
} catch {
endpoint = Buffer.from(currentEvent.value.slice(2), 'hex').toString()
}
services[eventIndex] = {
id: `${did}#service-${serviceCount}`,
type: algorithm,
serviceEndpoint: Buffer.from(currentEvent.value.slice(2), 'hex').toString(),
serviceEndpoint: endpoint,
}

@@ -228,0 +234,0 @@ break

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc