Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deps): Update dependency ethr-did-resolver to v11 #126

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: 'yarn'

- run: yarn install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: 'Setup node with cache'
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
cache: 'yarn'

- run: yarn install --frozen-lockfile
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM node:21.6.2
LABEL maintainer="Mircea NISTOR <mircea.nistor@mesh.xyz>"
LABEL maintainer="Mircea NISTOR <mircea.nistor@consensys.net>"
LABEL repository="[email protected]:uport-project/uport-did-driver.git"

USER root
Expand Down
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"author": "Christian Lundkvist",
"contributors": [
"Andres Junge",
"Mircea Nistor <[email protected]>"
"Mircea Nistor"
],
"repository": {
"type": "git",
Expand All @@ -30,8 +30,9 @@
"dependencies": {
"did-resolver": "^4.1.0",
"ens-did-resolver": "^1.0.4",
"ethr-did-resolver": "^10.0.0",
"express": "^4.18.2",
"ethers": "^6.13.3",
"ethr-did-resolver": "^11.0.1",
"express": "^4.21.0",
"express-actuator": "^1.8.4",
"peer-did-resolver": "^2.0.0",
"plc-did-resolver": "^1.0.0",
Expand All @@ -40,22 +41,23 @@
"devDependencies": {
"@jest/globals": "29.7.0",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/commit-analyzer": "11.1.0",
"@semantic-release/commit-analyzer": "13.0.0",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/github": "9.2.6",
"@semantic-release/npm": "11.0.2",
"@semantic-release/release-notes-generator": "12.1.0",
"@semantic-release/github": "11.0.0",
"@semantic-release/npm": "12.0.1",
"@semantic-release/release-notes-generator": "14.0.1",
"cross-env": "7.0.3",
"jest": "29.7.0",
"prettier": "3.2.5",
"semantic-release": "22.0.12",
"supertest": "6.3.4"
"prettier": "3.3.3",
"semantic-release": "24.1.2",
"supertest": "7.0.0"
},
"jest": {
"testEnvironment": "node",
"coveragePathIgnorePatterns": [
"/node_modules/"
]
}
},
"packageManager": "[email protected]"
}
6 changes: 3 additions & 3 deletions src/__tests__/ens.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ describe('did:ens driver', () => {
})
})

it('did:ens:goerli:whatever.eth', async () => {
it.skip('did:ens:sepolia:whatever.eth', async () => {
expect.assertions(2)
const did = 'did:ens:goerli:whatever.eth'
const did = 'did:ens:sepolia:whatever.eth'
const ethrAddr = '0x4af859d61d07A8c515FE0E3Cc1Ea5e49A260bBa3'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.status).toBe(200)
Expand All @@ -75,7 +75,7 @@ describe('did:ens driver', () => {
id: `${did}#${ethrAddr}`,
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: did,
blockchainAccountId: `${ethrAddr}@eip155:5`,
blockchainAccountId: `${ethrAddr}@eip155:11155111`,
},
{
id: `${did}#my-key`,
Expand Down
128 changes: 33 additions & 95 deletions src/__tests__/ethr.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
import app from '../app.js'
import app, { providerConfig, timers } from '../app.js'
import request from 'supertest'
import { jest } from '@jest/globals'
import { afterAll, describe, expect, it, jest } from '@jest/globals'
import { deployments } from 'ethr-did-resolver'

jest.setTimeout(30000)

describe('did:ethr driver', () => {
afterAll(() => {
// poor man's benchmarking
for (const rpcUrl of Object.keys(timers)) {
const average =
Object.values(timers[rpcUrl]).reduce((acc, val) => acc + val, 0) /
Object.values(timers[rpcUrl]).length
console.log(`Average time for ${rpcUrl}: ${average}ms`)
}
})

it.skip('configures all official deployments', () => {
const configured = providerConfig.networks.map((network) => network.chainId)
const known = deployments.map((deployment) => deployment.chainId)
const knownButNotConfigured = known.filter((x) => !new Set(configured).has(x))
expect(knownButNotConfigured).toEqual([])
})

it.skip('configures only official deployments', () => {
const configured = providerConfig.networks.map((network) => network.chainId)
const known = deployments.map((deployment) => deployment.chainId)
const configuredButUnknown = configured.filter((x) => !new Set(known).has(x))
expect(configuredButUnknown).toEqual([])
})

it('responds with didResolutionResult', async () => {
expect.assertions(4)
const did = 'did:ethr:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
Expand Down Expand Up @@ -128,106 +153,19 @@ describe('did:ethr driver', () => {
})

describe('responds with didResolutionResult for', () => {
it('did:ethr:mainnet:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:mainnet:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})

it('did:ethr:0x1:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:0x1:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})
const names = providerConfig.networks.map((network) => network.name)
const chainIds = providerConfig.networks.map((network) => `0x${BigInt(network.chainId).toString(16)}`)

it('did:ethr:goerli:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:goerli:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})

it('did:ethr:0x5:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:0x5:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})

// it('did:ethr:rsk:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
// expect.assertions(1)
// const did = 'did:ethr:rsk:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
// const response = await request(app).get(`/1.0/identifiers/${did}`)
// expect(response.body.didDocument).toHaveProperty('verificationMethod')
// })

// it('did:ethr:0x1e:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
// expect.assertions(1)
// const did = 'did:ethr:0x1e:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
// const response = await request(app).get(`/1.0/identifiers/${did}`)
// expect(response.body.didDocument).toHaveProperty('verificationMethod')
// })

it('did:ethr:matic:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:matic:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})

it('did:ethr:0x89:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:0x89:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})

it.skip('did:ethr:maticmum:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:maticmum:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})

it.skip('did:ethr:0x13881:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:0x13881:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})

it('did:ethr:0x03c401:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:0x03c401:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})

it('did:ethr:volta:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:volta:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})

it('did:ethr:0x12047:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
expect.assertions(1)
const did = 'did:ethr:0x12047:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})
it('did:ethr:ewc:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
it.each(names)('did:ethr:%s:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async (name) => {
expect.assertions(1)
const did = 'did:ethr:ewc:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const did = `did:ethr:${name}:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736`
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})

it('did:ethr:0xf6:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async () => {
it.each(chainIds)('did:ethr:%s:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736', async (chainId) => {
expect.assertions(1)
const did = 'did:ethr:0xf6:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736'
const did = `did:ethr:${chainId}:0x3b0BC51Ab9De1e5B7B6E34E5b960285805C41736`
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.body.didDocument).toHaveProperty('verificationMethod')
})
Expand Down
4 changes: 2 additions & 2 deletions src/__tests__/web.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import app from '../app.js'
import request from 'supertest'

describe('did:web driver', () => {
it('responds with didResolutionResult for did:web:did.actor:alice', async () => {
it('responds with didResolutionResult for did:web:skounis.github.io', async () => {
expect.assertions(5)
const did = 'did:web:did.actor:alice'
const did = 'did:web:skounis.github.io'
const response = await request(app).get(`/1.0/identifiers/${did}`)
expect(response.status).toBe(200)
expect(response.body).toHaveProperty('didDocument')
Expand Down
Loading