Skip to content
Snippets Groups Projects
Commit 501d12d4 authored by Berend Sliedrecht's avatar Berend Sliedrecht
Browse files

fix: resolved merge issues


Signed-off-by: default avatarBerend Sliedrecht <berend@animo.id>
parent a48e1cd4
No related branches found
No related tags found
2 merge requests!37Draft: Modifications for manual testing,!25feat(ssi): revocation ssi-abstraction
Showing
with 59 additions and 72 deletions
......@@ -49,6 +49,7 @@ import { LEDGERS } from '../config/ledger.js';
import { AgentLogger } from './logger.js';
export type TenantAgent = Agent<Omit<AgentService['modules'], 'tenants'>>;
export type AppAgent = Agent<AgentService['modules']>;
@Injectable()
......
import { Controller } from '@nestjs/common';
import { MessagePattern } from '@nestjs/microservices';
import {
EventAnonCredsCredentialOfferGetAll,
EventAnonCredsCredentialOfferGetAllInput,
EventAnonCredsCredentialOfferGetById,
EventAnonCredsCredentialOfferGetByIdInput,
EventAnonCredsCredentialRequestGetAll,
EventAnonCredsCredentialRequestGetAllInput,
EventAnonCredsCredentialRequestGetById,
EventAnonCredsCredentialRequestGetByIdInput,
EventAnonCredsCredentialsDeleteById,
......@@ -33,6 +37,26 @@ export class AnonCredsCredentialsController {
);
}
@MessagePattern(EventAnonCredsCredentialOfferGetAll.token)
public async getAllOffers(
options: EventAnonCredsCredentialOfferGetAllInput,
): Promise<EventAnonCredsCredentialOfferGetAll> {
return new EventAnonCredsCredentialOfferGetAll(
await this.credentialsService.getAllOffers(options),
options.tenantId,
);
}
@MessagePattern(EventAnonCredsCredentialRequestGetAll.token)
public async getAllRequests(
options: EventAnonCredsCredentialRequestGetAllInput,
): Promise<EventAnonCredsCredentialRequestGetAll> {
return new EventAnonCredsCredentialRequestGetAll(
await this.credentialsService.getAllRequests(options),
options.tenantId,
);
}
@MessagePattern(EventAnonCredsCredentialsGetById.token)
public async getById(
options: EventAnonCredsCredentialsGetByIdInput,
......
......@@ -75,6 +75,7 @@ describe('CredentialDefinitionsController', () => {
.mockResolvedValue(result);
const event = await credentialDefinitionsController.register({
supportsRevocation: false,
tenantId: 'some-tenant-id',
tag: 'some-tag',
issuerDid: 'did:indy:issuer',
......
......@@ -43,6 +43,10 @@ describe('RevocationController', () => {
const event =
await revocationController.registerRevocationRegistryDefinition({
tag: 'rev_tag',
issuerDid: 'did:me',
credentialDefinitionId: 'some:cred:id',
maximumCredentialNumber: 100,
tenantId: 'some-id',
});
......@@ -61,6 +65,7 @@ describe('RevocationController', () => {
const event = await revocationController.registerRevocationStatusList({
tenantId: 'some-id',
revocationRegistryDefinitionId: 'some-fake-id',
issuerDid: 'did:me',
});
expect(event.data).toStrictEqual(result);
......
......@@ -62,7 +62,7 @@ export class RevocationService {
);
}
const timestamp = new Date().getTime() / 1000;
const timestamp = Math.floor(Date.now() / 1000);
const { revocationStatusList } =
await t.modules.anoncreds.getRevocationStatusList(
metadata.revocationRegistryId,
......@@ -85,24 +85,9 @@ export class RevocationService {
);
}
const newRevokedIndices = revocationStatusList.revocationList
.filter(
(state, idx) =>
state === 1 || idx === Number(metadata.credentialRevocationId),
)
.map((_, idx) => idx);
const newIssuedIndices = revocationStatusList.revocationList
.filter(
(state, idx) =>
state === 0 && idx !== Number(metadata.credentialRevocationId),
)
.map((_, idx) => idx);
const result = await t.modules.anoncreds.updateRevocationStatusList({
revocationRegistryDefinitionId: metadata.revocationRegistryId,
revokedCredentialIndexes: newRevokedIndices,
issuedCredentialIndexes: newIssuedIndices,
revokedCredentialIndexes: [Number(metadata.credentialRevocationId)],
});
if (result.revocationStatusListState.state !== 'finished') {
......
import type { AppAgent } from './agent.service.js';
import type { AppAgent, TenantAgent } from './agent.service.js';
import { Injectable } from '@nestjs/common';
......@@ -14,7 +14,7 @@ export class WithTenantService {
public invoke<T>(
tenantId: string,
cb: (tenant: AppAgent) => Promise<T>,
cb: (tenant: TenantAgent) => Promise<T>,
): Promise<T> {
// eslint-disable-next-line no-async-promise-executor
return new Promise<T>(async (resolve, reject) => {
......@@ -22,7 +22,7 @@ export class WithTenantService {
{ tenantId },
async (tenant) => {
try {
const ret = await cb(tenant as unknown as AppAgent);
const ret = await cb(tenant as unknown as TenantAgent);
resolve(ret);
} catch (e) {
reject(e);
......
......@@ -94,17 +94,18 @@ describe('Credentials', () => {
issuerDid,
tenantId,
name: 'test-schema-name',
version: `1.${new Date().getTime()}`,
version: `1.${Date.now()}`,
attributeNames: ['Name', 'Age'],
});
const credentialDefinitionService = app.get(CredentialDefinitionsService);
const { credentialDefinitionId: cdi } =
await credentialDefinitionService.register({
supportsRevocation: false,
tenantId,
issuerDid,
schemaId,
tag: `default-${new Date().getTime()}`,
tag: `default-${Date.now()}`,
});
credentialDefinitionId = cdi;
......
......@@ -58,7 +58,7 @@ describe('Proofs', () => {
await client.connect();
const tenantsService = app.get(TenantsService);
const { id: tId } = await tenantsService.create(TOKEN);
const { id: tId } = await tenantsService.create({ label: TOKEN });
tenantId = tId;
const connectionsService = app.get(ConnectionsService);
......
......@@ -73,7 +73,7 @@ describe('CredentialDefinitions', () => {
issuerDid,
tenantId,
name: 'test-schema-name',
version: `1.${new Date().getTime()}`,
version: `1.${Date.now()}`,
attributeNames: ['none'],
});
schemaId = sid;
......@@ -112,11 +112,12 @@ describe('CredentialDefinitions', () => {
});
it(EventAnonCredsCredentialDefinitionsRegister.token, async () => {
const tag = `tag:${new Date().getTime()}`;
const tag = `tag:${Date.now()}`;
const response$ = client.send<
EventAnonCredsCredentialDefinitionsRegister,
EventAnonCredsCredentialDefinitionsRegisterInput
>(EventAnonCredsCredentialDefinitionsRegister.token, {
supportsRevocation: false,
tenantId,
schemaId,
issuerDid,
......
......@@ -89,7 +89,7 @@ describe('Dids', () => {
EventDidsDidConfigurationInput
>(EventDidsDidConfiguration.token, {
domain: 'https://example.org',
expiryTime: new Date().getTime() / 1000 + 3600,
expiryTime: Date.now() / 1000 + 3600,
tenantId,
});
......
......@@ -92,7 +92,7 @@ describe('Schemas', () => {
});
it(EventAnonCredsSchemasRegister.token, async () => {
const version = `1.${new Date().getTime()}`;
const version = `1.${Date.now()}`;
const attributeNames = ['names', 'age'];
const name = 'my-schema';
const response$ = client.send<
......
......@@ -453,9 +453,14 @@ importers:
specifier: 0.5.0-alpha.87
version: 0.5.0-alpha.87(expo@49.0.21)(react-native@0.73.2)
'@aries-framework/tenants':
<<<<<<< HEAD
specifier: ^0.5.0-alpha.87
version: 0.5.0-alpha.91(expo@49.0.21)(react-native@0.73.2)
>>>>>>> b235c33 (chore(ssi): update AFJ to latest alpha release)
=======
specifier: 0.5.0-alpha.87
version: 0.5.0-alpha.87(expo@49.0.21)(react-native@0.73.2)
>>>>>>> 63efb70 (fix: resolved merge issues)
'@elastic/ecs-winston-format':
specifier: ^1.5.0
version: 1.5.2
......@@ -577,9 +582,14 @@ importers:
specifier: 0.5.0-alpha.87
version: 0.5.0-alpha.87(expo@49.0.21)(react-native@0.73.2)
'@aries-framework/tenants':
<<<<<<< HEAD
specifier: ^0.5.0-alpha.87
version: 0.5.0-alpha.91(expo@49.0.21)(react-native@0.73.2)
>>>>>>> b235c33 (chore(ssi): update AFJ to latest alpha release)
=======
specifier: 0.5.0-alpha.87
version: 0.5.0-alpha.87(expo@49.0.21)(react-native@0.73.2)
>>>>>>> 63efb70 (fix: resolved merge issues)
'@elastic/ecs-winston-format':
specifier: ^1.5.0
version: 1.5.2
......@@ -892,47 +902,6 @@ packages:
- web-streams-polyfill
dev: false
 
/@aries-framework/core@0.5.0-alpha.91(expo@49.0.21)(react-native@0.73.2):
resolution: {integrity: sha512-CHb1J2oLfM2FSc323B2oL1Jm2uUfCrYx0JdyP5mR8AJlZQggFtzwNhe1kaEVj/IX8x5em/LC4s8zEEvsWb+NOA==}
dependencies:
'@digitalcredentials/jsonld': 5.2.2(expo@49.0.21)(react-native@0.73.2)
'@digitalcredentials/jsonld-signatures': 9.3.2(expo@49.0.21)(react-native@0.73.2)
'@digitalcredentials/vc': 1.1.2(expo@49.0.21)(react-native@0.73.2)
'@multiformats/base-x': 4.0.1
'@sphereon/pex': 2.2.2
'@sphereon/pex-models': 2.1.5
'@sphereon/ssi-types': 0.17.5
'@stablelib/ed25519': 1.0.3
'@stablelib/random': 1.0.2
'@stablelib/sha256': 1.0.1
'@types/ws': 8.5.10
abort-controller: 3.0.0
big-integer: 1.6.52
borc: 3.0.0
buffer: 6.0.3
class-transformer: 0.5.1
class-validator: 0.14.0
did-resolver: 4.1.0
jsonpath: 1.1.1
lru_map: 0.4.1
luxon: 3.4.4
make-error: 1.3.6
object-inspect: 1.13.1
query-string: 7.1.3
reflect-metadata: 0.1.14
rxjs: 7.8.1
tsyringe: 4.8.0
uuid: 9.0.1
varint: 6.0.0
web-did-resolver: 2.0.27
transitivePeerDependencies:
- domexception
- encoding
- expo
- react-native
- web-streams-polyfill
dev: false
/@aries-framework/indy-vdr@0.5.0-alpha.87(@hyperledger/indy-vdr-shared@0.2.0-dev.6)(expo@49.0.21)(react-native@0.73.2):
resolution: {integrity: sha512-rj3hqrq2MggqKp8P06edyTXWINKrtcXpFSFd4jG8Ttr5ObR9vdya0G7EdFT7tKHtGkqD8/qbyDF2D7woZMFEkg==}
peerDependencies:
......@@ -969,10 +938,10 @@ packages:
- web-streams-polyfill
dev: false
 
/@aries-framework/tenants@0.5.0-alpha.91(expo@49.0.21)(react-native@0.73.2):
resolution: {integrity: sha512-ezAn+6J8AqL/hXiks6ZXbMznJf8PnXcGbQ1IwFzOqaEeZHDxW4PNa4dMlccg/rcbOTVEZW8SG672gMFYtMkwpw==}
/@aries-framework/tenants@0.5.0-alpha.87(expo@49.0.21)(react-native@0.73.2):
resolution: {integrity: sha512-txx2hZjQ5lpcS+vbfaw9ZTNF+SA1DfYuLmGwjdVMNUmMxlCr8siks4MV1h194dGecC53w44Ab+H6AozvRDktog==}
dependencies:
'@aries-framework/core': 0.5.0-alpha.91(expo@49.0.21)(react-native@0.73.2)
'@aries-framework/core': 0.5.0-alpha.87(expo@49.0.21)(react-native@0.73.2)
async-mutex: 0.4.0
transitivePeerDependencies:
- domexception
......@@ -4615,7 +4584,7 @@ packages:
dependencies:
'@nestjs/axios': 3.0.1(@nestjs/common@10.3.0)(axios@1.6.5)(reflect-metadata@0.1.14)(rxjs@7.8.1)
'@nestjs/common': 10.3.0(class-transformer@0.5.1)(class-validator@0.14.1)(reflect-metadata@0.1.14)(rxjs@7.8.1)
'@nestjs/core': 10.3.0(@nestjs/common@10.3.0)(@nestjs/microservices@10.3.0)(reflect-metadata@0.1.14)(rxjs@7.8.1)
'@nestjs/core': 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': 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)
boxen: 5.1.2
check-disk-space: 3.4.0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment