diff --git a/Dockerfile b/Dockerfile index c89fc3504d..83236c6e63 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,66 +1,4 @@ -## Stage 1: Build indy-sdk and postgres plugin - -FROM ubuntu:22.04 as base - -# Set this value only during build -ARG DEBIAN_FRONTEND noninteractive - -# Define packages to install -ENV PACKAGES software-properties-common ca-certificates \ - curl build-essential git \ - libzmq3-dev libsodium-dev pkg-config gnupg - -# Combined update and install to ensure Docker caching works correctly -RUN apt-get update -y \ - && apt-get install -y $PACKAGES - -RUN curl http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.23_amd64.deb -o libssl1.1.deb \ - # libssl1.1 (required by libindy) - && dpkg -i libssl1.1.deb \ - && curl http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1~18.04.23_amd64.deb -o libssl-dev1.1.deb \ - # libssl-dev1.1 (required to compile libindy with posgres plugin) - && dpkg -i libssl-dev1.1.deb - -# Add APT sources -RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88 \ - && add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable" \ - && mkdir -p /etc/apt/keyrings \ - && curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg \ - && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list \ - && curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \ - && echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list - -# Install libindy, NodeJS and yarn -RUN apt-get update -y \ - # Install libindy - && apt-get install -y --allow-unauthenticated libindy \ - && apt-get install -y nodejs \ - && apt-get install -y --no-install-recommends yarn \ - && rm -rf /var/lib/apt/lists/* \ - && apt-get clean -y - -# postgres plugin setup -# install rust and set up rustup -RUN curl https://sh.rustup.rs -sSf | bash -s -- -y -ENV PATH="/root/.cargo/bin:${PATH}" - -# cargo build failing on latest release of rust due to socket2 dependency in the plugin https://users.rust-lang.org/t/build-broken-with-parse-quote-spanned-is-ambiguous/80280/2 so pointing rust version to 1.63.0 -RUN rustup default 1.63.0 - -# clone indy-sdk and build postgres plugin -RUN git clone https://github.com/hyperledger/indy-sdk.git -WORKDIR /indy-sdk/experimental/plugins/postgres_storage/ -RUN cargo build --release - -# set up library path for postgres plugin -ENV LIB_INDY_STRG_POSTGRES="/indy-sdk/experimental/plugins/postgres_storage/target/release" - -## Stage 2: Build Aries Framework JavaScript - -FROM base as final - -# Set environment variables -ENV RUN_MODE="docker" +FROM node:18 # Set working directory WORKDIR /www @@ -71,3 +9,5 @@ COPY . . # Run yarn install and build RUN yarn install --frozen-lockfile \ && yarn build + +entrypoint ["yarn", "run-mediator"] \ No newline at end of file diff --git a/demo/package.json b/demo/package.json index 850681edfe..61cca53f31 100644 --- a/demo/package.json +++ b/demo/package.json @@ -14,8 +14,8 @@ "refresh": "rm -rf ./node_modules ./yarn.lock && yarn" }, "dependencies": { - "@hyperledger/indy-vdr-nodejs": "^0.2.0-dev.3", - "@hyperledger/anoncreds-nodejs": "^0.2.0-dev.4", + "@hyperledger/indy-vdr-nodejs": "^0.2.0-dev.5", + "@hyperledger/anoncreds-nodejs": "^0.2.0-dev.5", "@hyperledger/aries-askar-nodejs": "^0.2.0-dev.1", "inquirer": "^8.2.5" }, diff --git a/demo/src/Alice.ts b/demo/src/Alice.ts index 2de378d8c1..9052654925 100644 --- a/demo/src/Alice.ts +++ b/demo/src/Alice.ts @@ -8,7 +8,7 @@ export class Alice extends BaseAgent { public connectionRecordFaberId?: string public constructor(port: number, name: string) { - super({ port, name, useLegacyIndySdk: true }) + super({ port, name }) this.connected = false } diff --git a/demo/src/BaseAgent.ts b/demo/src/BaseAgent.ts index 8c174a7fe6..67f5e274cd 100644 --- a/demo/src/BaseAgent.ts +++ b/demo/src/BaseAgent.ts @@ -58,17 +58,8 @@ export class BaseAgent { public name: string public config: InitConfig public agent: DemoAgent - public useLegacyIndySdk: boolean - public constructor({ - port, - name, - useLegacyIndySdk = false, - }: { - port: number - name: string - useLegacyIndySdk?: boolean - }) { + public constructor({ port, name }: { port: number; name: string }) { this.name = name this.port = port @@ -83,8 +74,6 @@ export class BaseAgent { this.config = config - this.useLegacyIndySdk = useLegacyIndySdk - this.agent = new Agent({ config, dependencies: agentDependencies, diff --git a/demo/src/Faber.ts b/demo/src/Faber.ts index 91befb8918..c8c454ec96 100644 --- a/demo/src/Faber.ts +++ b/demo/src/Faber.ts @@ -24,7 +24,7 @@ export class Faber extends BaseAgent { public ui: BottomBar public constructor(port: number, name: string) { - super({ port, name, useLegacyIndySdk: true }) + super({ port, name }) this.ui = new ui.BottomBar() } diff --git a/package.json b/package.json index 1749e62ae8..d63e3752b9 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,6 @@ "node": ">=18" }, "dependencies": { - "@hyperledger/aries-askar-nodejs": "^0.1.0" + "@hyperledger/aries-askar-nodejs": "^0.2.0-dev.1" } } diff --git a/packages/action-menu/tests/action-menu.e2e.test.ts b/packages/action-menu/tests/action-menu.e2e.test.ts index a32b13df49..6737aaed69 100644 --- a/packages/action-menu/tests/action-menu.e2e.test.ts +++ b/packages/action-menu/tests/action-menu.e2e.test.ts @@ -2,8 +2,8 @@ import type { ConnectionRecord } from '@aries-framework/core' import { Agent } from '@aries-framework/core' -import { getAgentOptions, makeConnection, testLogger, setupSubjectTransports, indySdk } from '../../core/tests' -import { IndySdkModule } from '../../indy-sdk/src' +import { askarModule } from '../../askar/tests/helpers' +import { getAgentOptions, makeConnection, testLogger, setupSubjectTransports } from '../../core/tests' import { waitForActionMenuRecord } from './helpers' @@ -17,9 +17,7 @@ import { const modules = { actionMenu: new ActionMenuModule(), - indySdk: new IndySdkModule({ - indySdk, - }), + askar: askarModule, } const faberAgentOptions = getAgentOptions( diff --git a/packages/anoncreds-rs/package.json b/packages/anoncreds-rs/package.json index aaafaf228d..494d899a09 100644 --- a/packages/anoncreds-rs/package.json +++ b/packages/anoncreds-rs/package.json @@ -32,8 +32,8 @@ "tsyringe": "^4.8.0" }, "devDependencies": { - "@hyperledger/anoncreds-nodejs": "^0.2.0-dev.4", - "@hyperledger/anoncreds-shared": "^0.2.0-dev.4", + "@hyperledger/anoncreds-nodejs": "^0.2.0-dev.5", + "@hyperledger/anoncreds-shared": "^0.2.0-dev.5", "@types/ref-array-di": "^1.2.6", "@types/ref-struct-di": "^1.1.10", "reflect-metadata": "^0.1.13", @@ -41,6 +41,6 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@hyperledger/anoncreds-shared": "^0.2.0-dev.4" + "@hyperledger/anoncreds-shared": "^0.2.0-dev.5" } } diff --git a/packages/anoncreds-rs/src/index.ts b/packages/anoncreds-rs/src/index.ts index 5fdd9486c7..952884c8c5 100644 --- a/packages/anoncreds-rs/src/index.ts +++ b/packages/anoncreds-rs/src/index.ts @@ -3,3 +3,4 @@ export * from './services' // Module export { AnonCredsRsModule } from './AnonCredsRsModule' +export { AnonCredsRsModuleConfig } from './AnonCredsRsModuleConfig' diff --git a/packages/anoncreds/src/formats/__tests__/legacy-indy-format-services.test.ts b/packages/anoncreds/src/formats/__tests__/legacy-indy-format-services.test.ts index a05a6d4199..7aa3dcf564 100644 --- a/packages/anoncreds/src/formats/__tests__/legacy-indy-format-services.test.ts +++ b/packages/anoncreds/src/formats/__tests__/legacy-indy-format-services.test.ts @@ -10,20 +10,20 @@ import { ProofState, EventEmitter, } from '@aries-framework/core' -import * as indySdk from 'indy-sdk' import { Subject } from 'rxjs' -import { agentDependencies, getAgentConfig, getAgentContext } from '../../../../core/tests/helpers' import { - IndySdkHolderService, - IndySdkIssuerService, - IndySdkModuleConfig, - IndySdkStorageService, - IndySdkVerifierService, - IndySdkWallet, -} from '../../../../indy-sdk/src' -import { IndySdkRevocationService } from '../../../../indy-sdk/src/anoncreds/services/IndySdkRevocationService' -import { legacyIndyDidFromPublicKeyBase58 } from '../../../../indy-sdk/src/utils/did' + AnonCredsRsHolderService, + AnonCredsRsIssuerService, + AnonCredsRsModuleConfig, + AnonCredsRsVerifierService, +} from '../../../../anoncreds-rs/src' +import { anoncreds } from '../../../../anoncreds-rs/tests/helpers' +import { AskarStorageService } from '../../../../askar/src' +import { AskarModuleConfig } from '../../../../askar/src/AskarModuleConfig' +import { askarModuleConfig, RegisteredAskarTestWallet } from '../../../../askar/tests/helpers' +import { indyDidFromPublicKeyBase58 } from '../../../../core/src/utils/did' +import { agentDependencies, getAgentConfig, getAgentContext } from '../../../../core/tests/helpers' import { InMemoryAnonCredsRegistry } from '../../../tests/InMemoryAnonCredsRegistry' import { AnonCredsModuleConfig } from '../../AnonCredsModuleConfig' import { AnonCredsLinkSecretRecord, AnonCredsLinkSecretRepository } from '../../repository' @@ -48,12 +48,15 @@ const anonCredsModuleConfig = new AnonCredsModuleConfig({ }) const agentConfig = getAgentConfig('LegacyIndyFormatServicesTest') -const anonCredsRevocationService = new IndySdkRevocationService(indySdk) -const anonCredsVerifierService = new IndySdkVerifierService(indySdk) -const anonCredsHolderService = new IndySdkHolderService(anonCredsRevocationService, indySdk) -const anonCredsIssuerService = new IndySdkIssuerService(indySdk) -const wallet = new IndySdkWallet(indySdk, agentConfig.logger, new SigningProviderRegistry([])) -const storageService = new IndySdkStorageService(indySdk) +const anonCredsVerifierService = new AnonCredsRsVerifierService() +const anonCredsHolderService = new AnonCredsRsHolderService() +const anonCredsIssuerService = new AnonCredsRsIssuerService() +const wallet = new RegisteredAskarTestWallet( + agentConfig.logger, + new agentDependencies.FileSystem(), + new SigningProviderRegistry([]) +) +const storageService = new AskarStorageService() const eventEmitter = new EventEmitter(agentDependencies, new Subject()) const anonCredsLinkSecretRepository = new AnonCredsLinkSecretRepository(storageService, eventEmitter) const agentContext = getAgentContext({ @@ -64,7 +67,14 @@ const agentContext = getAgentContext({ [AnonCredsRegistryService, new AnonCredsRegistryService()], [AnonCredsModuleConfig, anonCredsModuleConfig], [AnonCredsLinkSecretRepository, anonCredsLinkSecretRepository], - [IndySdkModuleConfig, new IndySdkModuleConfig({ indySdk, autoCreateLinkSecret: false })], + [AskarModuleConfig, askarModuleConfig], + [ + AnonCredsRsModuleConfig, + new AnonCredsRsModuleConfig({ + anoncreds, + autoCreateLinkSecret: false, + }), + ], ], agentConfig, wallet, @@ -87,7 +97,7 @@ describe('Legacy indy format services', () => { test('issuance and verification flow starting from proposal without negotiation and without revocation', async () => { // This is just so we don't have to register an actual indy did (as we don't have the indy did registrar configured) const key = await wallet.createKey({ keyType: KeyType.Ed25519 }) - const unqualifiedIndyDid = legacyIndyDidFromPublicKeyBase58(key.publicKeyBase58) + const unqualifiedIndyDid = indyDidFromPublicKeyBase58(key.publicKeyBase58) const indyDid = `did:indy:pool1:${unqualifiedIndyDid}` // Create link secret @@ -107,27 +117,18 @@ describe('Legacy indy format services', () => { version: '1.0.0', }) - const { schemaState, schemaMetadata } = await registry.registerSchema(agentContext, { + const { schemaState } = await registry.registerSchema(agentContext, { schema, options: {}, }) - const { credentialDefinition } = await anonCredsIssuerService.createCredentialDefinition( - agentContext, - { - issuerId: indyDid, - schemaId: schemaState.schemaId as string, - schema, - tag: 'Employee Credential', - supportRevocation: false, - }, - { - // NOTE: indy-sdk support has been removed from main repo, but keeping - // this in place to allow the indy-sdk to still be used as a custom package - // Need to pass this as the indy-sdk MUST have the seqNo - indyLedgerSchemaSeqNo: schemaMetadata.indyLedgerSeqNo as number, - } - ) + const { credentialDefinition } = await anonCredsIssuerService.createCredentialDefinition(agentContext, { + issuerId: indyDid, + schemaId: schemaState.schemaId as string, + schema, + tag: 'Employee Credential', + supportRevocation: false, + }) const { credentialDefinitionState } = await registry.registerCredentialDefinition(agentContext, { credentialDefinition, diff --git a/packages/anoncreds/src/protocols/proofs/v1/__tests__/v1-connectionless-proofs.e2e.test.ts b/packages/anoncreds/src/protocols/proofs/v1/__tests__/v1-connectionless-proofs.e2e.test.ts index 57127b9269..b06b6af89b 100644 --- a/packages/anoncreds/src/protocols/proofs/v1/__tests__/v1-connectionless-proofs.e2e.test.ts +++ b/packages/anoncreds/src/protocols/proofs/v1/__tests__/v1-connectionless-proofs.e2e.test.ts @@ -5,6 +5,7 @@ import { Subject } from 'rxjs' import { SubjectInboundTransport } from '../../../../../../../tests/transport/SubjectInboundTransport' import { SubjectOutboundTransport } from '../../../../../../../tests/transport/SubjectOutboundTransport' +import { askarModule } from '../../../../../../askar/tests/helpers' import { CredentialEventTypes, Agent, @@ -27,9 +28,8 @@ import { makeConnection, setupEventReplaySubjects, } from '../../../../../../core/tests' -import { getIndySdkModules } from '../../../../../../indy-sdk/tests/setupIndySdkModule' import { - getLegacyAnonCredsModules, + getAskarAnonCredsIndyModules, issueLegacyAnonCredsCredential, prepareForAnonCredsIssuance, setupAnonCredsTests, @@ -365,7 +365,7 @@ describe('V1 Proofs - Connectionless - Indy', () => { endpoints: ['rxjs:mediator'], }, { - ...getIndySdkModules(), + askar: askarModule, mediator: new MediatorModule({ autoAcceptMediationRequests: true, }), @@ -395,7 +395,7 @@ describe('V1 Proofs - Connectionless - Indy', () => { `Connectionless proofs with mediator Faber-${unique}`, {}, { - ...getLegacyAnonCredsModules({ + ...getAskarAnonCredsIndyModules({ autoAcceptProofs: AutoAcceptProof.Always, }), mediationRecipient: new MediationRecipientModule({ @@ -411,7 +411,7 @@ describe('V1 Proofs - Connectionless - Indy', () => { `Connectionless proofs with mediator Alice-${unique}`, {}, { - ...getLegacyAnonCredsModules({ + ...getAskarAnonCredsIndyModules({ autoAcceptProofs: AutoAcceptProof.Always, }), mediationRecipient: new MediationRecipientModule({ diff --git a/packages/anoncreds/src/updates/__tests__/0.3.test.ts b/packages/anoncreds/src/updates/__tests__/0.3.test.ts index 7ad829c3f9..a2542f7694 100644 --- a/packages/anoncreds/src/updates/__tests__/0.3.test.ts +++ b/packages/anoncreds/src/updates/__tests__/0.3.test.ts @@ -3,9 +3,8 @@ import { readFileSync } from 'fs' import path from 'path' import { InMemoryStorageService } from '../../../../../tests/InMemoryStorageService' -import { indySdk, agentDependencies } from '../../../../core/tests' -import { IndySdkWallet } from '../../../../indy-sdk/src' -import { IndySdkSymbol } from '../../../../indy-sdk/src/types' +import { RegisteredAskarTestWallet } from '../../../../askar/tests/helpers' +import { agentDependencies } from '../../../../core/tests' import { InMemoryAnonCredsRegistry } from '../../../tests/InMemoryAnonCredsRegistry' import { AnonCredsModule } from '../../AnonCredsModule' import { @@ -32,9 +31,8 @@ describe('UpdateAssistant | AnonCreds | v0.3.1 - v0.4', () => { const dependencyManager = new DependencyManager() const storageService = new InMemoryStorageService() dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) dependencyManager.registerInstance(AnonCredsIssuerServiceSymbol, {}) dependencyManager.registerInstance(AnonCredsHolderServiceSymbol, {}) dependencyManager.registerInstance(AnonCredsVerifierServiceSymbol, {}) @@ -108,9 +106,8 @@ describe('UpdateAssistant | AnonCreds | v0.3.1 - v0.4', () => { const dependencyManager = new DependencyManager() const storageService = new InMemoryStorageService() dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) dependencyManager.registerInstance(AnonCredsIssuerServiceSymbol, {}) dependencyManager.registerInstance(AnonCredsHolderServiceSymbol, {}) dependencyManager.registerInstance(AnonCredsVerifierServiceSymbol, {}) diff --git a/packages/anoncreds/tests/InMemoryAnonCredsRegistry.ts b/packages/anoncreds/tests/InMemoryAnonCredsRegistry.ts index 9cb3a9adf3..00919127bf 100644 --- a/packages/anoncreds/tests/InMemoryAnonCredsRegistry.ts +++ b/packages/anoncreds/tests/InMemoryAnonCredsRegistry.ts @@ -19,7 +19,7 @@ import type { AgentContext } from '@aries-framework/core' import { Hasher, TypedArrayEncoder } from '@aries-framework/core' import BigNumber from 'bn.js' -import { getDidIndyCredentialDefinitionId, getDidIndySchemaId } from '../../indy-sdk/src/anoncreds/utils/identifiers' +import { getDidIndyCredentialDefinitionId, getDidIndySchemaId } from '../../indy-vdr/src/anoncreds/utils/identifiers' import { getUnqualifiedCredentialDefinitionId, getUnqualifiedSchemaId, parseIndyDid, parseIndySchemaId } from '../src' /** @@ -28,9 +28,6 @@ import { getUnqualifiedCredentialDefinitionId, getUnqualifiedSchemaId, parseIndy export class InMemoryAnonCredsRegistry implements AnonCredsRegistry { public readonly methodName = 'inMemory' - // Roughly match that the identifier starts with an unqualified indy did. Once the - // anoncreds tests are not based on the indy-sdk anymore, we can use any identifier - // we want, but the indy-sdk is picky about the identifier format. public readonly supportedIdentifier = /.+/ private schemas: Record diff --git a/packages/anoncreds/tests/anoncreds.test.ts b/packages/anoncreds/tests/anoncreds.test.ts index d56dc4b630..5778a8d737 100644 --- a/packages/anoncreds/tests/anoncreds.test.ts +++ b/packages/anoncreds/tests/anoncreds.test.ts @@ -1,8 +1,9 @@ import { Agent, KeyDerivationMethod, KeyType, TypedArrayEncoder } from '@aries-framework/core' import { agentDependencies } from '@aries-framework/node' -import * as indySdk from 'indy-sdk' -import { IndySdkModule } from '../../indy-sdk/src/IndySdkModule' +import { AnonCredsRsModule } from '../../anoncreds-rs/src' +import { anoncreds } from '../../anoncreds-rs/tests/helpers' +import { askarModule } from '../../askar/tests/helpers' import { AnonCredsModule } from '../src' import { InMemoryAnonCredsRegistry } from './InMemoryAnonCredsRegistry' @@ -81,10 +82,8 @@ const agent = new Agent({ }, }, modules: { - indySdk: new IndySdkModule({ - indySdk, - autoCreateLinkSecret: false, - }), + anoncredsRs: new AnonCredsRsModule({ anoncreds, autoCreateLinkSecret: false }), + askar: askarModule, anoncreds: new AnonCredsModule({ registries: [ new InMemoryAnonCredsRegistry({ diff --git a/packages/anoncreds/tests/legacyAnonCredsSetup.ts b/packages/anoncreds/tests/legacyAnonCredsSetup.ts index 39e9b53c47..366089c3cd 100644 --- a/packages/anoncreds/tests/legacyAnonCredsSetup.ts +++ b/packages/anoncreds/tests/legacyAnonCredsSetup.ts @@ -44,14 +44,6 @@ import { waitForProofExchangeRecordSubject, } from '../../core/tests/helpers' import testLogger from '../../core/tests/logger' -import { - IndySdkAnonCredsRegistry, - IndySdkIndyDidRegistrar, - IndySdkIndyDidResolver, - IndySdkModule, - IndySdkSovDidResolver, -} from '../../indy-sdk/src' -import { getIndySdkModuleConfig } from '../../indy-sdk/tests/setupIndySdkModule' import { IndyVdrAnonCredsRegistry, IndyVdrSovDidResolver, @@ -73,52 +65,9 @@ import { } from '../src' // Helper type to get the type of the agents (with the custom modules) for the credential tests -export type AnonCredsTestsAgent = - | Agent & { mediationRecipient?: any; mediator?: any }> - | Agent & { mediationRecipient?: any; mediator?: any }> - -export const getLegacyAnonCredsModules = ({ - autoAcceptCredentials, - autoAcceptProofs, -}: { autoAcceptCredentials?: AutoAcceptCredential; autoAcceptProofs?: AutoAcceptProof } = {}) => { - const indyCredentialFormat = new LegacyIndyCredentialFormatService() - const indyProofFormat = new LegacyIndyProofFormatService() - - // Register the credential and proof protocols - const modules = { - credentials: new CredentialsModule({ - autoAcceptCredentials, - credentialProtocols: [ - new V1CredentialProtocol({ indyCredentialFormat }), - new V2CredentialProtocol({ - credentialFormats: [indyCredentialFormat], - }), - ], - }), - proofs: new ProofsModule({ - autoAcceptProofs, - proofProtocols: [ - new V1ProofProtocol({ indyProofFormat }), - new V2ProofProtocol({ - proofFormats: [indyProofFormat], - }), - ], - }), - anoncreds: new AnonCredsModule({ - registries: [new IndySdkAnonCredsRegistry()], - }), - dids: new DidsModule({ - resolvers: [new IndySdkSovDidResolver(), new IndySdkIndyDidResolver()], - registrars: [new IndySdkIndyDidRegistrar()], - }), - indySdk: new IndySdkModule(getIndySdkModuleConfig()), - cache: new CacheModule({ - cache: new InMemoryLruCache({ limit: 100 }), - }), - } as const - - return modules -} +export type AnonCredsTestsAgent = Agent< + ReturnType & { mediationRecipient?: any; mediator?: any } +> export const getAskarAnonCredsIndyModules = ({ autoAcceptCredentials, @@ -357,7 +306,7 @@ export async function setupAnonCredsTests< { endpoints: ['rxjs:issuer'], }, - getLegacyAnonCredsModules({ + getAskarAnonCredsIndyModules({ autoAcceptCredentials, autoAcceptProofs, }) @@ -370,7 +319,7 @@ export async function setupAnonCredsTests< { endpoints: ['rxjs:holder'], }, - getLegacyAnonCredsModules({ + getAskarAnonCredsIndyModules({ autoAcceptCredentials, autoAcceptProofs, }) @@ -384,7 +333,7 @@ export async function setupAnonCredsTests< { endpoints: ['rxjs:verifier'], }, - getLegacyAnonCredsModules({ + getAskarAnonCredsIndyModules({ autoAcceptCredentials, autoAcceptProofs, }) diff --git a/packages/bbs-signatures/tests/bbs-signatures.e2e.test.ts b/packages/bbs-signatures/tests/bbs-signatures.e2e.test.ts index 6aa8db303f..555737505b 100644 --- a/packages/bbs-signatures/tests/bbs-signatures.e2e.test.ts +++ b/packages/bbs-signatures/tests/bbs-signatures.e2e.test.ts @@ -20,14 +20,13 @@ import { W3cJsonLdVerifiableCredential, } from '@aries-framework/core' +import { RegisteredAskarTestWallet } from '../../askar/tests/helpers' import { W3cCredentialsModuleConfig } from '../../core/src/modules/vc/W3cCredentialsModuleConfig' import { SignatureSuiteRegistry } from '../../core/src/modules/vc/data-integrity/SignatureSuiteRegistry' import { W3cJsonLdCredentialService } from '../../core/src/modules/vc/data-integrity/W3cJsonLdCredentialService' import { customDocumentLoader } from '../../core/src/modules/vc/data-integrity/__tests__/documentLoader' import { LinkedDataProof } from '../../core/src/modules/vc/data-integrity/models/LinkedDataProof' -import { getAgentConfig, getAgentContext } from '../../core/tests/helpers' -import { IndySdkWallet } from '../../indy-sdk/src' -import { indySdk } from '../../indy-sdk/tests/setupIndySdkModule' +import { agentDependencies, getAgentConfig, getAgentContext } from '../../core/tests/helpers' import { BbsBlsSignature2020, BbsBlsSignatureProof2020, Bls12381g2SigningProvider } from '../src' import { BbsBlsSignature2020Fixtures } from './fixtures' @@ -70,7 +69,11 @@ describeSkipNode17And18('BBS W3cCredentialService', () => { const privateKey = TypedArrayEncoder.fromString('testseed000000000000000000000001') beforeAll(async () => { - wallet = new IndySdkWallet(indySdk, agentConfig.logger, signingProviderRegistry) + wallet = new RegisteredAskarTestWallet( + agentConfig.logger, + new agentDependencies.FileSystem(), + signingProviderRegistry + ) await wallet.createAndOpen(agentConfig.walletConfig) agentContext = getAgentContext({ agentConfig, diff --git a/packages/bbs-signatures/tests/bbs-signing-provider.e2e.test.ts b/packages/bbs-signatures/tests/bbs-signing-provider.e2e.test.ts index 67e2112e96..2350dd32b2 100644 --- a/packages/bbs-signatures/tests/bbs-signing-provider.e2e.test.ts +++ b/packages/bbs-signatures/tests/bbs-signing-provider.e2e.test.ts @@ -7,11 +7,11 @@ import { TypedArrayEncoder, SigningProviderRegistry, } from '@aries-framework/core' +import { agentDependencies } from '@aries-framework/core/tests' import { BBS_SIGNATURE_LENGTH } from '@mattrglobal/bbs-signatures' +import { RegisteredAskarTestWallet } from '../../askar/tests/helpers' import testLogger from '../../core/tests/logger' -import { IndySdkWallet } from '../../indy-sdk/src' -import { indySdk } from '../../indy-sdk/tests/setupIndySdkModule' import { Bls12381g2SigningProvider } from '../src' import { describeSkipNode17And18 } from './util' @@ -30,7 +30,11 @@ describeSkipNode17And18('BBS Signing Provider', () => { const message = TypedArrayEncoder.fromString('sample-message') beforeEach(async () => { - wallet = new IndySdkWallet(indySdk, testLogger, new SigningProviderRegistry([new Bls12381g2SigningProvider()])) + wallet = new RegisteredAskarTestWallet( + testLogger, + new agentDependencies.FileSystem(), + new SigningProviderRegistry([new Bls12381g2SigningProvider()]) + ) await wallet.createAndOpen(walletConfig) }) diff --git a/packages/core/src/agent/Agent.ts b/packages/core/src/agent/Agent.ts index 952e610c82..9c25006433 100644 --- a/packages/core/src/agent/Agent.ts +++ b/packages/core/src/agent/Agent.ts @@ -79,7 +79,7 @@ export class Agent extends BaseAge // Register possibly already defined services if (!dependencyManager.isRegistered(InjectionSymbols.Wallet)) { throw new AriesFrameworkError( - "Missing required dependency: 'Wallet'. You can register it using one of the provided modules such as the AskarModule or the IndySdkModule, or implement your own." + "Missing required dependency: 'Wallet'. You can register it using the AskarModule, or implement your own." ) } if (!dependencyManager.isRegistered(InjectionSymbols.Logger)) { @@ -87,7 +87,7 @@ export class Agent extends BaseAge } if (!dependencyManager.isRegistered(InjectionSymbols.StorageService)) { throw new AriesFrameworkError( - "Missing required dependency: 'StorageService'. You can register it using one of the provided modules such as the AskarModule or the IndySdkModule, or implement your own." + "Missing required dependency: 'StorageService'. You can register it using the AskarModule, or implement your own." ) } if (!dependencyManager.isRegistered(InjectionSymbols.MessageRepository)) { diff --git a/packages/core/src/agent/__tests__/Agent.test.ts b/packages/core/src/agent/__tests__/Agent.test.ts index d11331d6ff..82c7f656f4 100644 --- a/packages/core/src/agent/__tests__/Agent.test.ts +++ b/packages/core/src/agent/__tests__/Agent.test.ts @@ -2,7 +2,7 @@ import type { DependencyManager, Module } from '../../plugins' import { injectable } from 'tsyringe' -import { getIndySdkModules } from '../../../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../../../askar/tests/helpers' import { getAgentOptions } from '../../../tests/helpers' import { InjectionSymbols } from '../../constants' import { BasicMessageRepository, BasicMessageService } from '../../modules/basic-messages' @@ -33,7 +33,7 @@ import { FeatureRegistry } from '../FeatureRegistry' import { MessageReceiver } from '../MessageReceiver' import { MessageSender } from '../MessageSender' -const agentOptions = getAgentOptions('Agent Class Test', {}, getIndySdkModules()) +const agentOptions = getAgentOptions('Agent Class Test', {}, { askar: askarModule }) const myModuleMethod = jest.fn() @injectable() @@ -61,7 +61,7 @@ describe('Agent', () => { ...agentOptions, modules: { myModule: new MyModule(), - ...getIndySdkModules(), + askar: askarModule, }, }) @@ -79,7 +79,7 @@ describe('Agent', () => { mediationRecipient: new MediationRecipientModule({ maximumMessagePickup: 42, }), - ...getIndySdkModules(), + askar: askarModule, }, }) diff --git a/packages/core/src/decorators/signature/SignatureDecoratorUtils.test.ts b/packages/core/src/decorators/signature/SignatureDecoratorUtils.test.ts index 93d3610f29..c4b943a5e1 100644 --- a/packages/core/src/decorators/signature/SignatureDecoratorUtils.test.ts +++ b/packages/core/src/decorators/signature/SignatureDecoratorUtils.test.ts @@ -1,8 +1,7 @@ import type { Wallet } from '../../wallet' -import { IndySdkWallet } from '../../../../indy-sdk/src' -import { indySdk } from '../../../../indy-sdk/tests/setupIndySdkModule' -import { getAgentConfig } from '../../../tests/helpers' +import { RegisteredAskarTestWallet } from '../../../../askar/tests/helpers' +import { agentDependencies, getAgentConfig } from '../../../tests/helpers' import { KeyType } from '../../crypto' import { SigningProviderRegistry } from '../../crypto/signing-provider' import { TypedArrayEncoder } from '../../utils' @@ -47,7 +46,11 @@ describe('Decorators | Signature | SignatureDecoratorUtils', () => { beforeAll(async () => { const config = getAgentConfig('SignatureDecoratorUtilsTest') - wallet = new IndySdkWallet(indySdk, config.logger, new SigningProviderRegistry([])) + wallet = new RegisteredAskarTestWallet( + config.logger, + new agentDependencies.FileSystem(), + new SigningProviderRegistry([]) + ) // eslint-disable-next-line @typescript-eslint/no-non-null-assertion await wallet.createAndOpen(config.walletConfig!) }) diff --git a/packages/core/src/modules/basic-messages/__tests__/basic-messages.e2e.test.ts b/packages/core/src/modules/basic-messages/__tests__/basic-messages.e2e.test.ts index 77f746030c..ae6ca1a29c 100644 --- a/packages/core/src/modules/basic-messages/__tests__/basic-messages.e2e.test.ts +++ b/packages/core/src/modules/basic-messages/__tests__/basic-messages.e2e.test.ts @@ -6,7 +6,7 @@ import { Subject } from 'rxjs' import { SubjectInboundTransport } from '../../../../../../tests/transport/SubjectInboundTransport' import { SubjectOutboundTransport } from '../../../../../../tests/transport/SubjectOutboundTransport' -import { getIndySdkModules } from '../../../../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../../../../askar/tests/helpers' import { getAgentOptions, makeConnection, waitForBasicMessage } from '../../../../tests/helpers' import testLogger from '../../../../tests/logger' import { Agent } from '../../../agent/Agent' @@ -19,7 +19,7 @@ const faberConfig = getAgentOptions( { endpoints: ['rxjs:faber'], }, - getIndySdkModules() + { askar: askarModule } ) const aliceConfig = getAgentOptions( @@ -27,7 +27,7 @@ const aliceConfig = getAgentOptions( { endpoints: ['rxjs:alice'], }, - getIndySdkModules() + { askar: askarModule } ) describe('Basic Messages E2E', () => { diff --git a/packages/core/src/modules/connections/__tests__/ConnectionService.test.ts b/packages/core/src/modules/connections/__tests__/ConnectionService.test.ts index 378596a888..78ff3c9b7d 100644 --- a/packages/core/src/modules/connections/__tests__/ConnectionService.test.ts +++ b/packages/core/src/modules/connections/__tests__/ConnectionService.test.ts @@ -5,9 +5,9 @@ import type { Routing } from '../services/ConnectionService' import { Subject } from 'rxjs' -import { IndySdkWallet } from '../../../../../indy-sdk/src' -import { indySdk } from '../../../../../indy-sdk/tests/setupIndySdkModule' +import { RegisteredAskarTestWallet } from '../../../../../askar/tests/helpers' import { + agentDependencies, getAgentConfig, getAgentContext, getMockConnection, @@ -92,7 +92,11 @@ describe('ConnectionService', () => { let agentContext: AgentContext beforeAll(async () => { - wallet = new IndySdkWallet(indySdk, agentConfig.logger, new SigningProviderRegistry([])) + wallet = new RegisteredAskarTestWallet( + agentConfig.logger, + new agentDependencies.FileSystem(), + new SigningProviderRegistry([]) + ) agentContext = getAgentContext({ wallet, agentConfig, diff --git a/packages/core/src/modules/connections/__tests__/connection-manual.e2e.test.ts b/packages/core/src/modules/connections/__tests__/connection-manual.e2e.test.ts index 9e029a27df..e784c6983e 100644 --- a/packages/core/src/modules/connections/__tests__/connection-manual.e2e.test.ts +++ b/packages/core/src/modules/connections/__tests__/connection-manual.e2e.test.ts @@ -4,7 +4,7 @@ import type { ConnectionStateChangedEvent } from '../ConnectionEvents' import { firstValueFrom } from 'rxjs' import { filter, first, map, timeout } from 'rxjs/operators' -import { getIndySdkModules } from '../../../../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../../../../askar/tests/helpers' import { setupSubjectTransports } from '../../../../tests' import { getAgentOptions } from '../../../../tests/helpers' import { Agent } from '../../../agent/Agent' @@ -53,7 +53,7 @@ describe('Manual Connection Flow', () => { endpoints: ['rxjs:alice'], }, { - ...getIndySdkModules(), + askar: askarModule, connections: new ConnectionsModule({ autoAcceptConnections: false, }), @@ -66,7 +66,7 @@ describe('Manual Connection Flow', () => { endpoints: ['rxjs:bob'], }, { - ...getIndySdkModules(), + askar: askarModule, connections: new ConnectionsModule({ autoAcceptConnections: false, }), @@ -78,7 +78,7 @@ describe('Manual Connection Flow', () => { endpoints: ['rxjs:faber'], }, { - ...getIndySdkModules(), + askar: askarModule, connections: new ConnectionsModule({ autoAcceptConnections: false, }), diff --git a/packages/core/src/modules/credentials/protocol/v2/__tests__/v2-connectionless-credentials.e2e.test.ts b/packages/core/src/modules/credentials/protocol/v2/__tests__/v2-connectionless-credentials.e2e.test.ts index 7fdb14f74a..9e1c5a7f0c 100644 --- a/packages/core/src/modules/credentials/protocol/v2/__tests__/v2-connectionless-credentials.e2e.test.ts +++ b/packages/core/src/modules/credentials/protocol/v2/__tests__/v2-connectionless-credentials.e2e.test.ts @@ -8,7 +8,7 @@ import { ReplaySubject, Subject } from 'rxjs' import { SubjectInboundTransport } from '../../../../../../../../tests/transport/SubjectInboundTransport' import { SubjectOutboundTransport } from '../../../../../../../../tests/transport/SubjectOutboundTransport' import { - getLegacyAnonCredsModules, + getAskarAnonCredsIndyModules, prepareForAnonCredsIssuance, } from '../../../../../../../anoncreds/tests/legacyAnonCredsSetup' import { waitForCredentialRecordSubject, getAgentOptions } from '../../../../../../tests/helpers' @@ -25,7 +25,7 @@ const faberAgentOptions = getAgentOptions( { endpoints: ['rxjs:faber'], }, - getLegacyAnonCredsModules() + getAskarAnonCredsIndyModules() ) const aliceAgentOptions = getAgentOptions( @@ -33,7 +33,7 @@ const aliceAgentOptions = getAgentOptions( { endpoints: ['rxjs:alice'], }, - getLegacyAnonCredsModules() + getAskarAnonCredsIndyModules() ) const credentialPreview = V2CredentialPreview.fromRecord({ diff --git a/packages/core/src/modules/credentials/protocol/v2/__tests__/v2.ldproof.credentials.propose-offerED25519.test.ts b/packages/core/src/modules/credentials/protocol/v2/__tests__/v2.ldproof.credentials.propose-offerED25519.test.ts index 860b29a43e..296e2bc863 100644 --- a/packages/core/src/modules/credentials/protocol/v2/__tests__/v2.ldproof.credentials.propose-offerED25519.test.ts +++ b/packages/core/src/modules/credentials/protocol/v2/__tests__/v2.ldproof.credentials.propose-offerED25519.test.ts @@ -1,29 +1,18 @@ import type { EventReplaySubject } from '../../../../../../tests' -import { randomUUID } from 'crypto' - import { LegacyIndyCredentialFormatService, LegacyIndyProofFormatService, V1CredentialProtocol, V1ProofProtocol, - AnonCredsModule, } from '../../../../../../../anoncreds/src' -import { prepareForAnonCredsIssuance } from '../../../../../../../anoncreds/tests/legacyAnonCredsSetup' import { - IndySdkAnonCredsRegistry, - IndySdkIndyDidRegistrar, - IndySdkIndyDidResolver, - IndySdkModule, - IndySdkSovDidResolver, -} from '../../../../../../../indy-sdk/src' -import { indySdk } from '../../../../../../../indy-sdk/tests/setupIndySdkModule' + getAskarAnonCredsIndyModules, + prepareForAnonCredsIssuance, +} from '../../../../../../../anoncreds/tests/legacyAnonCredsSetup' import { setupEventReplaySubjects, setupSubjectTransports, - genesisPath, - taaAcceptanceMechanism, - taaVersion, getAgentOptions, waitForCredentialRecordSubject, testLogger, @@ -34,7 +23,6 @@ import { KeyType } from '../../../../../crypto' import { TypedArrayEncoder } from '../../../../../utils' import { JsonTransformer } from '../../../../../utils/JsonTransformer' import { CacheModule, InMemoryLruCache } from '../../../../cache' -import { DidsModule } from '../../../../dids' import { ProofEventTypes, ProofsModule, V2ProofProtocol } from '../../../../proofs' import { W3cCredentialsModule } from '../../../../vc' import { customDocumentLoader } from '../../../../vc/data-integrity/__tests__/documentLoader' @@ -88,6 +76,7 @@ const indyProofFormat = new LegacyIndyProofFormatService() const getIndyJsonLdModules = () => ({ + ...getAskarAnonCredsIndyModules(), credentials: new CredentialsModule({ credentialProtocols: [ new V1CredentialProtocol({ indyCredentialFormat }), @@ -104,25 +93,6 @@ const getIndyJsonLdModules = () => }), ], }), - anoncreds: new AnonCredsModule({ - registries: [new IndySdkAnonCredsRegistry()], - }), - dids: new DidsModule({ - resolvers: [new IndySdkSovDidResolver(), new IndySdkIndyDidResolver()], - registrars: [new IndySdkIndyDidRegistrar()], - }), - indySdk: new IndySdkModule({ - indySdk, - networks: [ - { - isProduction: false, - genesisPath, - id: randomUUID(), - indyNamespace: `pool:localtest`, - transactionAuthorAgreement: { version: taaVersion, acceptanceMechanism: taaAcceptanceMechanism }, - }, - ], - }), cache: new CacheModule({ cache: new InMemoryLruCache({ limit: 100 }), }), diff --git a/packages/core/src/modules/oob/__tests__/implicit.e2e.test.ts b/packages/core/src/modules/oob/__tests__/implicit.e2e.test.ts index 2453b55e6c..5f35965917 100644 --- a/packages/core/src/modules/oob/__tests__/implicit.e2e.test.ts +++ b/packages/core/src/modules/oob/__tests__/implicit.e2e.test.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ -import type { IndySdkIndyDidCreateOptions } from '@aries-framework/indy-sdk' +import type { IndyVdrDidCreateOptions } from '@aries-framework/indy-vdr' -import { getLegacyAnonCredsModules } from '../../../../../anoncreds/tests/legacyAnonCredsSetup' +import { getAskarAnonCredsIndyModules } from '../../../../../anoncreds/tests/legacyAnonCredsSetup' import { setupSubjectTransports } from '../../../../tests' import { getAgentOptions, @@ -13,20 +13,21 @@ import { Agent } from '../../../agent/Agent' import { TypedArrayEncoder } from '../../../utils' import { sleep } from '../../../utils/sleep' import { DidExchangeState, HandshakeProtocol } from '../../connections' +import { DidCommV1Service, DidCommV2Service, DidDocumentService } from '../../dids' const faberAgentOptions = getAgentOptions( 'Faber Agent OOB Implicit', { endpoints: ['rxjs:faber'], }, - getLegacyAnonCredsModules() + getAskarAnonCredsIndyModules() ) const aliceAgentOptions = getAgentOptions( 'Alice Agent OOB Implicit', { endpoints: ['rxjs:alice'], }, - getLegacyAnonCredsModules() + getAskarAnonCredsIndyModules() ) describe('out of band implicit', () => { @@ -230,15 +231,34 @@ describe('out of band implicit', () => { }) async function createPublicDid(agent: Agent, unqualifiedSubmitterDid: string, endpoint: string) { - const createResult = await agent.dids.create({ + const createResult = await agent.dids.create({ method: 'indy', options: { - submitterDid: `did:indy:pool:localtest:${unqualifiedSubmitterDid}`, + endorserMode: 'internal', + endorserDid: `did:indy:pool:localtest:${unqualifiedSubmitterDid}`, + useEndpointAttrib: true, + services: [ + new DidDocumentService({ + id: `#endpoint`, + serviceEndpoint: endpoint, + type: 'endpoint', + }), + new DidCommV1Service({ + id: `#did-communication`, + priority: 0, + recipientKeys: [`#key-agreement-1`], + routingKeys: ['a-routing-key'], + serviceEndpoint: endpoint, + accept: ['didcomm/aip2;env=rfc19'], + }), + new DidCommV2Service({ + accept: ['didcomm/v2'], + id: `#didcomm-1`, + routingKeys: ['a-routing-key'], + serviceEndpoint: endpoint, + }), + ], alias: 'Alias', - endpoints: { - endpoint, - types: ['DIDComm', 'did-communication', 'endpoint'], - }, }, }) diff --git a/packages/core/src/modules/proofs/protocol/v2/__tests__/v2-indy-connectionless-proofs.e2e.test.ts b/packages/core/src/modules/proofs/protocol/v2/__tests__/v2-indy-connectionless-proofs.e2e.test.ts index e83dc5809a..db1bbbe965 100644 --- a/packages/core/src/modules/proofs/protocol/v2/__tests__/v2-indy-connectionless-proofs.e2e.test.ts +++ b/packages/core/src/modules/proofs/protocol/v2/__tests__/v2-indy-connectionless-proofs.e2e.test.ts @@ -7,7 +7,7 @@ import { SubjectInboundTransport } from '../../../../../../../../tests/transport import { SubjectOutboundTransport } from '../../../../../../../../tests/transport/SubjectOutboundTransport' import { V1CredentialPreview } from '../../../../../../../anoncreds/src' import { - getLegacyAnonCredsModules, + getAskarAnonCredsIndyModules, issueLegacyAnonCredsCredential, prepareForAnonCredsIssuance, setupAnonCredsTests, @@ -271,7 +271,7 @@ describe('V2 Connectionless Proofs - Indy', () => { endpoints: ['rxjs:mediator'], }, { - ...getLegacyAnonCredsModules({ + ...getAskarAnonCredsIndyModules({ autoAcceptProofs: AutoAcceptProof.Always, }), mediator: new MediatorModule({ @@ -303,7 +303,7 @@ describe('V2 Connectionless Proofs - Indy', () => { `Connectionless proofs with mediator Faber-${unique}`, {}, { - ...getLegacyAnonCredsModules({ + ...getAskarAnonCredsIndyModules({ autoAcceptProofs: AutoAcceptProof.Always, }), mediationRecipient: new MediationRecipientModule({ @@ -319,7 +319,7 @@ describe('V2 Connectionless Proofs - Indy', () => { `Connectionless proofs with mediator Alice-${unique}`, {}, { - ...getLegacyAnonCredsModules({ + ...getAskarAnonCredsIndyModules({ autoAcceptProofs: AutoAcceptProof.Always, }), mediationRecipient: new MediationRecipientModule({ diff --git a/packages/core/src/modules/routing/__tests__/mediation.test.ts b/packages/core/src/modules/routing/__tests__/mediation.test.ts index 574f999297..063a27e8d5 100644 --- a/packages/core/src/modules/routing/__tests__/mediation.test.ts +++ b/packages/core/src/modules/routing/__tests__/mediation.test.ts @@ -8,7 +8,7 @@ import { Subject } from 'rxjs' import { SubjectInboundTransport } from '../../../../../../tests/transport/SubjectInboundTransport' import { SubjectOutboundTransport } from '../../../../../../tests/transport/SubjectOutboundTransport' -import { getIndySdkModules } from '../../../../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../../../../askar/tests/helpers' import { getAgentOptions, waitForBasicMessage } from '../../../../tests/helpers' import { Agent } from '../../../agent/Agent' import { sleep } from '../../../utils/sleep' @@ -18,14 +18,14 @@ import { MediatorModule } from '../MediatorModule' import { MediatorPickupStrategy } from '../MediatorPickupStrategy' import { MediationState } from '../models/MediationState' -const recipientAgentOptions = getAgentOptions('Mediation: Recipient', {}, getIndySdkModules()) +const recipientAgentOptions = getAgentOptions('Mediation: Recipient', {}, { askar: askarModule }) const mediatorAgentOptions = getAgentOptions( 'Mediation: Mediator', { endpoints: ['rxjs:mediator'], }, { - ...getIndySdkModules(), + askar: askarModule, mediator: new MediatorModule({ autoAcceptMediationRequests: true, }), @@ -37,7 +37,7 @@ const senderAgentOptions = getAgentOptions( { endpoints: ['rxjs:sender'], }, - getIndySdkModules() + { askar: askarModule } ) describe('mediator establishment', () => { diff --git a/packages/core/src/modules/vc/__tests__/W3cCredentialService.test.ts b/packages/core/src/modules/vc/__tests__/W3cCredentialService.test.ts index 2a3961fa89..99c73e17c5 100644 --- a/packages/core/src/modules/vc/__tests__/W3cCredentialService.test.ts +++ b/packages/core/src/modules/vc/__tests__/W3cCredentialService.test.ts @@ -1,8 +1,8 @@ import type { AgentContext } from '../../../agent' import type { Wallet } from '../../../wallet' -import { IndySdkWallet } from '../../../../../indy-sdk/src' -import { getAgentConfig, indySdk, getAgentContext, mockFunction } from '../../../../tests' +import { RegisteredAskarTestWallet } from '../../../../../askar/tests/helpers' +import { agentDependencies, getAgentConfig, getAgentContext, mockFunction } from '../../../../tests' import { SigningProviderRegistry, JwsService } from '../../../crypto' import { JsonTransformer, asArray } from '../../../utils' import { W3cCredentialService } from '../W3cCredentialService' @@ -48,7 +48,11 @@ describe('W3cCredentialsService', () => { let w3cCredentialsRepository: W3cCredentialRepository beforeAll(async () => { - wallet = new IndySdkWallet(indySdk, agentConfig.logger, signingProviderRegistry) + wallet = new RegisteredAskarTestWallet( + agentConfig.logger, + new agentDependencies.FileSystem(), + signingProviderRegistry + ) await wallet.createAndOpen(agentConfig.walletConfig) agentContext = getAgentContext({ agentConfig, diff --git a/packages/core/src/modules/vc/__tests__/W3cCredentialsApi.test.ts b/packages/core/src/modules/vc/__tests__/W3cCredentialsApi.test.ts index 01a67407cf..f374f09593 100644 --- a/packages/core/src/modules/vc/__tests__/W3cCredentialsApi.test.ts +++ b/packages/core/src/modules/vc/__tests__/W3cCredentialsApi.test.ts @@ -1,5 +1,5 @@ -import { IndySdkModule } from '../../../../../indy-sdk/src' -import { getAgentOptions, indySdk } from '../../../../tests' +import { askarModule } from '../../../../../askar/tests/helpers' +import { getAgentOptions } from '../../../../tests' import { Agent } from '../../../agent/Agent' import { JsonTransformer } from '../../../utils' import { W3cCredentialService } from '../W3cCredentialService' @@ -10,9 +10,7 @@ import { W3cJsonLdVerifiableCredential } from '../data-integrity/models' import { W3cCredentialRepository } from '../repository' const modules = { - indySdk: new IndySdkModule({ - indySdk, - }), + askar: askarModule, w3cCredentials: new W3cCredentialsModule({ documentLoader: customDocumentLoader, }), diff --git a/packages/core/src/modules/vc/data-integrity/__tests__/W3cJsonLdCredentialService.test.ts b/packages/core/src/modules/vc/data-integrity/__tests__/W3cJsonLdCredentialService.test.ts index 80f4e42526..e980c81e3c 100644 --- a/packages/core/src/modules/vc/data-integrity/__tests__/W3cJsonLdCredentialService.test.ts +++ b/packages/core/src/modules/vc/data-integrity/__tests__/W3cJsonLdCredentialService.test.ts @@ -1,9 +1,8 @@ import type { AgentContext } from '../../../../agent' import type { Wallet } from '../../../../wallet' -import { IndySdkWallet } from '../../../../../../indy-sdk/src' -import { indySdk } from '../../../../../../indy-sdk/tests/setupIndySdkModule' -import { getAgentConfig, getAgentContext } from '../../../../../tests/helpers' +import { RegisteredAskarTestWallet } from '../../../../../../askar/tests/helpers' +import { agentDependencies, getAgentConfig, getAgentContext } from '../../../../../tests/helpers' import { KeyType } from '../../../../crypto' import { SigningProviderRegistry } from '../../../../crypto/signing-provider' import { asArray, TypedArrayEncoder } from '../../../../utils' @@ -51,7 +50,11 @@ describe('W3cJsonLdCredentialsService', () => { const privateKey = TypedArrayEncoder.fromString('testseed000000000000000000000001') beforeAll(async () => { - wallet = new IndySdkWallet(indySdk, agentConfig.logger, signingProviderRegistry) + wallet = new RegisteredAskarTestWallet( + agentConfig.logger, + new agentDependencies.FileSystem(), + signingProviderRegistry + ) await wallet.createAndOpen(agentConfig.walletConfig) agentContext = getAgentContext({ agentConfig, diff --git a/packages/core/src/storage/migration/__tests__/0.1.test.ts b/packages/core/src/storage/migration/__tests__/0.1.test.ts index ff2033f3ba..67c9aabed0 100644 --- a/packages/core/src/storage/migration/__tests__/0.1.test.ts +++ b/packages/core/src/storage/migration/__tests__/0.1.test.ts @@ -4,9 +4,7 @@ import { readFileSync } from 'fs' import path from 'path' import { InMemoryStorageService } from '../../../../../../tests/InMemoryStorageService' -import { IndySdkWallet } from '../../../../../indy-sdk/src' -import { IndySdkSymbol } from '../../../../../indy-sdk/src/types' -import { indySdk } from '../../../../../indy-sdk/tests/setupIndySdkModule' +import { RegisteredAskarTestWallet } from '../../../../../askar/tests/helpers' import { Agent } from '../../../../src' import { agentDependencies as dependencies } from '../../../../tests/helpers' import { InjectionSymbols } from '../../../constants' @@ -40,9 +38,8 @@ describe('UpdateAssistant | v0.1 - v0.2', () => { const dependencyManager = new DependencyManager() const storageService = new InMemoryStorageService() dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) const agent = new Agent( { @@ -99,9 +96,8 @@ describe('UpdateAssistant | v0.1 - v0.2', () => { const dependencyManager = new DependencyManager() const storageService = new InMemoryStorageService() dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) const agent = new Agent( { @@ -160,9 +156,8 @@ describe('UpdateAssistant | v0.1 - v0.2', () => { const dependencyManager = new DependencyManager() const storageService = new InMemoryStorageService() dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) const agent = new Agent( { @@ -221,9 +216,8 @@ describe('UpdateAssistant | v0.1 - v0.2', () => { const dependencyManager = new DependencyManager() const storageService = new InMemoryStorageService() dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) const agent = new Agent( { diff --git a/packages/core/src/storage/migration/__tests__/0.2.test.ts b/packages/core/src/storage/migration/__tests__/0.2.test.ts index a66ef7c832..e79919750d 100644 --- a/packages/core/src/storage/migration/__tests__/0.2.test.ts +++ b/packages/core/src/storage/migration/__tests__/0.2.test.ts @@ -2,10 +2,8 @@ import { readFileSync } from 'fs' import path from 'path' import { InMemoryStorageService } from '../../../../../../tests/InMemoryStorageService' -import { IndySdkWallet } from '../../../../../indy-sdk/src' -import { IndySdkSymbol } from '../../../../../indy-sdk/src/types' +import { RegisteredAskarTestWallet } from '../../../../../askar/tests/helpers' import { Agent } from '../../../../src' -import { indySdk } from '../../../../tests' import { agentDependencies } from '../../../../tests/helpers' import { InjectionSymbols } from '../../../constants' import { DependencyManager } from '../../../plugins' @@ -34,9 +32,8 @@ describe('UpdateAssistant | v0.2 - v0.3.1', () => { const dependencyManager = new DependencyManager() const storageService = new InMemoryStorageService() dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) const agent = new Agent( { @@ -103,9 +100,8 @@ describe('UpdateAssistant | v0.2 - v0.3.1', () => { const dependencyManager = new DependencyManager() const storageService = new InMemoryStorageService() dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) const agent = new Agent( { @@ -150,9 +146,8 @@ describe('UpdateAssistant | v0.2 - v0.3.1', () => { const dependencyManager = new DependencyManager() const storageService = new InMemoryStorageService() - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) const agent = new Agent( diff --git a/packages/core/src/storage/migration/__tests__/0.3.test.ts b/packages/core/src/storage/migration/__tests__/0.3.test.ts index e8479803fc..25f0a2a219 100644 --- a/packages/core/src/storage/migration/__tests__/0.3.test.ts +++ b/packages/core/src/storage/migration/__tests__/0.3.test.ts @@ -2,9 +2,7 @@ import { readFileSync } from 'fs' import path from 'path' import { InMemoryStorageService } from '../../../../../../tests/InMemoryStorageService' -import { IndySdkWallet } from '../../../../../indy-sdk/src' -import { IndySdkSymbol } from '../../../../../indy-sdk/src/types' -import { indySdk } from '../../../../tests' +import { RegisteredAskarTestWallet } from '../../../../../askar/tests/helpers' import { agentDependencies } from '../../../../tests/helpers' import { Agent } from '../../../agent/Agent' import { InjectionSymbols } from '../../../constants' @@ -34,9 +32,8 @@ describe('UpdateAssistant | v0.3.1 - v0.4', () => { const dependencyManager = new DependencyManager() const storageService = new InMemoryStorageService() dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) const agent = new Agent( { diff --git a/packages/core/src/storage/migration/__tests__/UpdateAssistant.test.ts b/packages/core/src/storage/migration/__tests__/UpdateAssistant.test.ts index 2f9e3e80a3..e437b36c6b 100644 --- a/packages/core/src/storage/migration/__tests__/UpdateAssistant.test.ts +++ b/packages/core/src/storage/migration/__tests__/UpdateAssistant.test.ts @@ -1,9 +1,7 @@ import type { BaseRecord } from '../../BaseRecord' import { InMemoryStorageService } from '../../../../../../tests/InMemoryStorageService' -import { IndySdkWallet } from '../../../../../indy-sdk/src' -import { IndySdkSymbol } from '../../../../../indy-sdk/src/types' -import { indySdk } from '../../../../../indy-sdk/tests/setupIndySdkModule' +import { RegisteredAskarTestWallet } from '../../../../../askar/tests/helpers' import { getAgentOptions } from '../../../../tests/helpers' import { Agent } from '../../../agent/Agent' import { InjectionSymbols } from '../../../constants' @@ -21,9 +19,8 @@ describe('UpdateAssistant', () => { beforeEach(async () => { const dependencyManager = new DependencyManager() storageService = new InMemoryStorageService() - // If we register the IndySdkModule it will register the storage service, but we use in memory storage here - dependencyManager.registerContextScoped(InjectionSymbols.Wallet, IndySdkWallet) - dependencyManager.registerInstance(IndySdkSymbol, indySdk) + // If we register the AskarModule it will register the storage service, but we use in memory storage here + dependencyManager.registerContextScoped(InjectionSymbols.Wallet, RegisteredAskarTestWallet) dependencyManager.registerInstance(InjectionSymbols.StorageService, storageService) agent = new Agent(agentOptions, dependencyManager) diff --git a/packages/core/src/storage/migration/__tests__/backup.test.ts b/packages/core/src/storage/migration/__tests__/backup.test.ts index e582263b57..15cf8ff031 100644 --- a/packages/core/src/storage/migration/__tests__/backup.test.ts +++ b/packages/core/src/storage/migration/__tests__/backup.test.ts @@ -4,7 +4,7 @@ import type { StorageUpdateError } from '../error/StorageUpdateError' import { readFileSync, unlinkSync } from 'fs' import path from 'path' -import { getIndySdkModules } from '../../../../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../../../../askar/tests/helpers' import { getAgentOptions } from '../../../../tests/helpers' import { Agent } from '../../../agent/Agent' import { InjectionSymbols } from '../../../constants' @@ -14,7 +14,7 @@ import { JsonTransformer } from '../../../utils' import { StorageUpdateService } from '../StorageUpdateService' import { UpdateAssistant } from '../UpdateAssistant' -const agentOptions = getAgentOptions('UpdateAssistant | Backup', {}, getIndySdkModules()) +const agentOptions = getAgentOptions('UpdateAssistant | Backup', {}, { askar: askarModule }) const aliceCredentialRecordsString = readFileSync( path.join(__dirname, '__fixtures__/alice-4-credentials-0.1.json'), diff --git a/packages/core/tests/agents.test.ts b/packages/core/tests/agents.test.ts index 9bded8ba18..9f8dd40b97 100644 --- a/packages/core/tests/agents.test.ts +++ b/packages/core/tests/agents.test.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import type { ConnectionRecord } from '../src/modules/connections' -import { getIndySdkModules } from '../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../askar/tests/helpers' import { Agent } from '../src/agent/Agent' import { HandshakeProtocol } from '../src/modules/connections' @@ -13,14 +13,14 @@ const aliceAgentOptions = getAgentOptions( { endpoints: ['rxjs:alice'], }, - getIndySdkModules() + { askar: askarModule } ) const bobAgentOptions = getAgentOptions( 'Agents Bob', { endpoints: ['rxjs:bob'], }, - getIndySdkModules() + { askar: askarModule } ) describe('agents', () => { diff --git a/packages/core/tests/connections.test.ts b/packages/core/tests/connections.test.ts index 0f64b31d2c..09760187a8 100644 --- a/packages/core/tests/connections.test.ts +++ b/packages/core/tests/connections.test.ts @@ -3,7 +3,7 @@ import type { AgentMessageProcessedEvent, KeylistUpdate } from '../src' import { filter, firstValueFrom, map, timeout } from 'rxjs' -import { getIndySdkModules } from '../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../askar/tests/helpers' import { MediatorModule, Key, @@ -32,21 +32,21 @@ describe('connections', () => { { endpoints: ['rxjs:faber'], }, - getIndySdkModules() + { askar: askarModule } ) const aliceAgentOptions = getAgentOptions( 'Alice Agent Connections', { endpoints: ['rxjs:alice'], }, - getIndySdkModules() + { askar: askarModule } ) const acmeAgentOptions = getAgentOptions( 'Acme Agent Connections', { endpoints: ['rxjs:acme'], }, - getIndySdkModules() + { askar: askarModule } ) const mediatorAgentOptions = getAgentOptions( 'Mediator Agent Connections', @@ -54,7 +54,7 @@ describe('connections', () => { endpoints: ['rxjs:mediator'], }, { - ...getIndySdkModules(), + askar: askarModule, mediator: new MediatorModule({ autoAcceptMediationRequests: true, }), diff --git a/packages/core/tests/generic-records.test.ts b/packages/core/tests/generic-records.test.ts index 3d37def0ed..6da9f6f8ce 100644 --- a/packages/core/tests/generic-records.test.ts +++ b/packages/core/tests/generic-records.test.ts @@ -1,6 +1,6 @@ import type { GenericRecord } from '../src/modules/generic-records/repository/GenericRecord' -import { getIndySdkModules } from '../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../askar/tests/helpers' import { Agent } from '../src/agent/Agent' import { RecordNotFoundError } from '../src/error' @@ -11,7 +11,7 @@ const aliceAgentOptions = getAgentOptions( { endpoints: ['rxjs:alice'], }, - getIndySdkModules() + { askar: askarModule } ) describe('genericRecords', () => { diff --git a/packages/core/tests/helpers.ts b/packages/core/tests/helpers.ts index 517c53a274..81cfcdcfde 100644 --- a/packages/core/tests/helpers.ts +++ b/packages/core/tests/helpers.ts @@ -26,7 +26,7 @@ import path from 'path' import { lastValueFrom, firstValueFrom, ReplaySubject } from 'rxjs' import { catchError, filter, map, take, timeout } from 'rxjs/operators' -import { agentDependencies, IndySdkPostgresWalletScheme } from '../../node/src' +import { agentDependencies } from '../../node/src' import { OutOfBandDidCommService, ConnectionsModule, @@ -100,49 +100,6 @@ export function getAgentOptions( - name: string, - extraConfig: Partial = {}, - inputModules?: AgentModules -) { - const random = uuid().slice(0, 4) - const config: InitConfig = { - label: `Agent: ${name} - ${random}`, - walletConfig: { - // NOTE: IndySDK Postgres database per wallet doesn't support special characters/spaces in the wallet name - id: `PostgresWallet${name}${random}`, - key: `Key${name}`, - storage: { - type: 'postgres_storage', - config: { - url: 'localhost:5432', - wallet_scheme: IndySdkPostgresWalletScheme.DatabasePerWallet, - }, - credentials: { - account: 'postgres', - password: 'postgres', - admin_account: 'postgres', - admin_password: 'postgres', - }, - }, - }, - autoUpdateStorageOnStartup: false, - logger: TestLogger.fromLogger(testLogger, name), - ...extraConfig, - } - - const m = (inputModules ?? {}) as AgentModulesInput - const modules = { - ...m, - // Make sure connections module is always defined so we can set autoAcceptConnections - connections: m.connections ?? new ConnectionsModule({}), - } - - modules.connections.config.autoAcceptConnections = true - - return { config, dependencies: agentDependencies, modules: modules as AgentModules } as const -} - export async function importExistingIndyDidFromPrivateKey(agent: Agent, privateKey: Buffer) { const key = await agent.wallet.createKey({ keyType: KeyType.Ed25519, diff --git a/packages/core/tests/index.ts b/packages/core/tests/index.ts index 2822fb23e1..b8ea2ca430 100644 --- a/packages/core/tests/index.ts +++ b/packages/core/tests/index.ts @@ -2,7 +2,6 @@ export * from './jsonld' export * from './transport' export * from './events' export * from './helpers' -export * from './indySdk' import testLogger from './logger' diff --git a/packages/core/tests/indySdk.ts b/packages/core/tests/indySdk.ts deleted file mode 100644 index b5e5a3075d..0000000000 --- a/packages/core/tests/indySdk.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { indySdk } from '../../indy-sdk/tests/setupIndySdkModule' - -export { indySdk } diff --git a/packages/core/tests/jsonld.ts b/packages/core/tests/jsonld.ts index 9b0f211097..f996794e57 100644 --- a/packages/core/tests/jsonld.ts +++ b/packages/core/tests/jsonld.ts @@ -1,9 +1,8 @@ import type { EventReplaySubject } from './events' import type { AutoAcceptCredential, AutoAcceptProof, ConnectionRecord } from '../src' +import { askarModule } from '../../askar/tests/helpers' import { BbsModule } from '../../bbs-signatures/src/BbsModule' -import { IndySdkModule } from '../../indy-sdk/src' -import { indySdk } from '../../indy-sdk/tests/setupIndySdkModule' import { CacheModule, CredentialEventTypes, @@ -42,9 +41,7 @@ export const getJsonLdModules = ({ cache: new CacheModule({ cache: new InMemoryLruCache({ limit: 100 }), }), - indySdk: new IndySdkModule({ - indySdk, - }), + askar: askarModule, bbs: new BbsModule(), } as const) diff --git a/packages/core/tests/migration.test.ts b/packages/core/tests/migration.test.ts index ac898caa73..bc39a9382a 100644 --- a/packages/core/tests/migration.test.ts +++ b/packages/core/tests/migration.test.ts @@ -1,12 +1,12 @@ import type { VersionString } from '../src/utils/version' -import { getIndySdkModules } from '../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../askar/tests/helpers' import { Agent } from '../src/agent/Agent' import { UpdateAssistant } from '../src/storage/migration/UpdateAssistant' import { getAgentOptions } from './helpers' -const agentOptions = getAgentOptions('Migration', {}, getIndySdkModules()) +const agentOptions = getAgentOptions('Migration', {}, { askar: askarModule }) describe('migration', () => { test('manually initiating the update assistant to perform an update', async () => { diff --git a/packages/core/tests/multi-protocol-version.test.ts b/packages/core/tests/multi-protocol-version.test.ts index 4f7596d5ff..b14db97215 100644 --- a/packages/core/tests/multi-protocol-version.test.ts +++ b/packages/core/tests/multi-protocol-version.test.ts @@ -2,7 +2,7 @@ import type { AgentMessageProcessedEvent } from '../src/agent/Events' import { filter, firstValueFrom, timeout } from 'rxjs' -import { getIndySdkModules } from '../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../askar/tests/helpers' import { parseMessageType, MessageSender, AgentMessage, IsValidMessageType } from '../src' import { Agent } from '../src/agent/Agent' import { AgentEventTypes } from '../src/agent/Events' @@ -16,14 +16,14 @@ const aliceAgentOptions = getAgentOptions( { endpoints: ['rxjs:alice'], }, - getIndySdkModules() + { askar: askarModule } ) const bobAgentOptions = getAgentOptions( 'Multi Protocol Versions - Bob', { endpoints: ['rxjs:bob'], }, - getIndySdkModules() + { askar: askarModule } ) describe('multi version protocols', () => { diff --git a/packages/core/tests/oob-mediation-provision.test.ts b/packages/core/tests/oob-mediation-provision.test.ts index 5e18f36197..610f27fdfd 100644 --- a/packages/core/tests/oob-mediation-provision.test.ts +++ b/packages/core/tests/oob-mediation-provision.test.ts @@ -1,7 +1,7 @@ /* eslint-disable @typescript-eslint/no-non-null-assertion */ import type { OutOfBandInvitation } from '../src/modules/oob/messages' -import { getIndySdkModules } from '../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../askar/tests/helpers' import { Agent } from '../src/agent/Agent' import { DidExchangeState, HandshakeProtocol } from '../src/modules/connections' import { @@ -19,7 +19,7 @@ const faberAgentOptions = getAgentOptions( { endpoints: ['rxjs:faber'], }, - getIndySdkModules() + { askar: askarModule } ) const aliceAgentOptions = getAgentOptions( 'OOB mediation provision - Alice Recipient Agent', @@ -27,7 +27,7 @@ const aliceAgentOptions = getAgentOptions( endpoints: ['rxjs:alice'], }, { - ...getIndySdkModules(), + askar: askarModule, mediationRecipient: new MediationRecipientModule({ // FIXME: discover features returns that we support this protocol, but we don't support all roles // we should return that we only support the mediator role so we don't have to explicitly declare this @@ -40,7 +40,7 @@ const mediatorAgentOptions = getAgentOptions( { endpoints: ['rxjs:mediator'], }, - { ...getIndySdkModules(), mediator: new MediatorModule({ autoAcceptMediationRequests: true }) } + { askar: askarModule, mediator: new MediatorModule({ autoAcceptMediationRequests: true }) } ) describe('out of band with mediation set up with provision method', () => { diff --git a/packages/core/tests/oob-mediation.test.ts b/packages/core/tests/oob-mediation.test.ts index 272c468d3b..ea39333bc2 100644 --- a/packages/core/tests/oob-mediation.test.ts +++ b/packages/core/tests/oob-mediation.test.ts @@ -7,7 +7,7 @@ import { filter, firstValueFrom, map, Subject, timeout } from 'rxjs' import { SubjectInboundTransport } from '../../../tests/transport/SubjectInboundTransport' import { SubjectOutboundTransport } from '../../../tests/transport/SubjectOutboundTransport' -import { getIndySdkModules } from '../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../askar/tests/helpers' import { Agent } from '../src/agent/Agent' import { AgentEventTypes } from '../src/agent/Events' import { DidExchangeState, HandshakeProtocol } from '../src/modules/connections' @@ -29,7 +29,7 @@ const faberAgentOptions = getAgentOptions( { endpoints: ['rxjs:faber'], }, - getIndySdkModules() + { askar: askarModule } ) const aliceAgentOptions = getAgentOptions( 'OOB mediation - Alice Recipient Agent', @@ -37,7 +37,7 @@ const aliceAgentOptions = getAgentOptions( endpoints: ['rxjs:alice'], }, { - ...getIndySdkModules(), + askar: askarModule, mediationRecipient: new MediationRecipientModule({ // FIXME: discover features returns that we support this protocol, but we don't support all roles // we should return that we only support the mediator role so we don't have to explicitly declare this @@ -50,7 +50,7 @@ const mediatorAgentOptions = getAgentOptions( { endpoints: ['rxjs:mediator'], }, - { ...getIndySdkModules(), mediator: new MediatorModule({ autoAcceptMediationRequests: true }) } + { askar: askarModule, mediator: new MediatorModule({ autoAcceptMediationRequests: true }) } ) describe('out of band with mediation', () => { diff --git a/packages/core/tests/oob.test.ts b/packages/core/tests/oob.test.ts index 2911d9d406..35b323af93 100644 --- a/packages/core/tests/oob.test.ts +++ b/packages/core/tests/oob.test.ts @@ -8,7 +8,7 @@ import { Subject } from 'rxjs' import { SubjectInboundTransport } from '../../../tests/transport/SubjectInboundTransport' import { SubjectOutboundTransport } from '../../../tests/transport/SubjectOutboundTransport' -import { getLegacyAnonCredsModules, prepareForAnonCredsIssuance } from '../../anoncreds/tests/legacyAnonCredsSetup' +import { getAskarAnonCredsIndyModules, prepareForAnonCredsIssuance } from '../../anoncreds/tests/legacyAnonCredsSetup' import { Agent } from '../src/agent/Agent' import { Key } from '../src/crypto' import { DidExchangeState, HandshakeProtocol } from '../src/modules/connections' @@ -29,7 +29,7 @@ const faberAgentOptions = getAgentOptions( { endpoints: ['rxjs:faber'], }, - getLegacyAnonCredsModules({ + getAskarAnonCredsIndyModules({ autoAcceptCredentials: AutoAcceptCredential.ContentApproved, }) ) @@ -38,7 +38,7 @@ const aliceAgentOptions = getAgentOptions( { endpoints: ['rxjs:alice'], }, - getLegacyAnonCredsModules({ + getAskarAnonCredsIndyModules({ autoAcceptCredentials: AutoAcceptCredential.ContentApproved, }) ) @@ -63,8 +63,8 @@ describe('out of band', () => { autoAcceptConnection: false, } - let faberAgent: Agent> - let aliceAgent: Agent> + let faberAgent: Agent> + let aliceAgent: Agent> let credentialTemplate: CreateCredentialOfferOptions<[V1CredentialProtocol]> beforeAll(async () => { diff --git a/packages/core/tests/wallet.test.ts b/packages/core/tests/wallet.test.ts index 78e089482a..e7815cf4e4 100644 --- a/packages/core/tests/wallet.test.ts +++ b/packages/core/tests/wallet.test.ts @@ -1,7 +1,7 @@ import { tmpdir } from 'os' import path from 'path' -import { getIndySdkModules } from '../../indy-sdk/tests/setupIndySdkModule' +import { askarModule } from '../../askar/tests/helpers' import { Agent } from '../src/agent/Agent' import { BasicMessageRepository, BasicMessageRecord, BasicMessageRole } from '../src/modules/basic-messages' import { KeyDerivationMethod } from '../src/types' @@ -12,8 +12,8 @@ import { WalletNotFoundError } from '../src/wallet/error/WalletNotFoundError' import { getAgentOptions } from './helpers' -const aliceAgentOptions = getAgentOptions('wallet-tests-Alice', {}, getIndySdkModules()) -const bobAgentOptions = getAgentOptions('wallet-tests-Bob', {}, getIndySdkModules()) +const aliceAgentOptions = getAgentOptions('wallet-tests-Alice', {}, { askar: askarModule }) +const bobAgentOptions = getAgentOptions('wallet-tests-Bob', {}, { askar: askarModule }) describe('wallet', () => { let aliceAgent: Agent diff --git a/packages/indy-sdk-to-askar-migration/package.json b/packages/indy-sdk-to-askar-migration/package.json index a8e1c6e0a4..81ecd826df 100644 --- a/packages/indy-sdk-to-askar-migration/package.json +++ b/packages/indy-sdk-to-askar-migration/package.json @@ -30,10 +30,8 @@ "@aries-framework/node": "0.4.2" }, "devDependencies": { - "@aries-framework/indy-sdk": "0.4.2", "@hyperledger/aries-askar-nodejs": "^0.2.0-dev.1", "@hyperledger/aries-askar-shared": "^0.2.0-dev.1", - "indy-sdk": "^1.16.0-dev-1655", "rimraf": "^4.4.0", "typescript": "~4.9.5" }, diff --git a/packages/indy-sdk-to-askar-migration/src/IndySdkToAskarMigrationUpdater.ts b/packages/indy-sdk-to-askar-migration/src/IndySdkToAskarMigrationUpdater.ts index 0af8f27508..50382c0a18 100644 --- a/packages/indy-sdk-to-askar-migration/src/IndySdkToAskarMigrationUpdater.ts +++ b/packages/indy-sdk-to-askar-migration/src/IndySdkToAskarMigrationUpdater.ts @@ -119,7 +119,7 @@ export class IndySdkToAskarMigrationUpdater { /** * Location of the new wallet */ - private get newWalletPath() { + public get newWalletPath() { return `${this.fs.dataPath}/wallet/${this.walletConfig.id}/sqlite.db` } diff --git a/packages/indy-sdk-to-askar-migration/tests/indy-sdk-040-wallet.db b/packages/indy-sdk-to-askar-migration/tests/indy-sdk-040-wallet.db new file mode 100644 index 0000000000..1fc1e28b40 Binary files /dev/null and b/packages/indy-sdk-to-askar-migration/tests/indy-sdk-040-wallet.db differ 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 5688e3a49f..d82d9cdf53 100644 --- a/packages/indy-sdk-to-askar-migration/tests/migrate.test.ts +++ b/packages/indy-sdk-to-askar-migration/tests/migrate.test.ts @@ -1,10 +1,10 @@ import type { InitConfig } from '@aries-framework/core' -import { utils, KeyDerivationMethod, Agent } from '@aries-framework/core' -import { IndySdkModule } from '@aries-framework/indy-sdk' +import { KeyDerivationMethod, Agent } from '@aries-framework/core' import { agentDependencies } from '@aries-framework/node' -import indy from 'indy-sdk' +import { copyFileSync, existsSync, mkdirSync, unlinkSync } from 'fs' import { homedir } from 'os' +import path from 'path' import { askarModule } from '../../askar/tests/helpers' import { IndySdkToAskarMigrationUpdater } from '../src' @@ -13,44 +13,40 @@ import { IndySdkToAskarMigrationError } from '../src/errors/IndySdkToAskarMigrat describe('Indy SDK To Askar Migration', () => { test('indy-sdk sqlite to aries-askar sqlite successful migration', async () => { const indySdkAndAskarConfig: InitConfig = { - label: `indy | indy-sdk sqlite to aries-askar sqlite successful migration | ${utils.uuid()}`, + label: `indy | indy-sdk sqlite to aries-askar sqlite successful migration | e9484a22-6f8c-4e35-88c5-83cc1a7f77b4`, walletConfig: { - id: `indy-sdk sqlite to aries-askar sqlite successful migration | ${utils.uuid()}`, + id: `indy-sdk sqlite to aries-askar sqlite successful migration | e9484a22-6f8c-4e35-88c5-83cc1a7f77b4`, key: 'GfwU1DC7gEZNs3w41tjBiZYj7BNToDoFEqKY6wZXqs1A', keyDerivationMethod: KeyDerivationMethod.Raw, }, } - const indySdkAgent = new Agent({ - config: indySdkAndAskarConfig, - modules: { indySdk: new IndySdkModule({ indySdk: indy }) }, - dependencies: agentDependencies, - }) - const indySdkAgentDbPath = `${homedir()}/.indy_client/wallet/${indySdkAndAskarConfig.walletConfig?.id}/sqlite.db` - - const genericRecordContent = { foo: 'bar' } - - await indySdkAgent.initialize() - - const record = await indySdkAgent.genericRecords.save({ content: genericRecordContent }) - - await indySdkAgent.shutdown() - + const indySdkWalletTestPath = path.join(__dirname, 'indy-sdk-040-wallet.db') const askarAgent = new Agent({ config: indySdkAndAskarConfig, modules: { askar: askarModule }, dependencies: agentDependencies, }) - const updater = await IndySdkToAskarMigrationUpdater.initialize({ dbPath: indySdkAgentDbPath, agent: askarAgent }) - await updater.update() + // Remove new wallet path (if exists) + unlinkSync(updater.newWalletPath) + + // Create old wallet path and copy test wallet + mkdirSync(path.dirname(indySdkAgentDbPath), { recursive: true }) + copyFileSync(indySdkWalletTestPath, indySdkAgentDbPath) + + await updater.update() await askarAgent.initialize() - await expect(askarAgent.genericRecords.findById(record.id)).resolves.toMatchObject({ - content: genericRecordContent, - }) + await expect(askarAgent.genericRecords.getAll()).resolves.toMatchObject([ + { + content: { + foo: 'bar', + }, + }, + ]) await askarAgent.shutdown() }) @@ -64,36 +60,21 @@ describe('Indy SDK To Askar Migration', () => { */ test('indy-sdk sqlite to aries-askar sqlite fails and restores', async () => { const indySdkAndAskarConfig: InitConfig = { - label: `indy | indy-sdk sqlite to aries-askar sqlite fails and restores | ${utils.uuid()}`, + label: `indy | indy-sdk sqlite to aries-askar sqlite successful migration | e9484a22-6f8c-4e35-88c5-83cc1a7f77b4`, walletConfig: { - id: `indy-sdk sqlite to aries-askar sqlite fails and restores | ${utils.uuid()}`, - key: 'GfwU1DC7gEZNs3w41tjBiZYj7BNToDoFEqKY6wZXqs1A', + id: `indy-sdk sqlite to aries-askar sqlite successful migration | e9484a22-6f8c-4e35-88c5-83cc1a7f77b4`, + // NOTE: wrong key passed + key: 'wrong-key', keyDerivationMethod: KeyDerivationMethod.Raw, }, } - const indySdkAgent = new Agent({ - config: indySdkAndAskarConfig, - modules: { indySdk: new IndySdkModule({ indySdk: indy }) }, - dependencies: agentDependencies, - }) - const indySdkAgentDbPath = `${homedir()}/.indy_client/wallet/${indySdkAndAskarConfig.walletConfig?.id}/sqlite.db` - - const genericRecordContent = { foo: 'bar' } - - await indySdkAgent.initialize() - - const record = await indySdkAgent.genericRecords.save({ content: genericRecordContent }) - - await indySdkAgent.shutdown() + const indySdkWalletTestPath = path.join(__dirname, 'indy-sdk-040-wallet.db') const askarAgent = new Agent({ - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - config: { ...indySdkAndAskarConfig, walletConfig: { ...indySdkAndAskarConfig.walletConfig!, key: 'wrong-key' } }, - modules: { - askar: askarModule, - }, + config: indySdkAndAskarConfig, + modules: { askar: askarModule }, dependencies: agentDependencies, }) @@ -102,12 +83,14 @@ describe('Indy SDK To Askar Migration', () => { agent: askarAgent, }) - await expect(updater.update()).rejects.toThrowError(IndySdkToAskarMigrationError) + // Remove new wallet path (if exists) + unlinkSync(updater.newWalletPath) - await indySdkAgent.initialize() + // Create old wallet path and copy test wallet + mkdirSync(path.dirname(indySdkAgentDbPath), { recursive: true }) + copyFileSync(indySdkWalletTestPath, indySdkAgentDbPath) - await expect(indySdkAgent.genericRecords.findById(record.id)).resolves.toMatchObject({ - content: genericRecordContent, - }) + await expect(updater.update()).rejects.toThrowError(IndySdkToAskarMigrationError) + expect(existsSync(indySdkWalletTestPath)).toBe(true) }) }) diff --git a/packages/indy-vdr/package.json b/packages/indy-vdr/package.json index 7f2d052726..e49286f040 100644 --- a/packages/indy-vdr/package.json +++ b/packages/indy-vdr/package.json @@ -28,8 +28,8 @@ "@aries-framework/core": "0.4.2" }, "devDependencies": { - "@hyperledger/indy-vdr-nodejs": "^0.2.0-dev.3", - "@hyperledger/indy-vdr-shared": "^0.2.0-dev.3", + "@hyperledger/indy-vdr-nodejs": "^0.2.0-dev.5", + "@hyperledger/indy-vdr-shared": "^0.2.0-dev.5", "@stablelib/ed25519": "^1.0.2", "@types/ref-array-di": "^1.2.6", "@types/ref-struct-di": "^1.1.10", @@ -38,6 +38,6 @@ "typescript": "~4.9.5" }, "peerDependencies": { - "@hyperledger/indy-vdr-shared": "^0.2.0-dev.3" + "@hyperledger/indy-vdr-shared": "^0.2.0-dev.5" } } diff --git a/packages/indy-vdr/src/anoncreds/IndyVdrAnonCredsRegistry.ts b/packages/indy-vdr/src/anoncreds/IndyVdrAnonCredsRegistry.ts index fbfaa49a0a..4a83e318df 100644 --- a/packages/indy-vdr/src/anoncreds/IndyVdrAnonCredsRegistry.ts +++ b/packages/indy-vdr/src/anoncreds/IndyVdrAnonCredsRegistry.ts @@ -444,11 +444,11 @@ export class IndyVdrAnonCredsRegistry implements AnonCredsRegistry { revocationRegistryDefinitionId: string ): Promise { try { - const indySdkPoolService = agentContext.dependencyManager.resolve(IndyVdrPoolService) + const indyVdrPoolService = agentContext.dependencyManager.resolve(IndyVdrPoolService) const { did, namespaceIdentifier, credentialDefinitionTag, revocationRegistryTag, schemaSeqNo } = parseIndyRevocationRegistryId(revocationRegistryDefinitionId) - const { pool } = await indySdkPoolService.getPoolForDid(agentContext, did) + const { pool } = await indyVdrPoolService.getPoolForDid(agentContext, did) agentContext.config.logger.debug( `Using ledger '${pool.indyNamespace}' to retrieve revocation registry definition '${revocationRegistryDefinitionId}'` @@ -555,11 +555,11 @@ export class IndyVdrAnonCredsRegistry implements AnonCredsRegistry { timestamp: number ): Promise { try { - const indySdkPoolService = agentContext.dependencyManager.resolve(IndyVdrPoolService) + const indyVdrPoolService = agentContext.dependencyManager.resolve(IndyVdrPoolService) const { did, namespaceIdentifier, schemaSeqNo, credentialDefinitionTag, revocationRegistryTag } = parseIndyRevocationRegistryId(revocationRegistryId) - const { pool } = await indySdkPoolService.getPoolForDid(agentContext, did) + const { pool } = await indyVdrPoolService.getPoolForDid(agentContext, did) agentContext.config.logger.debug( `Using ledger '${pool.indyNamespace}' to retrieve revocation registry deltas with revocation registry definition id '${revocationRegistryId}' until ${timestamp}` diff --git a/packages/indy-vdr/src/anoncreds/utils/identifiers.ts b/packages/indy-vdr/src/anoncreds/utils/identifiers.ts index 1e9d6a8fd3..9c0afcd960 100644 --- a/packages/indy-vdr/src/anoncreds/utils/identifiers.ts +++ b/packages/indy-vdr/src/anoncreds/utils/identifiers.ts @@ -1,8 +1,3 @@ -/** - * NOTE: this file is availalbe in both the indy-sdk and indy-vdr packages. If making changes to - * this file, make sure to update both files if applicable. - */ - import { unqualifiedSchemaIdRegex, unqualifiedCredentialDefinitionIdRegex, diff --git a/packages/indy-vdr/src/dids/__tests__/IndyVdrIndyDidRegistrar.test.ts b/packages/indy-vdr/src/dids/__tests__/IndyVdrIndyDidRegistrar.test.ts index a3762dc96b..ee80d713e5 100644 --- a/packages/indy-vdr/src/dids/__tests__/IndyVdrIndyDidRegistrar.test.ts +++ b/packages/indy-vdr/src/dids/__tests__/IndyVdrIndyDidRegistrar.test.ts @@ -21,8 +21,8 @@ import { import { Subject } from 'rxjs' import { InMemoryStorageService } from '../../../../../tests/InMemoryStorageService' -import { agentDependencies, getAgentConfig, getAgentContext, indySdk, mockProperty } from '../../../../core/tests' -import { IndySdkWallet } from '../../../../indy-sdk/src' +import { RegisteredAskarTestWallet } from '../../../../askar/tests/helpers' +import { agentDependencies, getAgentConfig, getAgentContext, mockProperty } from '../../../../core/tests' import { IndyVdrPool, IndyVdrPoolService } from '../../pool' import { IndyVdrIndyDidRegistrar } from '../IndyVdrIndyDidRegistrar' @@ -33,7 +33,11 @@ mockProperty(poolMock, 'indyNamespace', 'ns1') const agentConfig = getAgentConfig('IndyVdrIndyDidRegistrar') -const wallet = new IndySdkWallet(indySdk, agentConfig.logger, new SigningProviderRegistry([])) +const wallet = new RegisteredAskarTestWallet( + agentConfig.logger, + new agentDependencies.FileSystem(), + new SigningProviderRegistry([]) +) jest .spyOn(wallet, 'createKey') 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 c98a807b91..310bd0a3f1 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 @@ -10,9 +10,8 @@ import { RevocationRegistryEntryRequest, } from '@hyperledger/indy-vdr-shared' +import { askarModule } from '../../askar/tests/helpers' import { agentDependencies, getAgentConfig, importExistingIndyDidFromPrivateKey } from '../../core/tests/helpers' -import { IndySdkModule } from '../../indy-sdk/src' -import { indySdk } from '../../indy-sdk/tests/setupIndySdkModule' import { IndyVdrIndyDidResolver, IndyVdrModule, IndyVdrSovDidResolver } from '../src' import { IndyVdrAnonCredsRegistry } from '../src/anoncreds/IndyVdrAnonCredsRegistry' import { IndyVdrIndyDidRegistrar } from '../src/dids/IndyVdrIndyDidRegistrar' @@ -35,9 +34,7 @@ const endorser = new Agent({ indyVdr, networks: indyVdrModuleConfig.networks, }), - indySdk: new IndySdkModule({ - indySdk, - }), + askar: askarModule, dids: new DidsModule({ registrars: [new IndyVdrIndyDidRegistrar()], resolvers: [new IndyVdrSovDidResolver(), new IndyVdrIndyDidResolver()], @@ -53,9 +50,7 @@ const agent = new Agent({ indyVdr, networks: indyVdrModuleConfig.networks, }), - indySdk: new IndySdkModule({ - indySdk, - }), + asakar: askarModule, dids: new DidsModule({ registrars: [new IndyVdrIndyDidRegistrar()], resolvers: [new IndyVdrSovDidResolver(), new IndyVdrIndyDidResolver()], 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 526391871f..51e2b0d428 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 @@ -15,10 +15,9 @@ import { import { indyVdr } from '@hyperledger/indy-vdr-nodejs' import { convertPublicKeyToX25519, generateKeyPairFromSeed } from '@stablelib/ed25519' +import { askarModule } from '../../askar/tests/helpers' import { sleep } from '../../core/src/utils/sleep' import { getAgentOptions, importExistingIndyDidFromPrivateKey } from '../../core/tests/helpers' -import { IndySdkModule } from '../../indy-sdk/src' -import { indySdk } from '../../indy-sdk/tests/setupIndySdkModule' import { IndyVdrModule, IndyVdrSovDidResolver } from '../src' import { IndyVdrIndyDidRegistrar } from '../src/dids/IndyVdrIndyDidRegistrar' import { IndyVdrIndyDidResolver } from '../src/dids/IndyVdrIndyDidResolver' @@ -35,9 +34,7 @@ const endorser = new Agent( networks: indyVdrModuleConfig.networks, indyVdr, }), - indySdk: new IndySdkModule({ - indySdk, - }), + askar: askarModule, dids: new DidsModule({ registrars: [new IndyVdrIndyDidRegistrar()], resolvers: [new IndyVdrIndyDidResolver(), new IndyVdrSovDidResolver()], @@ -54,9 +51,7 @@ const agent = new Agent( indyVdr, networks: indyVdrModuleConfig.networks, }), - indySdk: new IndySdkModule({ - indySdk, - }), + askar: askarModule, dids: new DidsModule({ registrars: [new IndyVdrIndyDidRegistrar()], resolvers: [new IndyVdrIndyDidResolver(), new IndyVdrSovDidResolver()], 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 92068e5690..69dc27891d 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,9 +1,8 @@ import { DidsModule, Agent, TypedArrayEncoder, JsonTransformer } from '@aries-framework/core' import { indyVdr } from '@hyperledger/indy-vdr-nodejs' +import { askarModule } from '../../askar/tests/helpers' import { getAgentOptions, importExistingIndyDidFromPrivateKey } from '../../core/tests/helpers' -import { IndySdkModule } from '../../indy-sdk/src' -import { indySdk } from '../../indy-sdk/tests/setupIndySdkModule' import { IndyVdrModule } from '../src' import { IndyVdrIndyDidRegistrar, IndyVdrIndyDidResolver, IndyVdrSovDidResolver } from '../src/dids' @@ -18,9 +17,7 @@ const agent = new Agent( indyVdr, networks: indyVdrModuleConfig.networks, }), - indySdk: new IndySdkModule({ - indySdk, - }), + askar: askarModule, dids: new DidsModule({ registrars: [new IndyVdrIndyDidRegistrar()], resolvers: [new IndyVdrIndyDidResolver(), new IndyVdrSovDidResolver()], 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 cc987e7888..370cdc68a0 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 @@ -2,9 +2,8 @@ import { parseIndyDid } from '@aries-framework/anoncreds' import { DidsModule, Agent, TypedArrayEncoder, JsonTransformer } from '@aries-framework/core' import { indyVdr } from '@hyperledger/indy-vdr-nodejs' +import { askarModule } from '../../askar/tests/helpers' import { getAgentOptions, importExistingIndyDidFromPrivateKey } from '../../core/tests/helpers' -import { IndySdkModule } from '../../indy-sdk/src' -import { indySdk } from '../../indy-sdk/tests/setupIndySdkModule' import { IndyVdrModule } from '../src' import { IndyVdrIndyDidRegistrar, IndyVdrIndyDidResolver, IndyVdrSovDidResolver } from '../src/dids' @@ -19,9 +18,7 @@ const agent = new Agent( indyVdr, networks: indyVdrModuleConfig.networks, }), - indySdk: new IndySdkModule({ - indySdk, - }), + askar: askarModule, dids: new DidsModule({ registrars: [new IndyVdrIndyDidRegistrar()], resolvers: [new IndyVdrIndyDidResolver(), new IndyVdrSovDidResolver()], diff --git a/packages/tenants/src/__tests__/TenantAgent.test.ts b/packages/tenants/src/__tests__/TenantAgent.test.ts index 1c3bb05cc3..70172cf17b 100644 --- a/packages/tenants/src/__tests__/TenantAgent.test.ts +++ b/packages/tenants/src/__tests__/TenantAgent.test.ts @@ -1,8 +1,7 @@ import { Agent, AgentContext } from '@aries-framework/core' -import { indySdk } from '../../../core/tests' +import { askarModule } from '../../../askar/tests/helpers' import { agentDependencies, getAgentConfig, getAgentContext } from '../../../core/tests/helpers' -import { IndySdkModule } from '../../../indy-sdk/src' import { TenantAgent } from '../TenantAgent' describe('TenantAgent', () => { @@ -17,7 +16,7 @@ describe('TenantAgent', () => { }, dependencies: agentDependencies, modules: { - indySdk: new IndySdkModule({ indySdk }), + askar: askarModule, }, }) diff --git a/packages/tenants/src/__tests__/TenantsApi.test.ts b/packages/tenants/src/__tests__/TenantsApi.test.ts index 213e0cfda3..80d506631d 100644 --- a/packages/tenants/src/__tests__/TenantsApi.test.ts +++ b/packages/tenants/src/__tests__/TenantsApi.test.ts @@ -1,7 +1,7 @@ import { Agent, AgentContext, InjectionSymbols } from '@aries-framework/core' -import { indySdk, getAgentContext, getAgentOptions, mockFunction } from '../../../core/tests' -import { IndySdkModule } from '../../../indy-sdk/src' +import { askarModule } from '../../../askar/tests/helpers' +import { getAgentContext, getAgentOptions, mockFunction } from '../../../core/tests' import { TenantAgent } from '../TenantAgent' import { TenantsApi } from '../TenantsApi' import { TenantAgentContextProvider } from '../context/TenantAgentContextProvider' @@ -16,7 +16,7 @@ const AgentContextProviderMock = TenantAgentContextProvider as jest.Mock