diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e2710087b58717b09b70fc06c2caf5bd4145ed2..440e166a2aa5843f06d06b27f243250762ad0710 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,3 +1,9 @@ +include: +- project: 'eclipse/xfsc/dev-ops/ci-templates' + file: 'helm-build-ci.yaml' + ref: main + + variables: DOCKERFILE: Dockerfile TAG: ${HARBOR_HOST}/${HARBOR_PROJECT}/$SERVICE diff --git a/apps/ssi-abstraction/src/agent/connections/connections.service.ts b/apps/ssi-abstraction/src/agent/connections/connections.service.ts index 776cbeb0ad6cb28c6d0d49b597a6d2fde9038290..5440faeea6464234665281b72b1f5c73fec6758c 100644 --- a/apps/ssi-abstraction/src/agent/connections/connections.service.ts +++ b/apps/ssi-abstraction/src/agent/connections/connections.service.ts @@ -154,7 +154,6 @@ export class ConnectionsService { trusted: true, withSelf: true, }); - const connRepo = t.dependencyManager.resolve(ConnectionRepository); await connRepo.update(t.context, connectionRecord); } diff --git a/apps/ssi-abstraction/test/anoncredsCredentials.e2e-spec.ts b/apps/ssi-abstraction/test/anoncredsCredentials.e2e-spec.ts index 9e1793d72a99918c2508fb67ef0a96467dad3906..506d439e29e1b36e9a87cc505f43031d4575345c 100644 --- a/apps/ssi-abstraction/test/anoncredsCredentials.e2e-spec.ts +++ b/apps/ssi-abstraction/test/anoncredsCredentials.e2e-spec.ts @@ -9,10 +9,17 @@ import type { EventAnonCredsCredentialsDeleteByIdInput, EventAnonCredsCredentialsGetAllInput, EventAnonCredsCredentialsGetByIdInput, + EventDidcommAnonCredsCredentialsAcceptOffer, + EventDidcommAnonCredsCredentialsAcceptOfferInput, + EventDidcommAnonCredsCredentialsOfferInput, EventDidcommAnonCredsCredentialsOfferToSelfInput, } from '@ocm/shared'; -import { AutoAcceptCredential, CredentialExchangeRecord } from '@credo-ts/core'; +import { + AutoAcceptCredential, + CredentialExchangeRecord, + CredentialState, +} from '@credo-ts/core'; import { ClientsModule, Transport } from '@nestjs/microservices'; import { Test } from '@nestjs/testing'; import { @@ -24,6 +31,7 @@ import { EventAnonCredsCredentialsGetAll, EventAnonCredsCredentialsGetById, EventAnonCredsProofsDeleteById, + EventDidcommAnonCredsCredentialsOffer, EventDidcommAnonCredsCredentialsOfferToSelf, } from '@ocm/shared'; import { randomBytes } from 'crypto'; @@ -52,6 +60,7 @@ describe.skip('Credentials', () => { let issuerDid: string; let credentialDefinitionId: string; + let connectionId: string; beforeAll(async () => { const moduleRef = await Test.createTestingModule({ @@ -138,6 +147,18 @@ describe.skip('Credentials', () => { }); credentialDefinitionId = cdi; + + const connectionService = app.get(ConnectionsService); + const { invitationUrl } = await connectionService.createInvitation({ + tenantId, + }); + + const { id: cId } = await connectionService.receiveInvitationFromUrl({ + tenantId, + invitationUrl, + }); + + connectionId = cId; }); afterAll(async () => { @@ -224,6 +245,45 @@ describe.skip('Credentials', () => { expect(eventInstance.instance).toEqual(null); }); + it(EventDidcommAnonCredsCredentialsOffer.token, async () => { + const attributes = [ + { name: 'Name', value: 'Berend' }, + { name: 'Age', value: '25' }, + ]; + + const response$ = client.send< + EventDidcommAnonCredsCredentialsOffer, + EventDidcommAnonCredsCredentialsOfferInput + >(EventDidcommAnonCredsCredentialsOffer.token, { + tenantId, + connectionId, + attributes, + credentialDefinitionId, + }); + + const response = await firstValueFrom(response$); + const eventInstance = + EventDidcommAnonCredsCredentialsOffer.fromEvent(response); + + await new Promise((r) => setTimeout(r, 2000)); + + const acceptResponse$ = client.send< + EventDidcommAnonCredsCredentialsAcceptOffer, + EventDidcommAnonCredsCredentialsAcceptOfferInput + >(EventDidcommAnonCredsCredentialsOffer.token, { + tenantId, + credentialId: eventInstance.instance.id, + }); + + const acceptResponse = await firstValueFrom(acceptResponse$); + const acceptEventInstance = + EventAnonCredsCredentialsGetById.fromEvent(acceptResponse); + + expect(acceptEventInstance.instance).toMatchObject({ + state: CredentialState.RequestSent, + }); + }); + it(EventDidcommAnonCredsCredentialsOfferToSelf.token, async () => { const attributes = [ { name: 'Name', value: 'Berend' }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 16d5c452c74284ea04c50e79bad5b8c19ab398e9..d7531fcbd90cf285ba4735a6b2e9477f2c61f096 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -318,6 +318,88 @@ importers: specifier: 5.3.3 version: 5.3.3 + apps/did-manager: + dependencies: + '@nestjs/common': + specifier: ^10.3.0 + version: 10.3.0(class-transformer@0.5.1)(class-validator@0.14.1)(reflect-metadata@0.1.14)(rxjs@7.8.1) + '@nestjs/config': + specifier: ^3.1.1 + version: 3.1.1(@nestjs/common@10.3.0)(reflect-metadata@0.1.14) + '@nestjs/core': + specifier: ^10.3.0 + version: 10.3.0(@nestjs/common@10.3.0)(@nestjs/microservices@10.3.0)(@nestjs/platform-express@10.3.0)(reflect-metadata@0.1.14)(rxjs@7.8.1) + '@nestjs/microservices': + specifier: ^10.3.0 + version: 10.3.0(@nestjs/common@10.3.0)(@nestjs/core@10.3.0)(nats@2.19.0)(reflect-metadata@0.1.14)(rxjs@7.8.1) + '@nestjs/platform-express': + specifier: ^10.3.0 + version: 10.3.0(@nestjs/common@10.3.0)(@nestjs/core@10.3.0) + '@nestjs/swagger': + specifier: ^7.2.0 + version: 7.2.0(@nestjs/common@10.3.0)(@nestjs/core@10.3.0)(class-transformer@0.5.1)(class-validator@0.14.1)(reflect-metadata@0.1.14) + '@ocm/shared': + specifier: workspace:* + version: link:../shared + class-transformer: + specifier: ^0.5.1 + version: 0.5.1 + class-validator: + specifier: ^0.14.0 + version: 0.14.1 + express: + specifier: ^4.17.3 + version: 4.18.2 + joi: + specifier: ^17.11.0 + version: 17.11.1 + nats: + specifier: ^2.18.0 + version: 2.19.0 + reflect-metadata: + specifier: ^0.1.13 + version: 0.1.14 + rxjs: + specifier: ^7.8.1 + version: 7.8.1 + devDependencies: + '@nestjs/cli': + specifier: ^10.3.0 + version: 10.3.0(@swc/cli@0.1.63)(@swc/core@1.3.103) + '@nestjs/schematics': + specifier: ^10.1.0 + version: 10.1.0(chokidar@3.5.3)(typescript@5.3.3) + '@nestjs/testing': + specifier: ^10.3.0 + version: 10.3.0(@nestjs/common@10.3.0)(@nestjs/core@10.3.0)(@nestjs/microservices@10.3.0)(@nestjs/platform-express@10.3.0) + '@swc/cli': + specifier: ^0.1.62 + version: 0.1.63(@swc/core@1.3.103) + '@swc/core': + specifier: ^1.3.96 + version: 1.3.103 + '@swc/jest': + specifier: ^0.2.29 + version: 0.2.29(@swc/core@1.3.103) + '@types/express': + specifier: ^4.17.21 + version: 4.17.21 + '@types/jest': + specifier: ^29.5.8 + version: 29.5.11 + '@types/node': + specifier: ^20.9.0 + version: 20.11.5 + jest: + specifier: ^29.7.0 + version: 29.7.0(@types/node@20.11.5)(ts-node@10.9.2) + rimraf: + specifier: ^5.0.5 + version: 5.0.5 + typescript: + specifier: ^5.3.2 + version: 5.3.3 + apps/proof-manager: dependencies: '@nestjs/common':