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

fix(ssi-abstraction): add endorsement for the revocation status list


Signed-off-by: default avatarBerend Sliedrecht <berend@animo.id>
parent 1ca3cf43
No related branches found
No related tags found
No related merge requests found
Pipeline #41272 failed
...@@ -143,23 +143,46 @@ export class RevocationService { ...@@ -143,23 +143,46 @@ export class RevocationService {
}: EventAnonCredsRevocationRegisterRevocationStatusListInput): Promise< }: EventAnonCredsRevocationRegisterRevocationStatusListInput): Promise<
EventAnonCredsRevocationRegisterRevocationStatusList['data'] EventAnonCredsRevocationRegisterRevocationStatusList['data']
> { > {
const endorserDid = await this.agentService.getEndorserDid(issuerDid);
return this.withTenantService.invoke(tenantId, async (t) => { return this.withTenantService.invoke(tenantId, async (t) => {
const result = await t.modules.anoncreds.registerRevocationStatusList({ const { revocationStatusListState } =
options: {}, await t.modules.anoncreds.registerRevocationStatusList({
revocationStatusList: { options: {
revocationRegistryDefinitionId, endorserMode: 'external',
issuerId: issuerDid, endorserDid,
}, },
}); revocationStatusList: {
revocationRegistryDefinitionId,
issuerId: issuerDid,
},
});
if (result.revocationStatusListState.state !== 'finished') { if (
revocationStatusListState.state !== 'action' ||
revocationStatusListState.action !== 'endorseIndyTransaction'
) {
throw new Error( throw new Error(
`Error registering the revocation status list. Error: ${JSON.stringify( `Error registering revocation registry definition: ${
result, revocationStatusListState.state === 'failed'
)}`, ? revocationStatusListState.reason
: 'Not Finished'
}`,
); );
} }
const signedRevocationRegistryDefinitionRequest =
await this.agentService.endorseTransaction(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
revocationStatusListState.revocationStatusListRequest,
endorserDid,
);
await t.modules.indyVdr.submitTransaction(
signedRevocationRegistryDefinitionRequest,
issuerDid,
);
return {}; return {};
}); });
} }
......
...@@ -29,7 +29,6 @@ import { ...@@ -29,7 +29,6 @@ import {
import { randomBytes } from 'crypto'; import { randomBytes } from 'crypto';
import { firstValueFrom } from 'rxjs'; import { firstValueFrom } from 'rxjs';
import { natsConfig } from '../dist/config/nats.config.js';
import { AgentModule } from '../src/agent/agent.module.js'; import { AgentModule } from '../src/agent/agent.module.js';
import { AnonCredsCredentialsModule } from '../src/agent/anoncredsCredentials/anoncredsCredentials.module.js'; import { AnonCredsCredentialsModule } from '../src/agent/anoncredsCredentials/anoncredsCredentials.module.js';
import { ConnectionsModule } from '../src/agent/connections/connections.module.js'; import { ConnectionsModule } from '../src/agent/connections/connections.module.js';
...@@ -43,8 +42,9 @@ import { SchemasService } from '../src/agent/schemas/schemas.service.js'; ...@@ -43,8 +42,9 @@ import { SchemasService } from '../src/agent/schemas/schemas.service.js';
import { TenantsModule } from '../src/agent/tenants/tenants.module.js'; import { TenantsModule } from '../src/agent/tenants/tenants.module.js';
import { TenantsService } from '../src/agent/tenants/tenants.service.js'; import { TenantsService } from '../src/agent/tenants/tenants.service.js';
import { mockConfigModule } from '../src/config/__tests__/mockConfig.js'; import { mockConfigModule } from '../src/config/__tests__/mockConfig.js';
import { natsConfig } from '../src/config/nats.config.js';
describe.skip('Revocation', () => { describe('Revocation', () => {
const TOKEN = 'REVOCATION_CLIENT_SERVICE'; const TOKEN = 'REVOCATION_CLIENT_SERVICE';
let app: INestApplication; let app: INestApplication;
let client: ClientProxy; let client: ClientProxy;
......
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