@verana-labs/vs-agent-sdk 2.0.0-dev.6 → 2.0.0-dev.60
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 +0 -2
- package/build/adminApi/AdminApiError.d.ts +25 -0
- package/build/adminApi/AdminApiError.js +57 -0
- package/build/adminApi/AdminApiError.js.map +1 -0
- package/build/adminApi/didcommModules.d.ts +2 -0
- package/build/adminApi/didcommModules.js +8 -0
- package/build/adminApi/didcommModules.js.map +1 -0
- package/build/adminApi/index.d.ts +3 -0
- package/build/adminApi/index.js +20 -0
- package/build/adminApi/index.js.map +1 -0
- package/build/adminApi/moduleEndpoint.d.ts +8 -0
- package/build/adminApi/moduleEndpoint.js +28 -0
- package/build/adminApi/moduleEndpoint.js.map +1 -0
- package/build/agent/VsAgent.d.ts +15 -33
- package/build/agent/VsAgent.js +75 -205
- package/build/agent/VsAgent.js.map +1 -1
- package/build/agent/createVsAgent.d.ts +5 -5
- package/build/agent/createVsAgent.js +3 -5
- package/build/agent/createVsAgent.js.map +1 -1
- package/build/blockchain/AnonCredsTrustService.d.ts +62 -0
- package/build/blockchain/AnonCredsTrustService.js +256 -0
- package/build/blockchain/AnonCredsTrustService.js.map +1 -0
- package/build/blockchain/AuthorizationService.d.ts +5 -3
- package/build/blockchain/AuthorizationService.js +17 -29
- package/build/blockchain/AuthorizationService.js.map +1 -1
- package/build/blockchain/IndexerWebSocketService.d.ts +7 -1
- package/build/blockchain/IndexerWebSocketService.js +68 -36
- package/build/blockchain/IndexerWebSocketService.js.map +1 -1
- package/build/blockchain/VeranaChainService.d.ts +2 -13
- package/build/blockchain/VeranaChainService.js +8 -113
- package/build/blockchain/VeranaChainService.js.map +1 -1
- package/build/blockchain/VeranaIndexerService.d.ts +14 -1
- package/build/blockchain/VeranaIndexerService.js +122 -8
- package/build/blockchain/VeranaIndexerService.js.map +1 -1
- package/build/blockchain/handlers/authorizationHandlers.js +2 -2
- package/build/blockchain/handlers/authorizationHandlers.js.map +1 -1
- package/build/blockchain/handlers/defaultHandlers.js +2 -0
- package/build/blockchain/handlers/defaultHandlers.js.map +1 -1
- package/build/blockchain/handlers/index.d.ts +1 -0
- package/build/blockchain/handlers/index.js +1 -0
- package/build/blockchain/handlers/index.js.map +1 -1
- package/build/blockchain/handlers/selfIssuanceHandlers.d.ts +13 -0
- package/build/blockchain/handlers/selfIssuanceHandlers.js +71 -0
- package/build/blockchain/handlers/selfIssuanceHandlers.js.map +1 -0
- package/build/blockchain/handlers/stateMutations.d.ts +21 -2
- package/build/blockchain/handlers/stateMutations.js +280 -34
- package/build/blockchain/handlers/stateMutations.js.map +1 -1
- package/build/blockchain/index.d.ts +2 -0
- package/build/blockchain/index.js +2 -0
- package/build/blockchain/index.js.map +1 -1
- package/build/blockchain/indexerMappers.d.ts +3 -0
- package/build/blockchain/indexerMappers.js +53 -0
- package/build/blockchain/indexerMappers.js.map +1 -0
- package/build/blockchain/types.d.ts +5 -57
- package/build/blockchain/types.js.map +1 -1
- package/build/bootstrap/EcsBootstrapService.d.ts +14 -3
- package/build/bootstrap/EcsBootstrapService.js +155 -76
- package/build/bootstrap/EcsBootstrapService.js.map +1 -1
- package/build/credentials/FullTailsFileService.d.ts +0 -1
- package/build/credentials/FullTailsFileService.js +0 -49
- package/build/credentials/FullTailsFileService.js.map +1 -1
- package/build/did/CachedDocumentLoader.d.ts +3 -0
- package/build/did/CachedDocumentLoader.js +7 -1
- package/build/did/CachedDocumentLoader.js.map +1 -1
- package/build/did/CachedWebDidResolver.d.ts +0 -4
- package/build/did/CachedWebDidResolver.js +1 -5
- package/build/did/CachedWebDidResolver.js.map +1 -1
- package/build/did/artifactServices.d.ts +12 -0
- package/build/did/artifactServices.js +48 -0
- package/build/did/artifactServices.js.map +1 -0
- package/build/did/legacyDidWeb.d.ts +6 -4
- package/build/did/legacyDidWeb.js +17 -14
- package/build/did/legacyDidWeb.js.map +1 -1
- package/build/did/publicDid.d.ts +4 -0
- package/build/did/publicDid.js +19 -0
- package/build/did/publicDid.js.map +1 -0
- package/build/events/BaseMessageEvents.js +139 -5
- package/build/events/BaseMessageEvents.js.map +1 -1
- package/build/events/ConnectionEvents.js +110 -82
- package/build/events/ConnectionEvents.js.map +1 -1
- package/build/events/VsAgentEvents.d.ts +11 -9
- package/build/events/VsAgentEvents.js +8 -1
- package/build/events/VsAgentEvents.js.map +1 -1
- package/build/events/VtFlowEvents.d.ts +1 -1
- package/build/events/VtFlowEvents.js +2 -19
- package/build/events/VtFlowEvents.js.map +1 -1
- package/build/index.d.ts +6 -1
- package/build/index.js +10 -2
- package/build/index.js.map +1 -1
- package/build/plugins/setupBaseDidComm.js +6 -12
- package/build/plugins/setupBaseDidComm.js.map +1 -1
- package/build/transports/VsAgentWsInboundTransport.d.ts +1 -1
- package/build/transports/VsAgentWsInboundTransport.js +20 -14
- package/build/transports/VsAgentWsInboundTransport.js.map +1 -1
- package/build/types.d.ts +5 -0
- package/build/types.js.map +1 -1
- package/build/utils/agent.d.ts +27 -3
- package/build/utils/agent.js +83 -22
- package/build/utils/agent.js.map +1 -1
- package/build/utils/didReadiness.d.ts +9 -0
- package/build/utils/didReadiness.js +42 -0
- package/build/utils/didReadiness.js.map +1 -0
- package/build/utils/ecsClaims.d.ts +47 -0
- package/build/utils/ecsClaims.js +120 -0
- package/build/utils/ecsClaims.js.map +1 -0
- package/build/utils/ecsService.d.ts +8 -0
- package/build/utils/ecsService.js +23 -0
- package/build/utils/ecsService.js.map +1 -0
- package/build/utils/index.d.ts +4 -0
- package/build/utils/index.js +4 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/selfIssuedEcsCredential.d.ts +8 -0
- package/build/utils/selfIssuedEcsCredential.js +151 -0
- package/build/utils/selfIssuedEcsCredential.js.map +1 -0
- package/build/utils/setupSelfTr.d.ts +29 -66
- package/build/utils/setupSelfTr.js +78 -282
- package/build/utils/setupSelfTr.js.map +1 -1
- package/build/utils/trustCredentialStore.d.ts +67 -9
- package/build/utils/trustCredentialStore.js +296 -109
- package/build/utils/trustCredentialStore.js.map +1 -1
- package/build/utils/util.d.ts +10 -0
- package/build/utils/util.js +16 -0
- package/build/utils/util.js.map +1 -1
- package/build/utils/vcdm2.d.ts +34 -0
- package/build/utils/vcdm2.js +62 -0
- package/build/utils/vcdm2.js.map +1 -0
- package/build/utils/vtjscResolver.d.ts +18 -0
- package/build/utils/vtjscResolver.js +54 -0
- package/build/utils/vtjscResolver.js.map +1 -0
- package/build/vtFlow/VtFlowOrchestrator.d.ts +59 -13
- package/build/vtFlow/VtFlowOrchestrator.js +139 -91
- package/build/vtFlow/VtFlowOrchestrator.js.map +1 -1
- package/build/vtFlow/assertVerifiableService.d.ts +1 -0
- package/build/vtFlow/assertVerifiableService.js +45 -5
- package/build/vtFlow/assertVerifiableService.js.map +1 -1
- package/build/vtFlow/ecsIssuanceExemption.d.ts +12 -0
- package/build/vtFlow/ecsIssuanceExemption.js +84 -0
- package/build/vtFlow/ecsIssuanceExemption.js.map +1 -0
- package/build/vtFlow/index.d.ts +1 -0
- package/build/vtFlow/index.js +1 -0
- package/build/vtFlow/index.js.map +1 -1
- package/package.json +12 -12
- package/build/did/migrateWebVhLog.d.ts +0 -34
- package/build/did/migrateWebVhLog.js +0 -230
- package/build/did/migrateWebVhLog.js.map +0 -1
- package/build/did/migrateWebVhVersionTime.d.ts +0 -9
- package/build/did/migrateWebVhVersionTime.js +0 -191
- package/build/did/migrateWebVhVersionTime.js.map +0 -1
package/README.md
CHANGED
|
@@ -22,7 +22,6 @@ const agent = createVsAgent({
|
|
|
22
22
|
endpoints: ['https://agent.example.com/didcomm'],
|
|
23
23
|
}),
|
|
24
24
|
],
|
|
25
|
-
label: 'My Agent',
|
|
26
25
|
publicApiBaseUrl: 'https://api.example.com',
|
|
27
26
|
dependencies: getNodeHttpServer(),
|
|
28
27
|
})
|
|
@@ -138,7 +137,6 @@ const chain = new VeranaChainService({
|
|
|
138
137
|
const agent = createVsAgent({
|
|
139
138
|
plugins: [...],
|
|
140
139
|
veranaChain: chain,
|
|
141
|
-
label: 'My Agent',
|
|
142
140
|
publicApiBaseUrl: 'https://api.example.com',
|
|
143
141
|
dependencies: getNodeHttpServer(),
|
|
144
142
|
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare enum AdminApiErrorCode {
|
|
2
|
+
InvalidInput = "INVALID_INPUT",
|
|
3
|
+
InvalidCursor = "INVALID_CURSOR",
|
|
4
|
+
Unauthenticated = "UNAUTHENTICATED",
|
|
5
|
+
Forbidden = "FORBIDDEN",
|
|
6
|
+
UnknownId = "UNKNOWN_ID",
|
|
7
|
+
InvalidState = "INVALID_STATE",
|
|
8
|
+
NoCompatibleCredentials = "NO_COMPATIBLE_CREDENTIALS",
|
|
9
|
+
InvalidPackage = "INVALID_PACKAGE",
|
|
10
|
+
UnsupportedFormat = "UNSUPPORTED_FORMAT",
|
|
11
|
+
NotReady = "NOT_READY",
|
|
12
|
+
NotAuthorized = "NOT_AUTHORIZED",
|
|
13
|
+
PeerNotAuthorized = "PEER_NOT_AUTHORIZED",
|
|
14
|
+
ResolverUnavailable = "RESOLVER_UNAVAILABLE",
|
|
15
|
+
Internal = "INTERNAL"
|
|
16
|
+
}
|
|
17
|
+
export declare class AdminApiError extends Error {
|
|
18
|
+
readonly code: string;
|
|
19
|
+
readonly status: number;
|
|
20
|
+
constructor(code: string, status: number, message: string);
|
|
21
|
+
}
|
|
22
|
+
export declare function moduleNotServed(module: string): AdminApiError;
|
|
23
|
+
export declare function unknownConnection(connectionId: string): AdminApiError;
|
|
24
|
+
export type TrustDecisionSubject = 'agent' | 'peer';
|
|
25
|
+
export declare function trustDecisionError(error: unknown, subject: TrustDecisionSubject, notDerivableCode?: AdminApiErrorCode): unknown;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AdminApiError = exports.AdminApiErrorCode = void 0;
|
|
4
|
+
exports.moduleNotServed = moduleNotServed;
|
|
5
|
+
exports.unknownConnection = unknownConnection;
|
|
6
|
+
exports.trustDecisionError = trustDecisionError;
|
|
7
|
+
const blockchain_1 = require("../blockchain");
|
|
8
|
+
const BAD_REQUEST = 400;
|
|
9
|
+
const NOT_FOUND = 404;
|
|
10
|
+
const CONFLICT = 409;
|
|
11
|
+
const SERVICE_UNAVAILABLE = 503;
|
|
12
|
+
var AdminApiErrorCode;
|
|
13
|
+
(function (AdminApiErrorCode) {
|
|
14
|
+
AdminApiErrorCode["InvalidInput"] = "INVALID_INPUT";
|
|
15
|
+
AdminApiErrorCode["InvalidCursor"] = "INVALID_CURSOR";
|
|
16
|
+
AdminApiErrorCode["Unauthenticated"] = "UNAUTHENTICATED";
|
|
17
|
+
AdminApiErrorCode["Forbidden"] = "FORBIDDEN";
|
|
18
|
+
AdminApiErrorCode["UnknownId"] = "UNKNOWN_ID";
|
|
19
|
+
AdminApiErrorCode["InvalidState"] = "INVALID_STATE";
|
|
20
|
+
AdminApiErrorCode["NoCompatibleCredentials"] = "NO_COMPATIBLE_CREDENTIALS";
|
|
21
|
+
AdminApiErrorCode["InvalidPackage"] = "INVALID_PACKAGE";
|
|
22
|
+
AdminApiErrorCode["UnsupportedFormat"] = "UNSUPPORTED_FORMAT";
|
|
23
|
+
AdminApiErrorCode["NotReady"] = "NOT_READY";
|
|
24
|
+
AdminApiErrorCode["NotAuthorized"] = "NOT_AUTHORIZED";
|
|
25
|
+
AdminApiErrorCode["PeerNotAuthorized"] = "PEER_NOT_AUTHORIZED";
|
|
26
|
+
AdminApiErrorCode["ResolverUnavailable"] = "RESOLVER_UNAVAILABLE";
|
|
27
|
+
AdminApiErrorCode["Internal"] = "INTERNAL";
|
|
28
|
+
})(AdminApiErrorCode || (exports.AdminApiErrorCode = AdminApiErrorCode = {}));
|
|
29
|
+
class AdminApiError extends Error {
|
|
30
|
+
constructor(code, status, message) {
|
|
31
|
+
super(message);
|
|
32
|
+
this.code = code;
|
|
33
|
+
this.status = status;
|
|
34
|
+
this.name = 'AdminApiError';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.AdminApiError = AdminApiError;
|
|
38
|
+
function moduleNotServed(module) {
|
|
39
|
+
return new AdminApiError(AdminApiErrorCode.UnknownId, NOT_FOUND, `this deployment does not serve the ${module} module`);
|
|
40
|
+
}
|
|
41
|
+
function unknownConnection(connectionId) {
|
|
42
|
+
return new AdminApiError(AdminApiErrorCode.UnknownId, NOT_FOUND, `no connection with id "${connectionId}"`);
|
|
43
|
+
}
|
|
44
|
+
function trustDecisionError(error, subject, notDerivableCode) {
|
|
45
|
+
if (!(error instanceof blockchain_1.AnonCredsTrustError))
|
|
46
|
+
return error;
|
|
47
|
+
if (error.reason === blockchain_1.AnonCredsTrustErrorReason.Unavailable) {
|
|
48
|
+
return new AdminApiError(AdminApiErrorCode.ResolverUnavailable, SERVICE_UNAVAILABLE, error.message);
|
|
49
|
+
}
|
|
50
|
+
const unauthorizedCode = subject === 'peer' ? AdminApiErrorCode.PeerNotAuthorized : AdminApiErrorCode.NotAuthorized;
|
|
51
|
+
if (error.reason === blockchain_1.AnonCredsTrustErrorReason.NotAuthorized) {
|
|
52
|
+
return new AdminApiError(unauthorizedCode, CONFLICT, error.message);
|
|
53
|
+
}
|
|
54
|
+
const code = notDerivableCode !== null && notDerivableCode !== void 0 ? notDerivableCode : unauthorizedCode;
|
|
55
|
+
return new AdminApiError(code, code === AdminApiErrorCode.InvalidInput ? BAD_REQUEST : CONFLICT, error.message);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=AdminApiError.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AdminApiError.js","sourceRoot":"","sources":["../../src/adminApi/AdminApiError.ts"],"names":[],"mappings":";;;AAmCA,0CAMC;AAED,8CAEC;AAID,gDAyBC;AA1ED,8CAA8E;AAE9E,MAAM,WAAW,GAAG,GAAG,CAAA;AACvB,MAAM,SAAS,GAAG,GAAG,CAAA;AACrB,MAAM,QAAQ,GAAG,GAAG,CAAA;AACpB,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAE/B,IAAY,iBAeX;AAfD,WAAY,iBAAiB;IAC3B,mDAA8B,CAAA;IAC9B,qDAAgC,CAAA;IAChC,wDAAmC,CAAA;IACnC,4CAAuB,CAAA;IACvB,6CAAwB,CAAA;IACxB,mDAA8B,CAAA;IAC9B,0EAAqD,CAAA;IACrD,uDAAkC,CAAA;IAClC,6DAAwC,CAAA;IACxC,2CAAsB,CAAA;IACtB,qDAAgC,CAAA;IAChC,8DAAyC,CAAA;IACzC,iEAA4C,CAAA;IAC5C,0CAAqB,CAAA;AACvB,CAAC,EAfW,iBAAiB,iCAAjB,iBAAiB,QAe5B;AAED,MAAa,aAAc,SAAQ,KAAK;IACtC,YACkB,IAAY,EACZ,MAAc,EAC9B,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAA;QAJE,SAAI,GAAJ,IAAI,CAAQ;QACZ,WAAM,GAAN,MAAM,CAAQ;QAI9B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAA;IAC7B,CAAC;CACF;AATD,sCASC;AAED,SAAgB,eAAe,CAAC,MAAc;IAC5C,OAAO,IAAI,aAAa,CACtB,iBAAiB,CAAC,SAAS,EAC3B,SAAS,EACT,sCAAsC,MAAM,SAAS,CACtD,CAAA;AACH,CAAC;AAED,SAAgB,iBAAiB,CAAC,YAAoB;IACpD,OAAO,IAAI,aAAa,CAAC,iBAAiB,CAAC,SAAS,EAAE,SAAS,EAAE,0BAA0B,YAAY,GAAG,CAAC,CAAA;AAC7G,CAAC;AAID,SAAgB,kBAAkB,CAChC,KAAc,EACd,OAA6B,EAC7B,gBAAoC;IAEpC,IAAI,CAAC,CAAC,KAAK,YAAY,gCAAmB,CAAC;QAAE,OAAO,KAAK,CAAA;IAEzD,IAAI,KAAK,CAAC,MAAM,KAAK,sCAAyB,CAAC,WAAW,EAAE,CAAC;QAC3D,OAAO,IAAI,aAAa,CAAC,iBAAiB,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACrG,CAAC;IAED,MAAM,gBAAgB,GACpB,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC,CAAC,iBAAiB,CAAC,aAAa,CAAA;IAE5F,IAAI,KAAK,CAAC,MAAM,KAAK,sCAAyB,CAAC,aAAa,EAAE,CAAC;QAC7D,OAAO,IAAI,aAAa,CAAC,gBAAgB,EAAE,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAA;IACrE,CAAC;IAED,MAAM,IAAI,GAAG,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,gBAAgB,CAAA;IAEjD,OAAO,IAAI,aAAa,CACtB,IAAI,EACJ,IAAI,KAAK,iBAAiB,CAAC,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,EAChE,KAAK,CAAC,OAAO,CACd,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.moduleOf = moduleOf;
|
|
4
|
+
function moduleOf(modules, protocol) {
|
|
5
|
+
var _a;
|
|
6
|
+
return (_a = modules.find(({ prefixes }) => prefixes.some(prefix => protocol.startsWith(prefix)))) === null || _a === void 0 ? void 0 : _a.module;
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=didcommModules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"didcommModules.js","sourceRoot":"","sources":["../../src/adminApi/didcommModules.ts"],"names":[],"mappings":";;AAEA,4BAEC;AAFD,SAAgB,QAAQ,CAAC,OAAiC,EAAE,QAAgB;;IAC1E,OAAO,MAAA,OAAO,CAAC,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,0CAAE,MAAM,CAAA;AACrG,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./AdminApiError"), exports);
|
|
18
|
+
__exportStar(require("./didcommModules"), exports);
|
|
19
|
+
__exportStar(require("./moduleEndpoint"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adminApi/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAA+B;AAC/B,mDAAgC;AAChC,mDAAgC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BaseAgentModules, VsAgent } from '../agent/VsAgent';
|
|
2
|
+
import { BaseRecord } from '@credo-ts/core';
|
|
3
|
+
import { DidCommConnectionRecord, DidCommMessage } from '@credo-ts/didcomm';
|
|
4
|
+
type Agent = VsAgent<BaseAgentModules>;
|
|
5
|
+
export declare function moduleService<T>(agent: Agent, service: new (...args: any[]) => T, module: string): T;
|
|
6
|
+
export declare function connectionOf(agent: Agent, connectionId: string): Promise<DidCommConnectionRecord>;
|
|
7
|
+
export declare function sendMessage(agent: Agent, connection: DidCommConnectionRecord, message: DidCommMessage, associatedRecord?: BaseRecord<any, any, any>): Promise<string>;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.moduleService = moduleService;
|
|
4
|
+
exports.connectionOf = connectionOf;
|
|
5
|
+
exports.sendMessage = sendMessage;
|
|
6
|
+
const didcomm_1 = require("@credo-ts/didcomm");
|
|
7
|
+
const AdminApiError_1 = require("./AdminApiError");
|
|
8
|
+
function moduleService(agent, service, module) {
|
|
9
|
+
const { dependencyManager } = agent.context;
|
|
10
|
+
if (!dependencyManager.isRegistered(service))
|
|
11
|
+
throw (0, AdminApiError_1.moduleNotServed)(module);
|
|
12
|
+
return dependencyManager.resolve(service);
|
|
13
|
+
}
|
|
14
|
+
async function connectionOf(agent, connectionId) {
|
|
15
|
+
const connection = await agent.didcomm.connections.findById(connectionId);
|
|
16
|
+
if (!connection)
|
|
17
|
+
throw (0, AdminApiError_1.unknownConnection)(connectionId);
|
|
18
|
+
return connection;
|
|
19
|
+
}
|
|
20
|
+
async function sendMessage(agent, connection, message, associatedRecord) {
|
|
21
|
+
await agent.context.dependencyManager.resolve(didcomm_1.DidCommMessageSender).sendMessage(new didcomm_1.DidCommOutboundMessageContext(message, {
|
|
22
|
+
agentContext: agent.context,
|
|
23
|
+
connection,
|
|
24
|
+
associatedRecord,
|
|
25
|
+
}));
|
|
26
|
+
return message.id;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=moduleEndpoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleEndpoint.js","sourceRoot":"","sources":["../../src/adminApi/moduleEndpoint.ts"],"names":[],"mappings":";;AAcA,sCAIC;AAED,oCAIC;AAED,kCAcC;AArCD,+CAK0B;AAE1B,mDAAoE;AAIpE,SAAgB,aAAa,CAAI,KAAY,EAAE,OAAkC,EAAE,MAAc;IAC/F,MAAM,EAAE,iBAAiB,EAAE,GAAG,KAAK,CAAC,OAAO,CAAA;IAC3C,IAAI,CAAC,iBAAiB,CAAC,YAAY,CAAC,OAAO,CAAC;QAAE,MAAM,IAAA,+BAAe,EAAC,MAAM,CAAC,CAAA;IAC3E,OAAO,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;AAC3C,CAAC;AAEM,KAAK,UAAU,YAAY,CAAC,KAAY,EAAE,YAAoB;IACnE,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAA;IACzE,IAAI,CAAC,UAAU;QAAE,MAAM,IAAA,iCAAiB,EAAC,YAAY,CAAC,CAAA;IACtD,OAAO,UAAU,CAAA;AACnB,CAAC;AAEM,KAAK,UAAU,WAAW,CAC/B,KAAY,EACZ,UAAmC,EACnC,OAAuB,EACvB,gBAA4C;IAE5C,MAAM,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,8BAAoB,CAAC,CAAC,WAAW,CAC7E,IAAI,uCAA6B,CAAC,OAAO,EAAE;QACzC,YAAY,EAAE,KAAK,CAAC,OAAO;QAC3B,UAAU;QACV,gBAAgB;KACjB,CAAC,CACH,CAAA;IACD,OAAO,OAAO,CAAC,EAAE,CAAA;AACnB,CAAC"}
|
package/build/agent/VsAgent.d.ts
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { AnonCredsDidCommCredentialFormatService, AnonCredsModule, AnonCredsDidCommProofFormatService
|
|
1
|
+
import { AnonCredsDidCommCredentialFormatService, AnonCredsModule, AnonCredsDidCommProofFormatService } from '@credo-ts/anoncreds';
|
|
2
2
|
import { AskarModule, AskarModuleConfigStoreOptions } from '@credo-ts/askar';
|
|
3
3
|
import { Agent, AgentDependencies, DidsModule, InitConfig, W3cCredentialsModule } from '@credo-ts/core';
|
|
4
|
-
import { DidCommCredentialsModuleConfigOptions, DidCommCredentialV2Protocol,
|
|
4
|
+
import { DidCommCredentialsModuleConfigOptions, DidCommCredentialV2Protocol, DidCommDataIntegrityCredentialFormatService, DidCommFeatureQueryOptions, DidCommModule, DidCommModuleConfigOptions, DidCommProofsModuleConfigOptions, DidCommProofV2Protocol } from '@credo-ts/didcomm';
|
|
5
5
|
import { VtFlowModule } from '@verana-labs/credo-ts-didcomm-vt-flow';
|
|
6
|
+
import { AnonCredsTrustService } from '../blockchain/AnonCredsTrustService';
|
|
6
7
|
import { AuthorizationService } from '../blockchain/AuthorizationService';
|
|
7
8
|
import { VeranaChainService } from '../blockchain/VeranaChainService';
|
|
9
|
+
import { VeranaIndexerService } from '../blockchain/VeranaIndexerService';
|
|
10
|
+
import { EcsClaims } from '../utils/ecsClaims';
|
|
8
11
|
type VsAgentDidCommModule = DidCommModule<DidCommModuleConfigOptions & {
|
|
9
12
|
credentials: DidCommCredentialsModuleConfigOptions<[
|
|
10
13
|
DidCommCredentialV2Protocol<[
|
|
11
|
-
LegacyIndyDidCommCredentialFormatService,
|
|
12
14
|
AnonCredsDidCommCredentialFormatService,
|
|
13
|
-
|
|
15
|
+
DidCommDataIntegrityCredentialFormatService
|
|
14
16
|
]>
|
|
15
17
|
]>;
|
|
16
|
-
proofs: DidCommProofsModuleConfigOptions<[
|
|
17
|
-
DidCommProofV2Protocol<[LegacyIndyDidCommProofFormatService, AnonCredsDidCommProofFormatService]>
|
|
18
|
-
]>;
|
|
18
|
+
proofs: DidCommProofsModuleConfigOptions<[DidCommProofV2Protocol<[AnonCredsDidCommProofFormatService]>]>;
|
|
19
19
|
}>;
|
|
20
20
|
export type BaseAgentModules = {
|
|
21
21
|
askar: AskarModule;
|
|
@@ -32,22 +32,23 @@ interface AgentOptions<TModules extends BaseAgentModules> {
|
|
|
32
32
|
}
|
|
33
33
|
export declare class VsAgent<TModules extends BaseAgentModules = BaseAgentModules> extends Agent<TModules> {
|
|
34
34
|
did?: string;
|
|
35
|
-
autoDiscloseUserProfile?: boolean;
|
|
36
35
|
publicApiBaseUrl: string;
|
|
37
36
|
adminApiServiceEndpoint?: string;
|
|
38
|
-
displayPictureUrl?: string;
|
|
39
|
-
label: string;
|
|
40
37
|
veranaChain?: VeranaChainService;
|
|
38
|
+
indexer: VeranaIndexerService;
|
|
39
|
+
trustedEcosystemDids?: string[];
|
|
40
|
+
ecsClaims?: EcsClaims;
|
|
41
41
|
authorizationService?: AuthorizationService;
|
|
42
42
|
discoveryOptions?: DidCommFeatureQueryOptions[];
|
|
43
|
+
readonly anonCredsTrust: AnonCredsTrustService;
|
|
43
44
|
constructor(options: AgentOptions<TModules> & {
|
|
44
45
|
did?: string;
|
|
45
|
-
autoDiscloseUserProfile?: boolean;
|
|
46
46
|
publicApiBaseUrl: string;
|
|
47
47
|
adminApiServiceEndpoint?: string;
|
|
48
|
-
displayPictureUrl?: string;
|
|
49
|
-
label: string;
|
|
50
48
|
veranaChain?: VeranaChainService;
|
|
49
|
+
indexer: VeranaIndexerService;
|
|
50
|
+
trustedEcosystemDids?: string[];
|
|
51
|
+
ecsClaims?: EcsClaims;
|
|
51
52
|
authorizationService?: AuthorizationService;
|
|
52
53
|
discoveryOptions?: DidCommFeatureQueryOptions[];
|
|
53
54
|
});
|
|
@@ -56,37 +57,18 @@ export declare class VsAgent<TModules extends BaseAgentModules = BaseAgentModule
|
|
|
56
57
|
private findCreatedDid;
|
|
57
58
|
private findEd25519VerificationMethodId;
|
|
58
59
|
private getDidCommServices;
|
|
59
|
-
private persistDidDocumentKey;
|
|
60
|
-
/**
|
|
61
|
-
* Fix a webvh update-key mapping whose `didDocumentRelativeKeyId` was stored as the full multibase
|
|
62
|
-
* (e.g. `#z6Mk...`) while the DID document verification method uses a short fragment (e.g. `#BVhGnL79`).
|
|
63
|
-
* `getKmsKeyIdForVerifiacationMethod` matches by suffix (`vm.id.endsWith(relativeKeyId)`), so the
|
|
64
|
-
* mismatch leaves the update key unresolvable and every webvh update fails with
|
|
65
|
-
* "The key ID must be present before the log can be edited." The private key is present in the KMS;
|
|
66
|
-
* only the mapping label is wrong. Idempotent: a mapping that already correlates to a VM is left alone.
|
|
67
|
-
*/
|
|
68
|
-
private repairWebvhUpdateKeyMapping;
|
|
69
60
|
private createAndAddDidCommKeysAndServices;
|
|
70
|
-
private
|
|
71
|
-
/**
|
|
72
|
-
* Basic implicit webvh services, for the moment pointing to the service VP
|
|
73
|
-
* and public base URL
|
|
74
|
-
*/
|
|
75
|
-
private createAndAddWebVhImplicitServices;
|
|
76
|
-
private createAndAddAnonCredsServices;
|
|
61
|
+
private addLinkedVpContext;
|
|
77
62
|
private applyAdminApiService;
|
|
78
63
|
}
|
|
79
64
|
export interface VsAgentOptions {
|
|
80
65
|
config: InitConfig;
|
|
81
66
|
did?: string;
|
|
82
|
-
autoDiscloseUserProfile?: boolean;
|
|
83
67
|
dependencies: AgentDependencies;
|
|
84
68
|
publicApiBaseUrl: string;
|
|
85
69
|
adminApiServiceEndpoint?: string;
|
|
86
70
|
masterListCscaLocation?: string;
|
|
87
71
|
endpoints: string[];
|
|
88
72
|
walletConfig: AskarModuleConfigStoreOptions;
|
|
89
|
-
displayPictureUrl?: string;
|
|
90
|
-
label: string;
|
|
91
73
|
}
|
|
92
74
|
export {};
|