diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index b1191d0..1523b87 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -22,7 +22,7 @@ jobs: - name: Setup NodeJS uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 18.19.0 cache: 'yarn' - name: Install dependencies @@ -51,7 +51,7 @@ jobs: - name: Setup NodeJS uses: actions/setup-node@v3 with: - node-version: 18 + node-version: 18.19.0 cache: 'yarn' - name: Install dependencies diff --git a/package.json b/package.json index 48bad28..8acfbe0 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@ayanworks/credo-polygon-w3c-module", "main": "build/index", "types": "build/index", - "version": "0.0.2-alpha.2", + "version": "0.0.2-alpha.7", "files": [ "build" ], @@ -27,18 +27,18 @@ "lint": "eslint --ignore-path .gitignore ." }, "dependencies": { - "@credo-ts/askar": "0.5.0", - "@credo-ts/core": "0.5.0", - "@ayanworks/polygon-did-registrar": "0.0.16-alpha.13", - "@ayanworks/polygon-did-resolver": "0.0.16-alpha.10", - "@ayanworks/polygon-schema-manager": "0.0.2-alpha.5", + "@credo-ts/askar": "0.5.1", + "@credo-ts/core": "0.5.1", + "@ayanworks/polygon-did-registrar": "0.0.16-alpha.16", + "@ayanworks/polygon-did-resolver": "0.0.16-alpha.11", + "@ayanworks/polygon-schema-manager": "0.0.2-alpha.6", "did-resolver": "^4.1.0", "ethers": "^6.9.0" }, "devDependencies": { - "@credo-ts/node": "0.5.0", - "@hyperledger/aries-askar-nodejs": "0.2.0", - "@hyperledger/aries-askar-shared": "0.2.0", + "@credo-ts/node": "^0.5.0", + "@hyperledger/aries-askar-nodejs": "^0.2.0", + "@hyperledger/aries-askar-shared": "^0.2.0", "@types/jest": "^26.0.23", "@types/node": "^18.18.8", "@types/uuid": "^9.0.0", @@ -59,5 +59,8 @@ "ts-node": "^10.8.1", "tsconfig-paths": "^4.1.2", "typescript": "~4.9.5" + }, + "engines": { + "node": "18.19.0" } } diff --git a/src/dids/PolygonDidResolver.ts b/src/dids/PolygonDidResolver.ts index be117c7..7933b46 100644 --- a/src/dids/PolygonDidResolver.ts +++ b/src/dids/PolygonDidResolver.ts @@ -1,13 +1,8 @@ -import type { ResolverRegistry } from 'did-resolver' +import type { DidResolutionOptions, AgentContext, DidResolutionResult, DidResolver } from '@credo-ts/core' +import type { ParsedDID, ResolverRegistry } from 'did-resolver' import { getResolver } from '@ayanworks/polygon-did-resolver' -import { - DidDocument, - type AgentContext, - type DidResolutionResult, - type DidResolver, - JsonTransformer, -} from '@credo-ts/core' +import { DidDocument, JsonTransformer } from '@credo-ts/core' import { Resolver } from 'did-resolver' import { isValidPolygonDid } from './didPolygonUtil' @@ -22,8 +17,14 @@ export class PolygonDidResolver implements DidResolver { public constructor() { this.resolver = new Resolver(getResolver() as ResolverRegistry) } - - public async resolve(agentContext: AgentContext, did: string): Promise { + public async resolve( + agentContext: AgentContext, + did: string, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + parsed: ParsedDID, + // eslint-disable-next-line @typescript-eslint/no-unused-vars + didResolutionOptions: DidResolutionOptions + ): Promise { const didDocumentMetadata = {} if (!isValidPolygonDid(did)) { diff --git a/src/dids/didPolygonUtil.ts b/src/dids/didPolygonUtil.ts index 3d9df69..6ece586 100644 --- a/src/dids/didPolygonUtil.ts +++ b/src/dids/didPolygonUtil.ts @@ -36,7 +36,7 @@ export function failedResult(reason: string): DidCreateResult { } } -export function getSecp256k1DidDoc(did: string, key: Key, serviceEndpoint?: string): DidDocument { +export function getSecp256k1DidDoc(did: string, key: Key, serviceEndpoint?: string) { const verificationMethod = getEcdsaSecp256k1VerificationKey2019({ id: `${did}#key-1`, key, diff --git a/tests/polygon-did.e2e.test.ts b/tests/polygon-did.e2e.test.ts index bc36899..71f82d4 100644 --- a/tests/polygon-did.e2e.test.ts +++ b/tests/polygon-did.e2e.test.ts @@ -47,7 +47,7 @@ describe('Polygon Module did resolver', () => { askar: new AskarModule({ ariesAskar }), // Add required modules polygon: new PolygonModule({ - rpcUrl: 'https://rpc-mumbai.maticvigil.com/', + rpcUrl: 'https://rpc-amoy.polygon.technology', didContractAddress: '0x12513116875BB3E4F098Ce74624739Ee51bAf023', fileServerToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBeWFuV29ya3MiLCJpZCI6IjdmYjRmN2I3LWQ5ZWUtNDYxOC04OTE4LWZiMmIzYzY1M2EyYiJ9.x-kHeTVqX4w19ibSAspCYgIL-JFVss8yZ0CT21QVRYM', diff --git a/tests/polygon-schema.test.ts b/tests/polygon-schema.test.ts index 31eecc7..bf36dd1 100644 --- a/tests/polygon-schema.test.ts +++ b/tests/polygon-schema.test.ts @@ -108,7 +108,7 @@ describe('Polygon Module did resolver', () => { askar: new AskarModule({ ariesAskar }), // Add required modules polygon: new PolygonModule({ - rpcUrl: 'https://rpc-mumbai.maticvigil.com/', + rpcUrl: 'https://rpc-amoy.polygon.technology', didContractAddress: '0x12513116875BB3E4F098Ce74624739Ee51bAf023', fileServerToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBeWFuV29ya3MiLCJpZCI6IjdmYjRmN2I3LWQ5ZWUtNDYxOC04OTE4LWZiMmIzYzY1M2EyYiJ9.x-kHeTVqX4w19ibSAspCYgIL-JFVss8yZ0CT21QVRYM', diff --git a/tests/utils.ts b/tests/utils.ts index e9a69c7..854f84b 100644 --- a/tests/utils.ts +++ b/tests/utils.ts @@ -57,7 +57,7 @@ export function getAgentConfig( ): AgentConfig & { walletConfig: WalletConfig } { const { config, dependencies } = getAgentOptions(name, extraConfig, { polygon: new PolygonModule({ - rpcUrl: 'https://rpc-mumbai.maticvigil.com/', + rpcUrl: 'https://rpc-amoy.polygon.technology', didContractAddress: '0x12513116875BB3E4F098Ce74624739Ee51bAf023', fileServerToken: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJBeWFuV29ya3MiLCJpZCI6IjdmYjRmN2I3LWQ5ZWUtNDYxOC04OTE4LWZiMmIzYzY1M2EyYiJ9.x-kHeTVqX4w19ibSAspCYgIL-JFVss8yZ0CT21QVRYM', diff --git a/yarn.lock b/yarn.lock index be372e2..655ab5b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -49,14 +49,14 @@ dependencies: static-eval "2.0.2" -"@ayanworks/polygon-did-registrar@0.0.16-alpha.13": - version "0.0.16-alpha.13" - resolved "https://registry.yarnpkg.com/@ayanworks/polygon-did-registrar/-/polygon-did-registrar-0.0.16-alpha.13.tgz#cdb7f4dfee1f6e97006630d57c3a520051c09aeb" - integrity sha512-fihShp7HMMtzwuxV0VAVk/piktr/auig2Gj0rGq0S1x0GWP0NbZy7baLZvsVx4/kjgFNqu6cv3p42dmYVnRuIg== +"@ayanworks/polygon-did-registrar@0.0.16-alpha.16": + version "0.0.16-alpha.16" + resolved "https://registry.yarnpkg.com/@ayanworks/polygon-did-registrar/-/polygon-did-registrar-0.0.16-alpha.16.tgz#8467412a8138ffb8b2305bf4ea7914a4ce979267" + integrity sha512-q3Y1bzeHmCAxRpbA6rXKaO9CQhLjlP4aMZuJxYiiicPlQ6plkRt+Icxdp1ozsCEcMouj3l4E5kgzjK48bhOxrw== dependencies: "@ayanworks/polygon-did-registry-contract" "2.0.1-alpha.3" - "@ayanworks/polygon-did-resolver" "^0.0.16-alpha.10" - "@credo-ts/core" "0.5.0" + "@ayanworks/polygon-did-resolver" "^0.0.16-alpha.11" + "@credo-ts/core" "0.5.1" "@ethersproject/basex" "^5.7.0" "@ethersproject/signing-key" "^5.7.0" "@ethersproject/transactions" "^5.7.0" @@ -70,22 +70,22 @@ resolved "https://registry.yarnpkg.com/@ayanworks/polygon-did-registry-contract/-/polygon-did-registry-contract-2.0.1-alpha.3.tgz#7bb932b712a4c48df857682f27adfb08154c4358" integrity sha512-8FZZVAmzXZn0pjZasuxdRblL0obK91JoaoXzpM4oZ7hD5VRUbiWf7BTh17WsWc6Oaf6XtafT4csuBo11fZiUoQ== -"@ayanworks/polygon-did-resolver@0.0.16-alpha.10", "@ayanworks/polygon-did-resolver@^0.0.16-alpha.10", "@ayanworks/polygon-did-resolver@^0.0.16-alpha.3": - version "0.0.16-alpha.10" - resolved "https://registry.yarnpkg.com/@ayanworks/polygon-did-resolver/-/polygon-did-resolver-0.0.16-alpha.10.tgz#85eb53f2f6dd53c5e6342e9d6d0c70bb560fa281" - integrity sha512-RfxDr+bggYcLsdN6nK+VKwjVLZzy3AqGULSsYT2bU+4n8obptufVIDg1cjbI4zi0eQIVmtkUeaHcJMlaR6wvvA== +"@ayanworks/polygon-did-resolver@0.0.16-alpha.11", "@ayanworks/polygon-did-resolver@^0.0.16-alpha.11": + version "0.0.16-alpha.11" + resolved "https://registry.yarnpkg.com/@ayanworks/polygon-did-resolver/-/polygon-did-resolver-0.0.16-alpha.11.tgz#fe115f9a63eea5e0604712549e9c573dcef7d55c" + integrity sha512-rQ6iVz0uht/hLkYA29E2iHN7xW0EusG6ognndBJF0QUxuPBB2kbmcr/4kW1E1m8FJLPvmEX/ed5v0pbBnGSJwA== dependencies: "@ayanworks/polygon-did-registry-contract" "2.0.1-alpha.3" did-resolver "^4.1.0" ethers "^5.1.0" -"@ayanworks/polygon-schema-manager@0.0.2-alpha.5": - version "0.0.2-alpha.5" - resolved "https://registry.yarnpkg.com/@ayanworks/polygon-schema-manager/-/polygon-schema-manager-0.0.2-alpha.5.tgz#f5b29b513c07f28eb52f52d6fa33ffec0b919370" - integrity sha512-0BnJ2FxmHnLia2zDxj7MPRnD7u5FA3LZF8xwuZf5vlHE9Jh/sgV6dQg5XMnPYmyhdlxSrTQ8FpNZbAir2PuMGQ== +"@ayanworks/polygon-schema-manager@0.0.2-alpha.6": + version "0.0.2-alpha.6" + resolved "https://registry.yarnpkg.com/@ayanworks/polygon-schema-manager/-/polygon-schema-manager-0.0.2-alpha.6.tgz#a872afc1166e39561dba63f0ba83f898376bb874" + integrity sha512-H8W0eS//Q3eDCiwtEqfqPhGW3bRLWOkJU1EYOuiwZGaIuZb4kWbYqAGdgl0s5g0ZP1rjirk4Ztx1w10cWqsZWw== dependencies: "@ayanworks/polygon-did-registry-contract" "2.0.1-alpha.3" - "@ayanworks/polygon-did-resolver" "^0.0.16-alpha.3" + "@ayanworks/polygon-did-resolver" "^0.0.16-alpha.11" "@nomicfoundation/hardhat-verify" "^2.0.3" axios "^1.6.3" did-resolver "^4.1.0" @@ -506,22 +506,22 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@credo-ts/askar@0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@credo-ts/askar/-/askar-0.5.0.tgz#5fa2e6443fe3ae1b15c8b66eb73e63beb5c096a1" - integrity sha512-84wxDU6GbucBTe4HV7gUbCieFdhXVX19q8o6dNK8a3zl87yiV3OVwPwtnzghjh47vv14Xr+gWRvqbRvZrhRsaA== +"@credo-ts/askar@0.5.1": + version "0.5.1" + resolved "https://registry.yarnpkg.com/@credo-ts/askar/-/askar-0.5.1.tgz#107d2f91f6afecb77fc7f24556725ec0e7597989" + integrity sha512-O3XWnmpnEe5U/a0kGQHigzXPw6/SXKp2v4ob3DJdHA0kiK3DywANNeG/Hw44lxdg24nNpizmVlO5EjRa6ULcmw== dependencies: - "@credo-ts/core" "0.5.0" + "@credo-ts/core" "0.5.1" bn.js "^5.2.1" class-transformer "0.5.1" class-validator "0.14.1" rxjs "^7.8.0" tsyringe "^4.8.0" -"@credo-ts/core@0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@credo-ts/core/-/core-0.5.0.tgz#a6366df4b176a492f4f45b7e2f45b8c905e1eeca" - integrity sha512-7SJBgs1yd2gpwv8BnCO+U63Uu06v6Cxzg+ypWpqyNkkG4nTsQZSI8r0oSQ+DgbiqwN/AZKsn9HuNISFftf5yKQ== +"@credo-ts/core@0.5.1": + version "0.5.1" + resolved "https://registry.yarnpkg.com/@credo-ts/core/-/core-0.5.1.tgz#bb38e2f5451753cea1d3a73b1d407255af02c4ed" + integrity sha512-ywwFw6wwiMft3A994Y91LAm8CrEg2G7CJQRyLD8UzneU4coMWZTeED63thAEX6XK/tyDmv2MAcrO04hE3KQPcA== dependencies: "@digitalcredentials/jsonld" "^6.0.0" "@digitalcredentials/jsonld-signatures" "^9.4.0" @@ -555,14 +555,14 @@ varint "^6.0.0" web-did-resolver "^2.0.21" -"@credo-ts/node@0.5.0": - version "0.5.0" - resolved "https://registry.yarnpkg.com/@credo-ts/node/-/node-0.5.0.tgz#d28ed5040f9925777a65f66f55abed7c2d2e53de" - integrity sha512-/44SrgmjuRDE4Sjb6QDMvquPTUsH5DkIp8pbN7csLe0GEDDzPOUvzCaf4yI7TRnuSZN9Nh9/f6C2UGn0JuQ0Sg== +"@credo-ts/node@^0.5.0": + version "0.5.1" + resolved "https://registry.yarnpkg.com/@credo-ts/node/-/node-0.5.1.tgz#adf24f931fd80848722f8f313012be00da405deb" + integrity sha512-F/PA3wyKN9MvH2JFSUmYGqQT+JaeSGKWNJxT+OkQzqseCZnCbErAnr8oNWlTwBWogp6ECx31FEn9wMq9zAMLaw== dependencies: "@2060.io/ffi-napi" "^4.0.8" "@2060.io/ref-napi" "^3.0.6" - "@credo-ts/core" "0.5.0" + "@credo-ts/core" "0.5.1" "@types/express" "^4.17.15" express "^4.17.1" ws "^8.13.0" @@ -1145,7 +1145,7 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-1.2.1.tgz#b520529ec21d8e5945a1851dfd1c32e94e39ff45" integrity sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA== -"@hyperledger/aries-askar-nodejs@0.2.0": +"@hyperledger/aries-askar-nodejs@^0.2.0": version "0.2.0" resolved "https://registry.yarnpkg.com/@hyperledger/aries-askar-nodejs/-/aries-askar-nodejs-0.2.0.tgz#7a0b469184f0682d0e31955e29d091956f662273" integrity sha512-d73D2zK1f1cM5y8MFp4BK+NvkquujDlRr91THpxkuRwmLf407gibOY3G4OdGIkL1kQtorGM5c5U0/qMzW+8E1Q== @@ -1158,7 +1158,7 @@ ref-array-di "^1.2.2" ref-struct-di "^1.1.1" -"@hyperledger/aries-askar-shared@0.2.0": +"@hyperledger/aries-askar-shared@0.2.0", "@hyperledger/aries-askar-shared@^0.2.0": version "0.2.0" resolved "https://registry.yarnpkg.com/@hyperledger/aries-askar-shared/-/aries-askar-shared-0.2.0.tgz#9291733f8fa1e3039dfe36e1fabca1819b93bd1b" integrity sha512-A6bHbTwTtV1YT3XphNFltX34DCBtj7qPyip4R+WAQFnus5286a2xsppNvl5OAPMAxgKjQTdyFBqcYaNRc0lqIQ==