diff --git a/demo/package.json b/demo/package.json index 247a4513cd..289273b81d 100644 --- a/demo/package.json +++ b/demo/package.json @@ -13,6 +13,11 @@ "faber": "ts-node src/FaberInquirer.ts", "refresh": "rm -rf ./node_modules ./yarn.lock && yarn" }, + "dependencies": { + "@hyperledger/indy-vdr-nodejs": "0.1.0-dev.12", + "@hyperledger/anoncreds-nodejs": "^0.1.0-dev.11", + "@hyperledger/aries-askar-nodejs": "^0.1.0-dev.6" + }, "devDependencies": { "@aries-framework/anoncreds": "*", "@aries-framework/anoncreds-rs": "*", diff --git a/demo/src/BaseAgent.ts b/demo/src/BaseAgent.ts index f06d0016fe..18f51f8c78 100644 --- a/demo/src/BaseAgent.ts +++ b/demo/src/BaseAgent.ts @@ -25,6 +25,9 @@ import { import { IndySdkAnonCredsRegistry, IndySdkModule, IndySdkSovDidResolver } from '@aries-framework/indy-sdk' import { IndyVdrAnonCredsRegistry, IndyVdrModule, IndyVdrSovDidResolver } from '@aries-framework/indy-vdr' import { agentDependencies, HttpInboundTransport } from '@aries-framework/node' +import { anoncreds } from '@hyperledger/anoncreds-nodejs' +import { ariesAskar } from '@hyperledger/aries-askar-nodejs' +import { indyVdr } from '@hyperledger/indy-vdr-nodejs' import { randomUUID } from 'crypto' import indySdk from 'indy-sdk' @@ -125,14 +128,19 @@ function getAskarAnonCredsIndyModules() { anoncreds: new AnonCredsModule({ registries: [new IndyVdrAnonCredsRegistry()], }), - anoncredsRs: new AnonCredsRsModule(), + anoncredsRs: new AnonCredsRsModule({ + anoncreds, + }), indyVdr: new IndyVdrModule({ + indyVdr, networks: [indyNetworkConfig], }), dids: new DidsModule({ resolvers: [new IndyVdrSovDidResolver()], }), - askar: new AskarModule(), + askar: new AskarModule({ + ariesAskar, + }), } as const } diff --git a/packages/anoncreds-rs/package.json b/packages/anoncreds-rs/package.json index a8a5b3032c..c6ab13dfd5 100644 --- a/packages/anoncreds-rs/package.json +++ b/packages/anoncreds-rs/package.json @@ -26,14 +26,14 @@ "dependencies": { "@aries-framework/core": "0.3.3", "@aries-framework/anoncreds": "0.3.3", - "@hyperledger/anoncreds-shared": "^0.1.0-dev.10", + "@hyperledger/anoncreds-shared": "^0.1.0-dev.11", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", "rxjs": "^7.2.0", "tsyringe": "^4.7.0" }, "devDependencies": { - "@hyperledger/anoncreds-nodejs": "^0.1.0-dev.10", + "@hyperledger/anoncreds-nodejs": "^0.1.0-dev.11", "reflect-metadata": "^0.1.13", "rimraf": "^4.0.7", "typescript": "~4.9.4" diff --git a/packages/anoncreds-rs/src/AnonCredsRsModule.ts b/packages/anoncreds-rs/src/AnonCredsRsModule.ts index 4ceb7b8304..cca3f465fd 100644 --- a/packages/anoncreds-rs/src/AnonCredsRsModule.ts +++ b/packages/anoncreds-rs/src/AnonCredsRsModule.ts @@ -1,3 +1,4 @@ +import type { AnonCredsRsModuleConfigOptions } from './AnonCredsRsModuleConfig' import type { DependencyManager, Module } from '@aries-framework/core' import { @@ -6,20 +7,18 @@ import { AnonCredsVerifierServiceSymbol, } from '@aries-framework/anoncreds' +import { AnonCredsRsModuleConfig } from './AnonCredsRsModuleConfig' import { AnonCredsRsHolderService, AnonCredsRsIssuerService, AnonCredsRsVerifierService } from './services' export class AnonCredsRsModule implements Module { + public readonly config: AnonCredsRsModuleConfig + + public constructor(config: AnonCredsRsModuleConfigOptions) { + this.config = new AnonCredsRsModuleConfig(config) + } + public register(dependencyManager: DependencyManager) { - try { - // eslint-disable-next-line import/no-extraneous-dependencies - require('@hyperledger/anoncreds-nodejs') - } catch (error) { - try { - require('@hyperledger/anoncreds-react-native') - } catch (error) { - throw new Error('Could not load anoncreds bindings') - } - } + dependencyManager.registerInstance(AnonCredsRsModuleConfig, this.config) // Register services dependencyManager.registerSingleton(AnonCredsHolderServiceSymbol, AnonCredsRsHolderService) diff --git a/packages/anoncreds-rs/src/AnonCredsRsModuleConfig.ts b/packages/anoncreds-rs/src/AnonCredsRsModuleConfig.ts new file mode 100644 index 0000000000..2d676b4d52 --- /dev/null +++ b/packages/anoncreds-rs/src/AnonCredsRsModuleConfig.ts @@ -0,0 +1,58 @@ +import type { Anoncreds } from '@hyperledger/anoncreds-shared' + +/** + * @public + * AnonCredsRsModuleConfigOptions defines the interface for the options of the AnonCredsRsModuleConfig class. + */ +export interface AnonCredsRsModuleConfigOptions { + /** + * + * ## Node.JS + * + * ```ts + * import { anoncreds } from '@hyperledger/anoncreds-nodejs' + * + * const agent = new Agent({ + * config: {}, + * dependencies: agentDependencies, + * modules: { + * anoncredsRs: new AnoncredsRsModule({ + * anoncreds, + * }) + * } + * }) + * ``` + * + * ## React Native + * + * ```ts + * import { anoncreds } from '@hyperledger/anoncreds-react-native' + * + * const agent = new Agent({ + * config: {}, + * dependencies: agentDependencies, + * modules: { + * anoncredsRs: new AnoncredsRsModule({ + * anoncreds, + * }) + * } + * }) + * ``` + */ + anoncreds: Anoncreds +} + +/** + * @public + */ +export class AnonCredsRsModuleConfig { + private options: AnonCredsRsModuleConfigOptions + + public constructor(options: AnonCredsRsModuleConfigOptions) { + this.options = options + } + + public get anoncreds() { + return this.options.anoncreds + } +} diff --git a/packages/anoncreds-rs/src/types.ts b/packages/anoncreds-rs/src/types.ts deleted file mode 100644 index 2694976be7..0000000000 --- a/packages/anoncreds-rs/src/types.ts +++ /dev/null @@ -1,4 +0,0 @@ -import type { Anoncreds } from '@hyperledger/anoncreds-shared' - -export const AnonCredsRsSymbol = Symbol('AnonCredsRs') -export type { Anoncreds } diff --git a/packages/anoncreds/package.json b/packages/anoncreds/package.json index ed2353d6db..9f1ab9d6e2 100644 --- a/packages/anoncreds/package.json +++ b/packages/anoncreds/package.json @@ -31,6 +31,7 @@ }, "devDependencies": { "@aries-framework/node": "0.3.3", + "@hyperledger/anoncreds-nodejs": "^0.1.0-dev.11", "indy-sdk": "^1.16.0-dev-1636", "rimraf": "^4.0.7", "rxjs": "^7.8.0", diff --git a/packages/anoncreds/tests/legacyAnonCredsSetup.ts b/packages/anoncreds/tests/legacyAnonCredsSetup.ts index d0e40a33a6..d0f408b069 100644 --- a/packages/anoncreds/tests/legacyAnonCredsSetup.ts +++ b/packages/anoncreds/tests/legacyAnonCredsSetup.ts @@ -27,21 +27,19 @@ import { V2ProofProtocol, DidsModule, } from '@aries-framework/core' +import { anoncreds } from '@hyperledger/anoncreds-nodejs' import { randomUUID } from 'crypto' import { AnonCredsRsModule } from '../../anoncreds-rs/src' import { AskarModule } from '../../askar/src' +import { askarModuleConfig } from '../../askar/tests/helpers' import { sleep } from '../../core/src/utils/sleep' -import { uuid } from '../../core/src/utils/uuid' import { setupSubjectTransports, setupEventReplaySubjects } from '../../core/tests' import { getAgentOptions, importExistingIndyDidFromPrivateKey, makeConnection, publicDidSeed, - genesisTransactions, - taaVersion, - taaAcceptanceMechanism, waitForCredentialRecordSubject, waitForProofExchangeRecordSubject, } from '../../core/tests/helpers' @@ -67,6 +65,7 @@ import { IndyVdrIndyDidResolver, IndyVdrIndyDidRegistrar, } from '../../indy-vdr/src' +import { indyVdrModuleConfig } from '../../indy-vdr/tests/helpers' import { V1CredentialProtocol, V1ProofProtocol, @@ -130,14 +129,6 @@ export const getAskarAnonCredsIndyModules = ({ const legacyIndyCredentialFormatService = new LegacyIndyCredentialFormatService() const legacyIndyProofFormatService = new LegacyIndyProofFormatService() - const indyNetworkConfig = { - id: `localhost-${uuid()}`, - isProduction: false, - genesisTransactions, - indyNamespace: 'pool:localtest', - transactionAuthorAgreement: { version: taaVersion, acceptanceMechanism: taaAcceptanceMechanism }, - } - const modules = { credentials: new CredentialsModule({ autoAcceptCredentials, @@ -164,15 +155,15 @@ export const getAskarAnonCredsIndyModules = ({ anoncreds: new AnonCredsModule({ registries: [new IndyVdrAnonCredsRegistry()], }), - anoncredsRs: new AnonCredsRsModule(), - indyVdr: new IndyVdrModule({ - networks: [indyNetworkConfig], + anoncredsRs: new AnonCredsRsModule({ + anoncreds, }), + indyVdr: new IndyVdrModule(indyVdrModuleConfig), dids: new DidsModule({ resolvers: [new IndyVdrSovDidResolver(), new IndyVdrIndyDidResolver()], registrars: [new IndyVdrIndyDidRegistrar()], }), - askar: new AskarModule(), + askar: new AskarModule(askarModuleConfig), cache: new CacheModule({ cache: new InMemoryLruCache({ limit: 100 }), }), diff --git a/packages/askar/package.json b/packages/askar/package.json index e30054715f..57cd37143f 100644 --- a/packages/askar/package.json +++ b/packages/askar/package.json @@ -25,7 +25,7 @@ }, "dependencies": { "@aries-framework/core": "0.3.3", - "@hyperledger/aries-askar-shared": "^0.1.0-dev.5", + "@hyperledger/aries-askar-shared": "^0.1.0-dev.6", "bn.js": "^5.2.1", "class-transformer": "^0.5.1", "class-validator": "^0.14.0", @@ -34,7 +34,7 @@ }, "devDependencies": { "@types/bn.js": "^5.1.0", - "@hyperledger/aries-askar-nodejs": "^0.1.0-dev.5", + "@hyperledger/aries-askar-nodejs": "^0.1.0-dev.6", "reflect-metadata": "^0.1.13", "rimraf": "^4.0.7", "typescript": "~4.9.4" diff --git a/packages/askar/src/AskarModule.ts b/packages/askar/src/AskarModule.ts index 5eccb13b3d..8a22d82323 100644 --- a/packages/askar/src/AskarModule.ts +++ b/packages/askar/src/AskarModule.ts @@ -1,22 +1,21 @@ +import type { AskarModuleConfigOptions } from './AskarModuleConfig' import type { DependencyManager, Module } from '@aries-framework/core' import { AriesFrameworkError, InjectionSymbols } from '@aries-framework/core' +import { AskarModuleConfig } from './AskarModuleConfig' import { AskarStorageService } from './storage' import { AskarWallet } from './wallet' export class AskarModule implements Module { + public readonly config: AskarModuleConfig + + public constructor(config: AskarModuleConfigOptions) { + this.config = new AskarModuleConfig(config) + } + public register(dependencyManager: DependencyManager) { - try { - // eslint-disable-next-line import/no-extraneous-dependencies - require('@hyperledger/aries-askar-nodejs') - } catch (error) { - try { - require('@hyperledger/aries-askar-react-native') - } catch (error) { - throw new Error('Could not load aries-askar bindings') - } - } + dependencyManager.registerInstance(AskarModuleConfig, this.config) if (dependencyManager.isRegistered(InjectionSymbols.Wallet)) { throw new AriesFrameworkError('There is an instance of Wallet already registered') diff --git a/packages/askar/src/AskarModuleConfig.ts b/packages/askar/src/AskarModuleConfig.ts new file mode 100644 index 0000000000..38eebdde86 --- /dev/null +++ b/packages/askar/src/AskarModuleConfig.ts @@ -0,0 +1,54 @@ +import type { AriesAskar } from '@hyperledger/aries-askar-shared' + +export interface AskarModuleConfigOptions { + /** + * + * ## Node.JS + * + * ```ts + * import { ariesAskar } from '@hyperledger/aries-askar-nodejs' + * + * const agent = new Agent({ + * config: {}, + * dependencies: agentDependencies, + * modules: { + * ariesAskar: new AskarModule({ + * ariesAskar, + * }) + * } + * }) + * ``` + * + * ## React Native + * + * ```ts + * import { ariesAskar } from '@hyperledger/aries-askar-react-native' + * + * const agent = new Agent({ + * config: {}, + * dependencies: agentDependencies, + * modules: { + * ariesAskar: new AskarModule({ + * ariesAskar, + * }) + * } + * }) + * ``` + */ + ariesAskar: AriesAskar +} + +/** + * @public + */ +export class AskarModuleConfig { + private options: AskarModuleConfigOptions + + public constructor(options: AskarModuleConfigOptions) { + this.options = options + } + + public get ariesAskar() { + return this.options.ariesAskar + } +} diff --git a/packages/askar/src/storage/__tests__/AskarStorageService.test.ts b/packages/askar/src/storage/__tests__/AskarStorageService.test.ts index 956d0b124b..714a387c7d 100644 --- a/packages/askar/src/storage/__tests__/AskarStorageService.test.ts +++ b/packages/askar/src/storage/__tests__/AskarStorageService.test.ts @@ -6,7 +6,7 @@ import { RecordDuplicateError, RecordNotFoundError, } from '@aries-framework/core' -import { ariesAskar } from '@hyperledger/aries-askar-shared' +import { ariesAskar } from '@hyperledger/aries-askar-nodejs' import { describeRunInNodeVersion } from '../../../../../tests/runInVersion' import { TestRecord } from '../../../../core/src/storage/__tests__/TestRecord' @@ -30,8 +30,7 @@ describeRunInNodeVersion([18], 'AskarStorageService', () => { wallet, agentConfig, }) - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - await wallet.createAndOpen(agentConfig.walletConfig!) + await wallet.createAndOpen(agentConfig.walletConfig) storageService = new AskarStorageService() }) diff --git a/packages/askar/src/types.ts b/packages/askar/src/types.ts deleted file mode 100644 index bc0baa2947..0000000000 --- a/packages/askar/src/types.ts +++ /dev/null @@ -1,3 +0,0 @@ -import type { AriesAskar } from '@hyperledger/aries-askar-shared' - -export type { AriesAskar } diff --git a/packages/askar/tests/helpers.ts b/packages/askar/tests/helpers.ts index 9321aca39d..3921e080ff 100644 --- a/packages/askar/tests/helpers.ts +++ b/packages/askar/tests/helpers.ts @@ -2,11 +2,15 @@ import type { AskarWalletPostgresStorageConfig } from '../src/wallet' import type { InitConfig } from '@aries-framework/core' import { LogLevel } from '@aries-framework/core' +import { ariesAskar } from '@hyperledger/aries-askar-nodejs' import path from 'path' import { TestLogger } from '../../core/tests/logger' import { agentDependencies } from '../../node/src' import { AskarModule } from '../src/AskarModule' +import { AskarModuleConfig } from '../src/AskarModuleConfig' + +export const askarModuleConfig = new AskarModuleConfig({ ariesAskar }) export const genesisPath = process.env.GENESIS_TXN_PATH ? path.resolve(process.env.GENESIS_TXN_PATH) @@ -34,7 +38,7 @@ export function getPostgresAgentOptions( return { config, dependencies: agentDependencies, - modules: { askar: new AskarModule() }, + modules: { askar: new AskarModule(askarModuleConfig) }, } as const } @@ -54,6 +58,6 @@ export function getSqliteAgentOptions(name: string, extraConfig: Partial { content: message, }) + // polling interval is 100ms, so 500ms should be enough to make sure no messages are sent + await recipientAgent.mediationRecipient.stopMessagePickup() + await sleep(500) + expect(basicMessage.content).toBe(message) } @@ -159,6 +164,7 @@ describe('mediator establishment', () => { config: { ...recipientAgentOptions.config, mediatorPickupStrategy: MediatorPickupStrategy.PickUpV1, + mediatorPollingInterval: 100, }, }) }) @@ -175,6 +181,7 @@ describe('mediator establishment', () => { ...recipientAgentOptions.config, mediatorPickupStrategy: MediatorPickupStrategy.PickUpV1, useDidKeyInProtocols: false, + mediatorPollingInterval: 100, }, } ) diff --git a/packages/indy-sdk-to-askar-migration/package.json b/packages/indy-sdk-to-askar-migration/package.json index 87373300f3..5f8171a183 100644 --- a/packages/indy-sdk-to-askar-migration/package.json +++ b/packages/indy-sdk-to-askar-migration/package.json @@ -29,10 +29,10 @@ "@aries-framework/core": "^0.3.3", "@aries-framework/indy-sdk": "^0.3.3", "@aries-framework/node": "^0.3.3", - "@hyperledger/aries-askar-shared": "^0.1.0-dev.5" + "@hyperledger/aries-askar-shared": "^0.1.0-dev.6" }, "devDependencies": { - "@hyperledger/aries-askar-nodejs": "^0.1.0-dev.5", + "@hyperledger/aries-askar-nodejs": "^0.1.0-dev.6", "indy-sdk": "^1.16.0-dev-1655", "rimraf": "^4.0.7", "typescript": "~4.9.4" diff --git a/packages/indy-sdk-to-askar-migration/tests/migrate.test.ts b/packages/indy-sdk-to-askar-migration/tests/migrate.test.ts index 5d8b6f64ab..a5bd7e87b2 100644 --- a/packages/indy-sdk-to-askar-migration/tests/migrate.test.ts +++ b/packages/indy-sdk-to-askar-migration/tests/migrate.test.ts @@ -44,7 +44,11 @@ describeRunInNodeVersion([18], 'Indy SDK To Askar Migration', () => { const invalidNewAgent = new Agent({ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion config: { ...invalidConfig, walletConfig: { ...invalidConfig.walletConfig!, key: 'wrong-key' } }, - modules: { askar: new AskarModule() }, + modules: { + askar: new AskarModule({ + ariesAskar, + }), + }, dependencies: agentDependencies, }) @@ -58,7 +62,11 @@ describeRunInNodeVersion([18], 'Indy SDK To Askar Migration', () => { const newAgent = new Agent({ config, - modules: { askar: new AskarModule() }, + modules: { + askar: new AskarModule({ + ariesAskar, + }), + }, dependencies: agentDependencies, }) diff --git a/packages/indy-vdr/package.json b/packages/indy-vdr/package.json index 98b6d946f5..f7eee340a7 100644 --- a/packages/indy-vdr/package.json +++ b/packages/indy-vdr/package.json @@ -26,10 +26,10 @@ "dependencies": { "@aries-framework/anoncreds": "0.3.3", "@aries-framework/core": "0.3.3", - "@hyperledger/indy-vdr-shared": "^0.1.0-dev.10" + "@hyperledger/indy-vdr-shared": "0.1.0-dev.12" }, "devDependencies": { - "@hyperledger/indy-vdr-nodejs": "^0.1.0-dev.10", + "@hyperledger/indy-vdr-nodejs": "0.1.0-dev.12", "@stablelib/ed25519": "^1.0.2", "rimraf": "^4.0.7", "rxjs": "^7.2.0", diff --git a/packages/indy-vdr/src/IndyVdrModule.ts b/packages/indy-vdr/src/IndyVdrModule.ts index 44dc54ff8a..d03db3c08d 100644 --- a/packages/indy-vdr/src/IndyVdrModule.ts +++ b/packages/indy-vdr/src/IndyVdrModule.ts @@ -15,17 +15,6 @@ export class IndyVdrModule implements Module { } public register(dependencyManager: DependencyManager) { - try { - // eslint-disable-next-line import/no-extraneous-dependencies - require('@hyperledger/indy-vdr-nodejs') - } catch (error) { - try { - require('@hyperledger/indy-vdr-react-native') - } catch (error) { - throw new Error('Error registering bindings for Indy VDR') - } - } - // Config dependencyManager.registerInstance(IndyVdrModuleConfig, this.config) diff --git a/packages/indy-vdr/src/IndyVdrModuleConfig.ts b/packages/indy-vdr/src/IndyVdrModuleConfig.ts index 6b6b2eaddb..086846ddf7 100644 --- a/packages/indy-vdr/src/IndyVdrModuleConfig.ts +++ b/packages/indy-vdr/src/IndyVdrModuleConfig.ts @@ -1,10 +1,47 @@ import type { IndyVdrPoolConfig } from './pool' +import type { IndyVdr } from '@hyperledger/indy-vdr-shared' export interface IndyVdrModuleConfigOptions { + /** + * + * ## Node.JS + * + * ```ts + * import { indyVdr } from '@hyperledger/indy-vdr-nodejs'; + * + * const agent = new Agent({ + * config: {}, + * dependencies: agentDependencies, + * modules: { + * indyVdr: new IndyVdrModule({ + * indyVdr, + * }) + * } + * }) + * ``` + * + * ## React Native + * + * ```ts + * import { indyVdr } from '@hyperledger/indy-vdr-react-native'; + * + * const agent = new Agent({ + * config: {}, + * dependencies: agentDependencies, + * modules: { + * indyVdr: new IndyVdrModule({ + * indyVdr, + * }) + * } + * }) + * ``` + */ + indyVdr: IndyVdr + /** * Array of indy networks to connect to. * - * [@default](https://github.com/default) [] + * @default [] * * @example * ``` @@ -33,4 +70,9 @@ export class IndyVdrModuleConfig { public get networks() { return this.options.networks } + + /** See {@link IndyVdrModuleConfigOptions.indyVdr} */ + public get indyVdr() { + return this.options.indyVdr + } } diff --git a/packages/indy-vdr/src/__tests__/IndyVdrModule.test.ts b/packages/indy-vdr/src/__tests__/IndyVdrModule.test.ts index 4d904fa133..1b9b55c8e4 100644 --- a/packages/indy-vdr/src/__tests__/IndyVdrModule.test.ts +++ b/packages/indy-vdr/src/__tests__/IndyVdrModule.test.ts @@ -1,5 +1,7 @@ import type { DependencyManager } from '@aries-framework/core' +import { indyVdr } from '@hyperledger/indy-vdr-nodejs' + import { IndyVdrModule } from '../IndyVdrModule' import { IndyVdrModuleConfig } from '../IndyVdrModuleConfig' import { IndyVdrPoolService } from '../pool' @@ -12,6 +14,7 @@ const dependencyManager = { describe('IndyVdrModule', () => { test('registers dependencies on the dependency manager', () => { const indyVdrModule = new IndyVdrModule({ + indyVdr, networks: [ { isProduction: false, diff --git a/packages/indy-vdr/src/__tests__/IndyVdrModuleConfig.test.ts b/packages/indy-vdr/src/__tests__/IndyVdrModuleConfig.test.ts index db86ddb519..b1abb77784 100644 --- a/packages/indy-vdr/src/__tests__/IndyVdrModuleConfig.test.ts +++ b/packages/indy-vdr/src/__tests__/IndyVdrModuleConfig.test.ts @@ -1,5 +1,7 @@ import type { IndyVdrPoolConfig } from '../pool' +import { indyVdr } from '@hyperledger/indy-vdr-nodejs' + import { IndyVdrModuleConfig } from '../IndyVdrModuleConfig' describe('IndyVdrModuleConfig', () => { @@ -7,6 +9,7 @@ describe('IndyVdrModuleConfig', () => { const networkConfig = {} as IndyVdrPoolConfig const config = new IndyVdrModuleConfig({ + indyVdr, networks: [networkConfig], }) diff --git a/packages/indy-vdr/tests/helpers.ts b/packages/indy-vdr/tests/helpers.ts index 2ea2390329..1d1b94494e 100644 --- a/packages/indy-vdr/tests/helpers.ts +++ b/packages/indy-vdr/tests/helpers.ts @@ -2,11 +2,13 @@ import type { IndyVdrDidCreateOptions } from '../src/dids/IndyVdrIndyDidRegistra import type { Agent } from '@aries-framework/core' import { DidCommV1Service, DidCommV2Service, DidDocumentService, KeyType } from '@aries-framework/core' +import { indyVdr } from '@hyperledger/indy-vdr-nodejs' import { genesisTransactions } from '../../core/tests/helpers' import { IndyVdrModuleConfig } from '../src/IndyVdrModuleConfig' export const indyVdrModuleConfig = new IndyVdrModuleConfig({ + indyVdr, networks: [ { genesisTransactions, diff --git a/packages/indy-vdr/tests/indy-vdr-anoncreds-registry.e2e.test.ts b/packages/indy-vdr/tests/indy-vdr-anoncreds-registry.e2e.test.ts index f3448d169a..1cba5741e0 100644 --- a/packages/indy-vdr/tests/indy-vdr-anoncreds-registry.e2e.test.ts +++ b/packages/indy-vdr/tests/indy-vdr-anoncreds-registry.e2e.test.ts @@ -1,4 +1,5 @@ import { Agent, DidsModule, Key, KeyType, TypedArrayEncoder } from '@aries-framework/core' +import { indyVdr } from '@hyperledger/indy-vdr-nodejs' import { RevocationRegistryDefinitionRequest, RevocationRegistryEntryRequest } from '@hyperledger/indy-vdr-shared' import { @@ -25,6 +26,7 @@ const agent = new Agent({ dependencies: agentDependencies, modules: { indyVdr: new IndyVdrModule({ + indyVdr, networks: indyVdrModuleConfig.networks, }), indySdk: new IndySdkModule({ diff --git a/packages/indy-vdr/tests/indy-vdr-did-registrar.e2e.test.ts b/packages/indy-vdr/tests/indy-vdr-did-registrar.e2e.test.ts index 65eee36cf3..b4b66f4449 100644 --- a/packages/indy-vdr/tests/indy-vdr-did-registrar.e2e.test.ts +++ b/packages/indy-vdr/tests/indy-vdr-did-registrar.e2e.test.ts @@ -11,6 +11,7 @@ import { Agent, DidsModule, } from '@aries-framework/core' +import { indyVdr } from '@hyperledger/indy-vdr-nodejs' import { convertPublicKeyToX25519, generateKeyPairFromSeed } from '@stablelib/ed25519' import { getAgentOptions, importExistingIndyDidFromPrivateKey } from '../../core/tests/helpers' @@ -30,6 +31,7 @@ const agent = new Agent( {}, { indyVdr: new IndyVdrModule({ + indyVdr, networks: indyVdrModuleConfig.networks, }), indySdk: new IndySdkModule({ diff --git a/packages/indy-vdr/tests/indy-vdr-indy-did-resolver.e2e.test.ts b/packages/indy-vdr/tests/indy-vdr-indy-did-resolver.e2e.test.ts index 209b05e698..92068e5690 100644 --- a/packages/indy-vdr/tests/indy-vdr-indy-did-resolver.e2e.test.ts +++ b/packages/indy-vdr/tests/indy-vdr-indy-did-resolver.e2e.test.ts @@ -1,4 +1,5 @@ import { DidsModule, Agent, TypedArrayEncoder, JsonTransformer } from '@aries-framework/core' +import { indyVdr } from '@hyperledger/indy-vdr-nodejs' import { getAgentOptions, importExistingIndyDidFromPrivateKey } from '../../core/tests/helpers' import { IndySdkModule } from '../../indy-sdk/src' @@ -14,6 +15,7 @@ const agent = new Agent( {}, { indyVdr: new IndyVdrModule({ + indyVdr, networks: indyVdrModuleConfig.networks, }), indySdk: new IndySdkModule({ diff --git a/packages/indy-vdr/tests/indy-vdr-sov-did-resolver.e2e.test.ts b/packages/indy-vdr/tests/indy-vdr-sov-did-resolver.e2e.test.ts index 2ff501c641..14b2a7e202 100644 --- a/packages/indy-vdr/tests/indy-vdr-sov-did-resolver.e2e.test.ts +++ b/packages/indy-vdr/tests/indy-vdr-sov-did-resolver.e2e.test.ts @@ -1,4 +1,5 @@ import { DidsModule, Agent, TypedArrayEncoder, JsonTransformer } from '@aries-framework/core' +import { indyVdr } from '@hyperledger/indy-vdr-nodejs' import { getAgentOptions, importExistingIndyDidFromPrivateKey } from '../../core/tests/helpers' import { IndySdkModule } from '../../indy-sdk/src' @@ -15,6 +16,7 @@ const agent = new Agent( {}, { indyVdr: new IndyVdrModule({ + indyVdr, networks: indyVdrModuleConfig.networks, }), indySdk: new IndySdkModule({ diff --git a/packages/indy-vdr/tests/setup.ts b/packages/indy-vdr/tests/setup.ts index e766b0e868..a5714a641c 100644 --- a/packages/indy-vdr/tests/setup.ts +++ b/packages/indy-vdr/tests/setup.ts @@ -1,6 +1,3 @@ -// Needed to register indy-vdr node bindings -import '../src/index' - -require('@hyperledger/indy-vdr-nodejs') +import '@hyperledger/indy-vdr-nodejs' jest.setTimeout(120000) diff --git a/yarn.lock b/yarn.lock index c2bba8a78d..dab29c0369 100644 --- a/yarn.lock +++ b/yarn.lock @@ -864,12 +864,12 @@ resolved "https://registry.yarnpkg.com/@hutson/parse-repository-url/-/parse-repository-url-3.0.2.tgz#98c23c950a3d9b6c8f0daed06da6c3af06981340" integrity sha512-H9XAx3hc0BQHY6l+IFSWHDySypcXsvsuLhgYLUGywmJ5pswRVQJUHpOsobnLYp2ZUaUlKiKDrgWWhosOwAEM8Q== -"@hyperledger/anoncreds-nodejs@^0.1.0-dev.10": - version "0.1.0-dev.10" - resolved "https://registry.yarnpkg.com/@hyperledger/anoncreds-nodejs/-/anoncreds-nodejs-0.1.0-dev.10.tgz#80c093ecb08a277fb494399b64aad1b900c3103f" - integrity sha512-ju5mJPwuyebAPziuf+eUOwxEws02G2FHEp/qG3GV3kxtlx7THW7HVB7dMSNqhRVKCsbcNnZtWJB1UiPvWqboUg== +"@hyperledger/anoncreds-nodejs@^0.1.0-dev.11": + version "0.1.0-dev.11" + resolved "https://registry.yarnpkg.com/@hyperledger/anoncreds-nodejs/-/anoncreds-nodejs-0.1.0-dev.11.tgz#301b9bc5a4bb0235212ac48da2bf41118b407cdd" + integrity sha512-4BSHOGOdXjF4pyJuEjwk0iaSHeqt5UdXRXNv+u9VJ7yYhqM/aJZNhtUAgHXu8KGZwimFcFsp2e0FoLqwO0vLHQ== dependencies: - "@hyperledger/anoncreds-shared" "0.1.0-dev.10" + "@hyperledger/anoncreds-shared" "0.1.0-dev.11" "@mapbox/node-pre-gyp" "^1.0.10" ffi-napi "4.0.3" node-cache "5.1.2" @@ -877,17 +877,17 @@ ref-napi "3.0.3" ref-struct-di "1.1.1" -"@hyperledger/anoncreds-shared@0.1.0-dev.10", "@hyperledger/anoncreds-shared@^0.1.0-dev.10": - version "0.1.0-dev.10" - resolved "https://registry.yarnpkg.com/@hyperledger/anoncreds-shared/-/anoncreds-shared-0.1.0-dev.10.tgz#9d67f64e98ff41971644c95b03dabafd741df4df" - integrity sha512-POvcwQrUcPrwoZehQa38pN1dnjyeUlrQ6VlksbBRS8SUHJuyixZsD+d3XoumqaNfl9Z1DCjfuOgEiPlec01gXQ== +"@hyperledger/anoncreds-shared@0.1.0-dev.11", "@hyperledger/anoncreds-shared@^0.1.0-dev.11": + version "0.1.0-dev.11" + resolved "https://registry.yarnpkg.com/@hyperledger/anoncreds-shared/-/anoncreds-shared-0.1.0-dev.11.tgz#206328cabcd855ef20c863ab5c2615a3a4c2502c" + integrity sha512-nK05y/qNtI3P+hnkVZW/d5oduMa7slZfEh2gQ+ZmAEmwHEcSU8iJ+QTkKS3nRE+6igXUvVAztlGS7JZHf21KKw== -"@hyperledger/aries-askar-nodejs@^0.1.0-dev.5": - version "0.1.0-dev.5" - resolved "https://registry.yarnpkg.com/@hyperledger/aries-askar-nodejs/-/aries-askar-nodejs-0.1.0-dev.5.tgz#602db32f49dd1f9e7f83d378a9813d2bde5886f8" - integrity sha512-38lXtmnhhca+s14V3zTefAyZGIg6nRpKi4Emnr1q5hQXmn1WZn7/ybYJbcI/VHoAPNLA+DydSI99U5KuPkrC1w== +"@hyperledger/aries-askar-nodejs@^0.1.0-dev.6": + version "0.1.0-dev.6" + resolved "https://registry.yarnpkg.com/@hyperledger/aries-askar-nodejs/-/aries-askar-nodejs-0.1.0-dev.6.tgz#1067196269e3dc7904afa946234e069c31dfc2d9" + integrity sha512-VHORF/VbXXNA0zevS8diocVFfHpqp8XS33VuIEDFEG9n87Sc4sO0KxxCr5KdGeAf46yhiCdJd2bOKRjDHCObyQ== dependencies: - "@hyperledger/aries-askar-shared" "0.1.0-dev.5" + "@hyperledger/aries-askar-shared" "0.1.0-dev.6" "@mapbox/node-pre-gyp" "^1.0.10" ffi-napi "^4.0.3" node-cache "^5.1.2" @@ -895,29 +895,30 @@ ref-napi "^3.0.3" ref-struct-di "^1.1.1" -"@hyperledger/aries-askar-shared@0.1.0-dev.5", "@hyperledger/aries-askar-shared@^0.1.0-dev.5": - version "0.1.0-dev.5" - resolved "https://registry.yarnpkg.com/@hyperledger/aries-askar-shared/-/aries-askar-shared-0.1.0-dev.5.tgz#06ae815b873693b7b483004d027059d50f24fb60" - integrity sha512-nufXqMslytelijC0uXBTuaj9OHjHo5mJe0hABKfYJqe9p1RYmmKlnqi+B/mjWrr2R8yG8NLrNnHbwPcBArLrPA== +"@hyperledger/aries-askar-shared@0.1.0-dev.6", "@hyperledger/aries-askar-shared@^0.1.0-dev.6": + version "0.1.0-dev.6" + resolved "https://registry.yarnpkg.com/@hyperledger/aries-askar-shared/-/aries-askar-shared-0.1.0-dev.6.tgz#af3bf4318312ee1af0ead8c0bea6a4445a265525" + integrity sha512-P62u1GNw2hvFh3T8hYTBiD2YsIzHIQOwa8+p8wEhB0AJi7Ixc3OcAtxxgbreosDtGrW+cxkinuSqufveuK9V1g== dependencies: fast-text-encoding "^1.0.3" -"@hyperledger/indy-vdr-nodejs@^0.1.0-dev.10": - version "0.1.0-dev.10" - resolved "https://registry.yarnpkg.com/@hyperledger/indy-vdr-nodejs/-/indy-vdr-nodejs-0.1.0-dev.10.tgz#f5fc988b3c11766475f7f084f814af8a4eca0caf" - integrity sha512-wETVax9HRidhRTRiRqwLTj/looNCvjZ3vdqMoqmPbmet5sM9eRkU9v4ipz4paqz4LiZipTx2fisLyYskKW9g6A== +"@hyperledger/indy-vdr-nodejs@0.1.0-dev.12": + version "0.1.0-dev.12" + resolved "https://registry.yarnpkg.com/@hyperledger/indy-vdr-nodejs/-/indy-vdr-nodejs-0.1.0-dev.12.tgz#c8966bf5f446fff4c7bf0bf5afb4159159d2dd9e" + integrity sha512-rJDkk4u0zyn3n/PBw0pf3qSgbZ0n5VAJY5ykeMU2/bBfFXQ1KJex/148M4YsGEOxY0XUSoXgcT/oJYS3MSA6Nw== dependencies: - "@hyperledger/indy-vdr-shared" "0.1.0-dev.10" + "@hyperledger/indy-vdr-shared" "0.1.0-dev.12" "@mapbox/node-pre-gyp" "^1.0.10" + "@types/ref-array-di" "^1.2.5" ffi-napi "^4.0.3" ref-array-di "^1.2.2" ref-napi "^3.0.3" ref-struct-di "^1.1.1" -"@hyperledger/indy-vdr-shared@0.1.0-dev.10", "@hyperledger/indy-vdr-shared@^0.1.0-dev.10": - version "0.1.0-dev.10" - resolved "https://registry.yarnpkg.com/@hyperledger/indy-vdr-shared/-/indy-vdr-shared-0.1.0-dev.10.tgz#2a6d09a3a6ae3458ae9209ab7b6f09435e88b9c9" - integrity sha512-7fr9/Iliu0u94qE8u1g/RoLJOwMH0kFdclttwBHfTAKTQyfoXUPe1yIZ8ITRgLwnmFYPQpRa54lU+uv15c37fg== +"@hyperledger/indy-vdr-shared@0.1.0-dev.12": + version "0.1.0-dev.12" + resolved "https://registry.yarnpkg.com/@hyperledger/indy-vdr-shared/-/indy-vdr-shared-0.1.0-dev.12.tgz#a5051cb91b7698f80265b7506789fb50490477e2" + integrity sha512-CPVGTHVLFAVVU6uIhcbhAUWqDrn3u2R3D+ALdqgKwJY1Ca8kFiUvhFN1/DkHtZuEo549wPQmFqH2hCkXaiuF7Q== "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" @@ -2684,6 +2685,13 @@ "@types/scheduler" "*" csstype "^3.0.2" +"@types/ref-array-di@^1.2.5": + version "1.2.5" + resolved "https://registry.yarnpkg.com/@types/ref-array-di/-/ref-array-di-1.2.5.tgz#822b9be5b934398fafd5c26264d8de80d487747d" + integrity sha512-dA/Himb7ca/Tf5vqLOhi7LewAAoOXghlocw7gAqvNrmLybAtu+w2BLzEsbFWAtx5ElNzMEHDaRybueYViFROjQ== + dependencies: + "@types/ref-napi" "*" + "@types/ref-napi@*", "@types/ref-napi@^3.0.4": version "3.0.7" resolved "https://registry.yarnpkg.com/@types/ref-napi/-/ref-napi-3.0.7.tgz#20adc93a7a2f9f992dfb17409fd748e6f4bf403d"