@verana-labs/vs-agent-nestjs-client 2.0.0-dev.7 → 2.0.0-dev.72
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -201
- package/build/app.module.js +26 -34
- package/build/app.module.js.map +1 -1
- package/build/connections/connection.entity.d.ts +4 -5
- package/build/connections/connection.entity.js +2 -10
- package/build/connections/connection.entity.js.map +1 -1
- package/build/connections/connection.repository.d.ts +6 -20
- package/build/connections/connection.repository.js +12 -40
- package/build/connections/connection.repository.js.map +1 -1
- package/build/connections/connection.service.d.ts +8 -17
- package/build/connections/connection.service.js +33 -54
- package/build/connections/connection.service.js.map +1 -1
- package/build/connections/index.d.ts +0 -2
- package/build/connections/index.js +0 -2
- package/build/connections/index.js.map +1 -1
- package/build/credentials/credential.entity.d.ts +1 -1
- package/build/credentials/credential.entity.js +1 -1
- package/build/credentials/credential.entity.js.map +1 -1
- package/build/credentials/credential.service.d.ts +22 -90
- package/build/credentials/credential.service.js +106 -205
- package/build/credentials/credential.service.js.map +1 -1
- package/build/credentials/index.d.ts +0 -1
- package/build/credentials/index.js +0 -1
- package/build/credentials/index.js.map +1 -1
- package/build/events.controller.d.ts +9 -0
- package/build/events.controller.js +47 -0
- package/build/events.controller.js.map +1 -0
- package/build/events.service.d.ts +12 -0
- package/build/events.service.js +80 -0
- package/build/events.service.js.map +1 -0
- package/build/index.d.ts +4 -3
- package/build/index.js +4 -3
- package/build/index.js.map +1 -1
- package/build/interfaces.d.ts +2 -28
- package/build/jms/index.d.ts +1 -1
- package/build/jms/index.js +4 -1
- package/build/jms/index.js.map +1 -1
- package/build/jms/stats-producer.service.d.ts +3 -4
- package/build/jms/stats-producer.service.js +3 -4
- package/build/jms/stats-producer.service.js.map +1 -1
- package/build/tokens.d.ts +3 -0
- package/build/tokens.js +7 -0
- package/build/tokens.js.map +1 -0
- package/build/types.d.ts +25 -53
- package/build/types.js +7 -1
- package/build/types.js.map +1 -1
- package/package.json +3 -9
- package/build/connections/connection.controller.d.ts +0 -10
- package/build/connections/connection.controller.js +0 -65
- package/build/connections/connection.controller.js.map +0 -1
- package/build/connections/connection.module.d.ts +0 -5
- package/build/connections/connection.module.js +0 -44
- package/build/connections/connection.module.js.map +0 -1
- package/build/credentials/credential.module.d.ts +0 -5
- package/build/credentials/credential.module.js +0 -34
- package/build/credentials/credential.module.js.map +0 -1
- package/build/jms/stats.module.d.ts +0 -5
- package/build/jms/stats.module.js +0 -34
- package/build/jms/stats.module.js.map +0 -1
- package/build/messages/index.d.ts +0 -3
- package/build/messages/index.js +0 -20
- package/build/messages/index.js.map +0 -1
- package/build/messages/message.controller.d.ts +0 -13
- package/build/messages/message.controller.js +0 -95
- package/build/messages/message.controller.js.map +0 -1
- package/build/messages/message.module.d.ts +0 -5
- package/build/messages/message.module.js +0 -41
- package/build/messages/message.module.js.map +0 -1
- package/build/messages/message.service.d.ts +0 -19
- package/build/messages/message.service.js +0 -104
- package/build/messages/message.service.js.map +0 -1
|
@@ -11,76 +11,55 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
|
-
var
|
|
14
|
+
var ConnectionsService_1;
|
|
15
15
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
-
exports.
|
|
17
|
-
const credo_ts_didcomm_mrtd_1 = require("@2060.io/credo-ts-didcomm-mrtd");
|
|
16
|
+
exports.ConnectionsService = void 0;
|
|
18
17
|
const common_1 = require("@nestjs/common");
|
|
19
|
-
const
|
|
20
|
-
const
|
|
18
|
+
const tokens_1 = require("../tokens");
|
|
19
|
+
const types_1 = require("../types");
|
|
21
20
|
const connection_repository_1 = require("./connection.repository");
|
|
22
|
-
let
|
|
21
|
+
let ConnectionsService = ConnectionsService_1 = class ConnectionsService {
|
|
23
22
|
constructor(options, repository, eventHandler) {
|
|
24
|
-
var _a;
|
|
25
|
-
this.options = options;
|
|
23
|
+
var _a, _b;
|
|
26
24
|
this.repository = repository;
|
|
27
25
|
this.eventHandler = eventHandler;
|
|
28
|
-
this.logger = new common_1.Logger(
|
|
29
|
-
|
|
26
|
+
this.logger = new common_1.Logger(ConnectionsService_1.name);
|
|
27
|
+
const connections = (_a = options.modules) === null || _a === void 0 ? void 0 : _a.connections;
|
|
28
|
+
this.requireProfile = typeof connections === 'object' ? ((_b = connections.requireProfile) !== null && _b !== void 0 ? _b : true) : true;
|
|
30
29
|
}
|
|
31
|
-
async
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
case vs_agent_model_1.ExtendedDidExchangeState.Completed:
|
|
40
|
-
const newConnection = new connection_entity_1.ConnectionEntity();
|
|
41
|
-
newConnection.id = event.connectionId;
|
|
42
|
-
newConnection.createdTs = event.timestamp;
|
|
43
|
-
newConnection.status = vs_agent_model_1.ExtendedDidExchangeState.Start;
|
|
44
|
-
newConnection.metadata = event.metadata;
|
|
45
|
-
await this.repository.create(newConnection);
|
|
46
|
-
break;
|
|
47
|
-
case vs_agent_model_1.ExtendedDidExchangeState.Terminated:
|
|
48
|
-
await this.repository.updateStatus(event.connectionId, event.state);
|
|
49
|
-
if (this.eventHandler) {
|
|
50
|
-
await this.eventHandler.closeConnection(event.connectionId);
|
|
51
|
-
}
|
|
52
|
-
break;
|
|
53
|
-
default:
|
|
54
|
-
break;
|
|
30
|
+
async handleStateUpdated(data, timestamp) {
|
|
31
|
+
if (data.state === 'completed' && data.previousState !== 'completed') {
|
|
32
|
+
await this.repository.create({
|
|
33
|
+
id: data.id,
|
|
34
|
+
status: types_1.ConnectionStatus.Start,
|
|
35
|
+
createdTs: new Date(timestamp),
|
|
36
|
+
});
|
|
37
|
+
await this.handleNewConnection(data.id);
|
|
55
38
|
}
|
|
56
|
-
|
|
39
|
+
else if (data.state === 'abandoned') {
|
|
40
|
+
const existed = await this.repository.updateStatus(data.id, types_1.ConnectionStatus.Terminated);
|
|
41
|
+
if (existed)
|
|
42
|
+
await this.eventHandler.closeConnection(data.id);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async handleProfileReceived(data) {
|
|
46
|
+
await this.repository.create({ id: data.connectionId, status: types_1.ConnectionStatus.Start });
|
|
47
|
+
await this.repository.updateUserProfile(data.connectionId, data.profile);
|
|
48
|
+
await this.handleNewConnection(data.connectionId);
|
|
57
49
|
}
|
|
58
|
-
/**
|
|
59
|
-
* Handles a new connection by verifying its completion status.
|
|
60
|
-
*
|
|
61
|
-
* If the connection is considered completed, it triggers the event handler
|
|
62
|
-
* and logs the connection initiation.
|
|
63
|
-
*
|
|
64
|
-
* @param connectionId The unique identifier of the connection.
|
|
65
|
-
* @returns A promise that resolves when the connection is processed.
|
|
66
|
-
*/
|
|
67
50
|
async handleNewConnection(connectionId) {
|
|
68
|
-
if (
|
|
69
|
-
return;
|
|
70
|
-
const isCompleted = await this.repository.isCompleted(connectionId, !!this.messageEvent);
|
|
71
|
-
if (isCompleted) {
|
|
51
|
+
if (await this.repository.isCompleted(connectionId, this.requireProfile)) {
|
|
72
52
|
this.logger.log(`A new connection has been completed with connection id: ${connectionId}`);
|
|
73
53
|
await this.eventHandler.newConnection(connectionId);
|
|
74
54
|
}
|
|
75
55
|
}
|
|
76
56
|
};
|
|
77
|
-
exports.
|
|
78
|
-
exports.
|
|
57
|
+
exports.ConnectionsService = ConnectionsService;
|
|
58
|
+
exports.ConnectionsService = ConnectionsService = ConnectionsService_1 = __decorate([
|
|
79
59
|
(0, common_1.Injectable)(),
|
|
80
|
-
__param(0, (0, common_1.Inject)(
|
|
60
|
+
__param(0, (0, common_1.Inject)(tokens_1.EVENTS_MODULE_OPTIONS)),
|
|
81
61
|
__param(1, (0, common_1.Inject)(connection_repository_1.ConnectionsRepository)),
|
|
82
|
-
__param(2, (0, common_1.
|
|
83
|
-
__param(2, (0, common_1.Inject)('CONNECTIONS_EVENT')),
|
|
62
|
+
__param(2, (0, common_1.Inject)(tokens_1.EVENT_HANDLER)),
|
|
84
63
|
__metadata("design:paramtypes", [Object, connection_repository_1.ConnectionsRepository, Object])
|
|
85
|
-
],
|
|
64
|
+
], ConnectionsService);
|
|
86
65
|
//# sourceMappingURL=connection.service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.service.js","sourceRoot":"","sources":["../../src/connections/connection.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"connection.service.js","sourceRoot":"","sources":["../../src/connections/connection.service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,2CAA2D;AAI3D,sCAAgE;AAChE,oCAAgE;AAEhE,mEAA+D;AAGxD,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IAI7B,YACiC,OAA4B,EAC5B,UAAkD,EAC1D,YAA2C;;QADlB,eAAU,GAAV,UAAU,CAAuB;QACzC,iBAAY,GAAZ,YAAY,CAAc;QANnD,WAAM,GAAG,IAAI,eAAM,CAAC,oBAAkB,CAAC,IAAI,CAAC,CAAA;QAQ3D,MAAM,WAAW,GAAG,MAAA,OAAO,CAAC,OAAO,0CAAE,WAAW,CAAA;QAChD,IAAI,CAAC,cAAc,GAAG,OAAO,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAA,WAAW,CAAC,cAAc,mCAAI,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;IACrG,CAAC;IAEM,KAAK,CAAC,kBAAkB,CAAC,IAAgC,EAAE,SAAiB;QACjF,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW,IAAI,IAAI,CAAC,aAAa,KAAK,WAAW,EAAE,CAAC;YACrE,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC;gBAC3B,EAAE,EAAE,IAAI,CAAC,EAAE;gBACX,MAAM,EAAE,wBAAgB,CAAC,KAAK;gBAC9B,SAAS,EAAE,IAAI,IAAI,CAAC,SAAS,CAAC;aAC/B,CAAC,CAAA;YACF,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QACzC,CAAC;aAAM,IAAI,IAAI,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;YACtC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,wBAAgB,CAAC,UAAU,CAAC,CAAA;YACxF,IAAI,OAAO;gBAAE,MAAM,IAAI,CAAC,YAAY,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;QAC/D,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,qBAAqB,CAAC,IAAyB;QAC1D,MAAM,IAAI,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,MAAM,EAAE,wBAAgB,CAAC,KAAK,EAAE,CAAC,CAAA;QACvF,MAAM,IAAI,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,OAAO,CAAC,CAAA;QACxE,MAAM,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAA;IACnD,CAAC;IAEM,KAAK,CAAC,mBAAmB,CAAC,YAAoB;QACnD,IAAI,MAAM,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,YAAY,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE,CAAC;YACzE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,2DAA2D,YAAY,EAAE,CAAC,CAAA;YAC1F,MAAM,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,YAAY,CAAC,CAAA;QACrD,CAAC;IACH,CAAC;CACF,CAAA;AAvCY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;IAMR,WAAA,IAAA,eAAM,EAAC,8BAAqB,CAAC,CAAA;IAC7B,WAAA,IAAA,eAAM,EAAC,6CAAqB,CAAC,CAAA;IAC7B,WAAA,IAAA,eAAM,EAAC,sBAAa,CAAC,CAAA;6CADsC,6CAAqB;GANxE,kBAAkB,CAuC9B"}
|
|
@@ -14,9 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./connection.controller"), exports);
|
|
18
17
|
__exportStar(require("./connection.entity"), exports);
|
|
19
|
-
__exportStar(require("./connection.module"), exports);
|
|
20
18
|
__exportStar(require("./connection.repository"), exports);
|
|
21
19
|
__exportStar(require("./connection.service"), exports);
|
|
22
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connections/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/connections/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAmC;AACnC,0DAAuC;AACvC,uDAAoC"}
|
|
@@ -3,7 +3,7 @@ import { RevocationRegistryEntity } from './revocation-registry.entity';
|
|
|
3
3
|
export declare class CredentialEntity {
|
|
4
4
|
id: string;
|
|
5
5
|
connectionId?: string;
|
|
6
|
-
|
|
6
|
+
credentialExchangeId?: string;
|
|
7
7
|
refIdHash?: string;
|
|
8
8
|
status?: CredentialStatus;
|
|
9
9
|
revocationRegistryIndex?: number;
|
|
@@ -27,7 +27,7 @@ __decorate([
|
|
|
27
27
|
__decorate([
|
|
28
28
|
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
29
29
|
__metadata("design:type", String)
|
|
30
|
-
], CredentialEntity.prototype, "
|
|
30
|
+
], CredentialEntity.prototype, "credentialExchangeId", void 0);
|
|
31
31
|
__decorate([
|
|
32
32
|
(0, typeorm_1.Column)({ type: 'varchar', nullable: true }),
|
|
33
33
|
__metadata("design:type", String)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credential.entity.js","sourceRoot":"","sources":["../../src/credentials/credential.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAQgB;AAEhB,oCAA2C;AAE3C,6EAAuE;AAGhE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CA4B5B,CAAA;AA5BY,4CAAgB;AAE3B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;4CACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACvB;AAGrB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;
|
|
1
|
+
{"version":3,"file":"credential.entity.js","sourceRoot":"","sources":["../../src/credentials/credential.entity.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,qCAQgB;AAEhB,oCAA2C;AAE3C,6EAAuE;AAGhE,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CA4B5B,CAAA;AA5BY,4CAAgB;AAE3B;IADC,IAAA,gCAAsB,EAAC,MAAM,CAAC;;4CACpB;AAGX;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;sDACvB;AAGrB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8DACf;AAG7B;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDAC1B;AAGlB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,wBAAgB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;gDACxC;AAGzB;IADC,IAAA,gBAAM,EAAC,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iEACZ;AAIhC;IAFC,IAAA,mBAAS,EAAC,GAAG,EAAE,CAAC,qDAAwB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC7D,IAAA,oBAAU,EAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,CAAC;8BACxB,qDAAwB;4DAAA;AAG7C;IADC,IAAA,0BAAgB,GAAE;8BACP,IAAI;mDAAA;AAGhB;IADC,IAAA,0BAAgB,GAAE;8BACP,IAAI;mDAAA;2BA3BL,gBAAgB;IAD5B,IAAA,gBAAM,EAAC,aAAa,CAAC;GACT,gBAAgB,CA4B5B"}
|
|
@@ -1,100 +1,32 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ApiClient, CreateCredentialOfferResponse, CredentialDefinition } from '@verana-labs/vs-agent-client';
|
|
2
2
|
import { Repository } from 'typeorm';
|
|
3
|
-
import { CredentialOptions } from '../types';
|
|
4
3
|
import { CredentialEntity } from './credential.entity';
|
|
5
4
|
import { RevocationRegistryEntity } from './revocation-registry.entity';
|
|
5
|
+
export interface CreateCredentialDefinitionOptions {
|
|
6
|
+
supportRevocation?: boolean;
|
|
7
|
+
maximumCredentialNumber?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface IssueOptions {
|
|
10
|
+
connectionId?: string;
|
|
11
|
+
refId?: string;
|
|
12
|
+
credentialDefinitionId?: string;
|
|
13
|
+
jsonSchemaCredentialId?: string;
|
|
14
|
+
revokeIfAlreadyIssued?: boolean;
|
|
15
|
+
}
|
|
6
16
|
export declare class CredentialService {
|
|
7
17
|
private readonly credentialRepository;
|
|
8
18
|
private readonly revocationRepository;
|
|
9
|
-
private
|
|
19
|
+
private readonly client;
|
|
10
20
|
private readonly logger;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
*
|
|
21
|
-
* When revocation support is enabled:
|
|
22
|
-
* - Two default revocation registries will be created
|
|
23
|
-
* - This ensures continuity if one registry reaches capacity
|
|
24
|
-
*
|
|
25
|
-
* @param attributes - List of attributes that credentials of this type will support
|
|
26
|
-
* @param options.name - Name identifier for the credential type
|
|
27
|
-
* @param options.version - Version of the credential type
|
|
28
|
-
* @param options.supportRevocation - Whether credentials can be revoked
|
|
29
|
-
* @param options.maximumCredentialNumber - Maximum number of credentials that can be issued
|
|
30
|
-
*
|
|
31
|
-
* @returns Promise<void> - Resolves when the credential type and revocation registries are created
|
|
32
|
-
*/
|
|
33
|
-
createType(name: string, version: string, attributes: string[], options?: {
|
|
34
|
-
supportRevocation?: boolean;
|
|
35
|
-
maximumCredentialNumber?: number;
|
|
36
|
-
}): Promise<void>;
|
|
37
|
-
/**
|
|
38
|
-
* Sends a credential issuance to the specified connection using the provided claims.
|
|
39
|
-
* This method initiates the issuance process by sending claims as part of a credential
|
|
40
|
-
* to the recipient identified by the connection ID.
|
|
41
|
-
*
|
|
42
|
-
* @param {string} connectionId - The unique identifier of the connection to which the credential
|
|
43
|
-
* will be issued. This represents the recipient of the credential.
|
|
44
|
-
*
|
|
45
|
-
* @param {Claim[]} claims - An array of claims representing the data to be included in the credential.
|
|
46
|
-
* Each claim has a `name` (key) and a `value` (data). Example:
|
|
47
|
-
* ```javascript
|
|
48
|
-
* const claims = [
|
|
49
|
-
* { name: "email", value: "john.doe@example.com" },
|
|
50
|
-
* { name: "name", value: "John Doe" }
|
|
51
|
-
* ];
|
|
52
|
-
* ```
|
|
53
|
-
*
|
|
54
|
-
* @param {object} [options] - Additional options for credential issuance.
|
|
55
|
-
*
|
|
56
|
-
* ### Options
|
|
57
|
-
* - `refId` (optional, `string`): A unique identifier for the credential. If provided:
|
|
58
|
-
* - When `revokeIfAlreadyIssued` is set to `true`, any existing credential with the same `refId`
|
|
59
|
-
* will be revoked, ensuring the credential is unique.
|
|
60
|
-
* - If `revokeIfAlreadyIssued` is set to `false` (default), multiple credentials with the same `refId` can exist
|
|
61
|
-
* - Used for managing unique credentials like official documents.
|
|
62
|
-
* - Hashed in the database for security.
|
|
63
|
-
* - `credentialDefinitionId` (optional, `string`): Specifies the ID of the credential definition to use.
|
|
64
|
-
* - If not provided, the first available credential definition is used.
|
|
65
|
-
* - `revokeIfAlreadyIssued` (optional, `boolean`): Whether automatic revocation is enabled (default false)
|
|
66
|
-
*
|
|
67
|
-
* @returns {Promise<void>} A promise that resolves when the credential issuance is successfully sent.
|
|
68
|
-
* If an error occurs during the process, the promise will be rejected with the relevant error message.
|
|
69
|
-
*
|
|
70
|
-
*/
|
|
71
|
-
issue(connectionId: string, claims: JsonObject, options?: {
|
|
72
|
-
refId?: string;
|
|
73
|
-
credentialDefinitionId?: string;
|
|
74
|
-
revokeIfAlreadyIssued?: boolean;
|
|
75
|
-
jsonSchemaCredentialId?: string;
|
|
76
|
-
}): Promise<void>;
|
|
77
|
-
/**
|
|
78
|
-
* Accepts a credential by associating it with the provided thread ID.
|
|
79
|
-
* @param connectionId - The connection ID associated with the credential.
|
|
80
|
-
* @param threadId - The thread ID to link with the credential.
|
|
81
|
-
* @throws Error if no credential is found with the specified connection ID.
|
|
82
|
-
*/
|
|
83
|
-
handleAcceptance(threadId: string): Promise<void>;
|
|
84
|
-
/**
|
|
85
|
-
* Rejected a credential by associating it with the provided thread ID.
|
|
86
|
-
* @param connectionId - The connection ID associated with the credential.
|
|
87
|
-
* @param threadId - The thread ID to link with the credential.
|
|
88
|
-
* @throws Error if no credential is found with the specified connection ID.
|
|
89
|
-
*/
|
|
90
|
-
handleRejection(threadId: string): Promise<void>;
|
|
91
|
-
/**
|
|
92
|
-
* Revokes a credential associated with the provided thread ID.
|
|
93
|
-
* @param connectionId - The connection ID to send the revoke. (Search by connection ID if no thread ID)
|
|
94
|
-
* @param threadId - (Optional) The thread ID linked to the credential to revoke.
|
|
95
|
-
* @throws Error if no credential is found with the specified thread ID or connection ID, or if the credential has no connection ID.
|
|
96
|
-
*/
|
|
97
|
-
revoke(connectionId: string, threadId?: string): Promise<void>;
|
|
21
|
+
constructor(credentialRepository: Repository<CredentialEntity>, revocationRepository: Repository<RevocationRegistryEntity>, client: ApiClient);
|
|
22
|
+
createCredentialDefinition(relatedJsonSchemaCredentialId: string, options?: CreateCredentialDefinitionOptions): Promise<CredentialDefinition>;
|
|
23
|
+
issue(claims: Record<string, unknown>, options?: IssueOptions): Promise<CreateCredentialOfferResponse>;
|
|
24
|
+
handleAcceptance(credentialExchangeId: string): Promise<void>;
|
|
25
|
+
handleRejection(credentialExchangeId: string): Promise<void>;
|
|
26
|
+
revoke(connectionId: string, credentialExchangeId?: string): Promise<void>;
|
|
27
|
+
private revokeCredential;
|
|
28
|
+
private findOffered;
|
|
29
|
+
private listCredentialDefinitions;
|
|
98
30
|
private createRevocationRegistry;
|
|
99
31
|
private hash;
|
|
100
32
|
}
|