Skip to content

Commit

Permalink
fix(deps): use did-jwt v6 and ethr-did-resolver v6 (#925)
Browse files Browse the repository at this point in the history
* fix(deps): bump did-jwt to v6 and all related deps to latest

closes #923
closes #848

* chore(deps): use ganache instead of ganache-cli

This speeds up testing
  • Loading branch information
mirceanis authored Jun 10, 2022
1 parent 219cde2 commit 0c77d03
Show file tree
Hide file tree
Showing 37 changed files with 485 additions and 676 deletions.
6 changes: 3 additions & 3 deletions __tests__/shared/documentationExamples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default (testContext: {
id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
blockchainAccountId: '0xb09B66026bA5909A7CFE99b76875431D2b8D5190@eip155:4',
blockchainAccountId: 'eip155:4:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',
})
})

Expand All @@ -52,15 +52,15 @@ export default (testContext: {
expect(doc.didDocument).toEqual({
'@context': [
'https://www.w3.org/ns/did/v1',
'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld',
'https://w3id.org/security/suites/secp256k1recovery-2020/v2',
],
id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
verificationMethod: [
{
id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
blockchainAccountId: '0xb09B66026bA5909A7CFE99b76875431D2b8D5190@eip155:4',
blockchainAccountId: 'eip155:4:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',
},
],
authentication: ['did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'],
Expand Down
7 changes: 4 additions & 3 deletions __tests__/utils/ganache-provider.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { JsonRpcProvider, Web3Provider } from '@ethersproject/providers'
import { JsonRpcProvider, Web3Provider, ExternalProvider } from '@ethersproject/providers'
import { Contract, ContractFactory } from '@ethersproject/contracts'
// @ts-ignore
import DidRegistryContract from 'ethr-did-registry'
import ganache from 'ganache-cli'
import ganache from 'ganache'

/**
* Creates a Web3Provider that connects to a local ganache instance with a bunch of known keys and an ERC1056 contract.
Expand All @@ -12,6 +12,7 @@ import ganache from 'ganache-cli'
export async function createGanacheProvider(): Promise<{ provider: JsonRpcProvider; registry: string }> {
const provider = new Web3Provider(
ganache.provider({
logging: { quiet: true },
accounts: [
{
secretKey: '0x278a5de700e29faae8e40e366ec5012b5ec63d36ec77e8a2417154cc1d25383f',
Expand Down Expand Up @@ -54,7 +55,7 @@ export async function createGanacheProvider(): Promise<{ provider: JsonRpcProvid
balance: `0x1000000000000000000000`,
},
],
}),
}) as any
)
await provider.ready
const factory = ContractFactory.fromSolidity(DidRegistryContract).connect(provider.getSigner(0))
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test:integration-prepare": "ts-node --project packages/tsconfig.settings.json ./scripts/prepare-integration-tests.ts",
"test:integration-pretty": "prettier --write __tests__/shared/documentationExamples.ts",
"test:integration": "yarn test:integration-build && yarn test:ci",
"test:ci": "jest --config=jest.config.json --runInBand --coverage=true",
"test:ci": "jest --config=jest.config.json --coverage=true",
"test": "jest --config=jest.config.json",
"test:watch": "yarn test --watch --verbose",
"test:browser": "cd packages/test-react-app && yarn test:browser",
Expand All @@ -37,7 +37,7 @@
"codecov": "3.8.3",
"cross-fetch": "3.1.5",
"ethr-did-registry": "0.0.3",
"ganache-cli": "6.12.2",
"ganache": "7.2.0",
"jest": "27.5.1",
"jest-fetch-mock": "3.0.3",
"json-schema": "0.4.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@
"cross-fetch": "^3.1.4",
"date-fns": "^2.28.0",
"debug": "^4.3.3",
"did-resolver": "3.2.2",
"did-resolver": "^3.2.2",
"dotenv": "^16.0.0",
"ethr-did-resolver": "^5.0.4",
"ethr-did-resolver": "^6.0.1",
"express": "^4.17.2",
"express-handlebars": "^6.0.2",
"fuzzy": "^0.1.3",
Expand All @@ -66,7 +66,7 @@
"ts-json-schema-generator": "^1.0.0",
"typeorm": "0.3.6",
"url-parse": "^1.5.4",
"web-did-resolver": "^2.0.12",
"web-did-resolver": "^2.0.18",
"ws": "^8.4.0",
"yaml": "^2.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
"dependencies": {
"debug": "^4.3.3",
"did-jwt-vc": "^2.1.9",
"did-jwt-vc": "^2.1.12",
"events": "^3.2.0",
"z-schema": "^5.0.2"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,5 +313,5 @@ export function createAgent<T extends IPluginMethodMap, C = Record<string, any>>
options: IAgentOptions & { context?: C },
): TAgent<T> & { context?: C } {
//@ts-ignore
return new Agent(options)
return new Agent(options) as TAgent<T>
}
14 changes: 7 additions & 7 deletions packages/core/src/types/IResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ export interface IResolver extends IPluginMethodMap {
* expect(doc.didDocument).toEqual({
* '@context': [
* 'https://www.w3.org/ns/did/v1',
* 'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld',
* 'https://w3id.org/security/suites/secp256k1recovery-2020/v2',
* ],
* id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
* verificationMethod: [
* {
* id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
* type: 'EcdsaSecp256k1RecoveryMethod2020',
* controller: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
* blockchainAccountId: '0xb09B66026bA5909A7CFE99b76875431D2b8D5190@eip155:4',
* blockchainAccountId: 'eip155:4:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',
* },
* ],
* authentication: ['did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'],
Expand All @@ -114,11 +114,11 @@ export interface IResolver extends IPluginMethodMap {
* section: 'authentication'
* })
* expect(fragment).toEqual({
* id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
* type: 'EcdsaSecp256k1RecoveryMethod2020',
* controller: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
* blockchainAccountId: '0xb09B66026bA5909A7CFE99b76875431D2b8D5190@eip155:4',
* })
* id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
* type: 'EcdsaSecp256k1RecoveryMethod2020',
* controller: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
* blockchainAccountId: 'eip155:4:0xb09B66026bA5909A7CFE99b76875431D2b8D5190',
* })
* ```
*
* @param args - The description of the component you want.
Expand Down
2 changes: 1 addition & 1 deletion packages/credential-ld/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@veramo/did-resolver": "^3.1.0",
"@veramo/utils": "^3.1.0",
"debug": "^4.3.3",
"did-resolver": "3.2.2",
"did-resolver": "^3.2.2",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
Expand Down
6 changes: 3 additions & 3 deletions packages/credential-status/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
},
"dependencies": {
"@veramo/core": "^3.1.0",
"credential-status": "^2.0.2",
"did-jwt": "^5.12.4",
"did-resolver": "3.2.2"
"credential-status": "^2.0.3",
"did-jwt": "^6.1.2",
"did-resolver": "^3.2.2"
},
"devDependencies": {
"@types/debug": "4.1.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/credential-w3c/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
"@veramo/message-handler": "^3.1.4",
"@veramo/utils": "^3.1.4",
"debug": "^4.3.3",
"did-jwt-vc": "^2.1.9",
"did-resolver": "3.2.2",
"did-jwt-vc": "^2.1.12",
"did-resolver": "^3.2.2",
"uint8arrays": "^3.0.0",
"uuid": "^8.3.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ describe('@veramo/credential-w3c', () => {
id: `${didEthr}#owner`,
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: args?.didUrl,
blockchainAccountId: `${didEthr.slice(-42)}@eip155:1`,
blockchainAccountId: `eip155:1:${didEthr.slice(-42)}`,
},
],
authentication: [`${didEthr}#owner`],
Expand Down
6 changes: 3 additions & 3 deletions packages/did-comm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"@veramo/utils": "^3.1.4",
"cross-fetch": "^3.1.4",
"debug": "^4.3.3",
"did-jwt": "^5.12.3",
"did-resolver": "3.2.2",
"uint8arrays": "3.0.0",
"did-jwt": "^6.1.2",
"did-resolver": "^3.2.2",
"uint8arrays": "^3.0.0",
"uuid": "^8.3.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/did-jwt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"@veramo/core": "^3.1.4",
"@veramo/message-handler": "^3.1.4",
"debug": "^4.3.3",
"did-jwt": "^5.12.3",
"did-resolver": "3.2.2"
"did-jwt": "^6.1.2",
"did-resolver": "^3.2.2"
},
"devDependencies": {
"@types/debug": "4.1.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/did-provider-ethr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@veramo/core": "^3.1.4",
"@veramo/did-manager": "^3.1.4",
"debug": "^4.3.3",
"ethr-did": "^2.2.0"
"ethr-did": "^2.2.3"
},
"devDependencies": {
"@types/debug": "4.1.7",
Expand Down
4 changes: 2 additions & 2 deletions packages/did-resolver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
"devDependencies": {
"@types/debug": "4.1.7",
"did-resolver": "3.2.2",
"ethr-did-resolver": "5.0.4",
"ethr-did-resolver": "6.0.1",
"typescript": "4.7.3",
"web-did-resolver": "2.0.16"
"web-did-resolver": "2.0.18"
},
"files": [
"build/**/*",
Expand Down
4 changes: 2 additions & 2 deletions packages/did-resolver/src/__tests__/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ describe('@veramo/did-resolver', () => {
didDocument: {
'@context': [
'https://www.w3.org/ns/did/v1',
'https://identity.foundation/EcdsaSecp256k1RecoverySignature2020/lds-ecdsa-secp256k1-recovery2020-0.0.jsonld',
'https://w3id.org/security/suites/secp256k1recovery-2020/v2',
],
id: 'did:ethr:rinkeby:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
verificationMethod: [
{
id: 'did:ethr:rinkeby:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6#controller',
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: 'did:ethr:rinkeby:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
blockchainAccountId: '0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6@eip155:4',
blockchainAccountId: 'eip155:4:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6',
},
],
authentication: ['did:ethr:rinkeby:0xE6Fe788d8ca214A080b0f6aC7F48480b2AEfa9a6#controller'],
Expand Down
10 changes: 5 additions & 5 deletions packages/key-manager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"extract-api": "yarn veramo dev extract-api"
},
"dependencies": {
"@ethersproject/bytes": "5.6.1",
"@ethersproject/strings": "5.6.1",
"@ethersproject/transactions": "5.6.2",
"@ethersproject/bytes": "^5.6.1",
"@ethersproject/strings": "^5.6.1",
"@ethersproject/transactions": "^5.6.2",
"@stablelib/ed25519": "^1.0.2",
"@veramo/core": "^3.1.4",
"did-jwt": "^5.12.3",
"uint8arrays": "3.0.0",
"did-jwt": "^6.1.2",
"uint8arrays": "^3.0.0",
"uuid": "^8.3.2"
},
"devDependencies": {
Expand Down
18 changes: 9 additions & 9 deletions packages/kms-local/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@
"extract-api": "yarn veramo dev extract-api"
},
"dependencies": {
"@ethersproject/abstract-provider": "5.6.1",
"@ethersproject/abstract-signer": "5.6.2",
"@ethersproject/bytes": "5.6.1",
"@ethersproject/random": "5.6.1",
"@ethersproject/signing-key": "5.6.2",
"@ethersproject/strings": "5.6.1",
"@ethersproject/transactions": "5.6.2",
"@ethersproject/wallet": "5.6.2",
"@ethersproject/abstract-provider": "^5.6.1",
"@ethersproject/abstract-signer": "^5.6.2",
"@ethersproject/bytes": "^5.6.1",
"@ethersproject/random": "^5.6.1",
"@ethersproject/signing-key": "^5.6.2",
"@ethersproject/strings": "^5.6.1",
"@ethersproject/transactions": "^5.6.2",
"@ethersproject/wallet": "^5.6.2",
"@stablelib/ed25519": "^1.0.2",
"@stablelib/nacl": "^1.0.2",
"@veramo/core": "^3.1.4",
"@veramo/key-manager": "^3.1.4",
"base-58": "^0.0.1",
"debug": "^4.3.3",
"did-jwt": "^5.12.3",
"did-jwt": "^6.1.2",
"uint8arrays": "^3.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/kms-local/src/key-management-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ export class KeyManagementSystem extends AbstractKeyManagementSystem {
* @returns a base64url encoded signature for the `EdDSA` alg
*/
private async signEdDSA(key: string, data: Uint8Array): Promise<string> {
const signer = EdDSASigner(key)
const signer = EdDSASigner(arrayify(key, { allowMissingPrefix: true }))
const signature = await signer(data)
// base64url encoded string
return signature as string
Expand All @@ -253,7 +253,7 @@ export class KeyManagementSystem extends AbstractKeyManagementSystem {
alg: string | undefined,
data: Uint8Array,
): Promise<string> {
const signer = ES256KSigner(privateKeyHex, alg === 'ES256K-R')
const signer = ES256KSigner(arrayify(privateKeyHex, { allowMissingPrefix: true }), alg === 'ES256K-R')
const signature = await signer(data)
// base64url encoded string
return signature as string
Expand Down
2 changes: 1 addition & 1 deletion packages/selective-disclosure/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@veramo/did-jwt": "^3.1.4",
"@veramo/message-handler": "^3.1.4",
"debug": "^4.3.3",
"did-jwt": "^5.12.3",
"did-jwt": "^6.1.2",
"uuid": "^8.3.0"
},
"devDependencies": {
Expand Down
25 changes: 0 additions & 25 deletions packages/test-react-app/.eslintrc.js

This file was deleted.

33 changes: 33 additions & 0 deletions packages/test-react-app/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"env": {
"jest": true,
"node": true,
"browser": true
},
"globals": {
"page": true,
"browser": true,
"context": true,
"jestPuppeteer": true
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2020,
"ecmaFeatures": {
"jsx": true,
"modules": true,
"experimentalObjectRestSpread": true
}
},
"plugins": [
"react",
"@typescript-eslint"
],
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"ignorePatterns": ["**/*.browser-test.ts"]
}
3 changes: 0 additions & 3 deletions packages/test-react-app/babel.config.js

This file was deleted.

Loading

0 comments on commit 0c77d03

Please sign in to comment.