@verana-labs/vs-agent-sdk 1.10.1
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/LICENSE +201 -0
- package/build/agent/VsAgent.d.ts +66 -0
- package/build/agent/VsAgent.js +276 -0
- package/build/agent/VsAgent.js.map +1 -0
- package/build/agent/createVsAgent.d.ts +50 -0
- package/build/agent/createVsAgent.js +43 -0
- package/build/agent/createVsAgent.js.map +1 -0
- package/build/credentials/FullTailsFileService.d.ts +17 -0
- package/build/credentials/FullTailsFileService.js +76 -0
- package/build/credentials/FullTailsFileService.js.map +1 -0
- package/build/did/CachedDocumentLoader.d.ts +35 -0
- package/build/did/CachedDocumentLoader.js +139 -0
- package/build/did/CachedDocumentLoader.js.map +1 -0
- package/build/did/CachedWebDidResolver.d.ts +9 -0
- package/build/did/CachedWebDidResolver.js +44 -0
- package/build/did/CachedWebDidResolver.js.map +1 -0
- package/build/did/WebDidRegistrar.d.ts +34 -0
- package/build/did/WebDidRegistrar.js +110 -0
- package/build/did/WebDidRegistrar.js.map +1 -0
- package/build/did/legacyDidWeb.d.ts +10 -0
- package/build/did/legacyDidWeb.js +41 -0
- package/build/did/legacyDidWeb.js.map +1 -0
- package/build/index.d.ts +24 -0
- package/build/index.js +68 -0
- package/build/index.js.map +1 -0
- package/build/plugins/setupBaseDidComm.d.ts +15 -0
- package/build/plugins/setupBaseDidComm.js +82 -0
- package/build/plugins/setupBaseDidComm.js.map +1 -0
- package/build/transports/HttpInboundTransport.d.ts +28 -0
- package/build/transports/HttpInboundTransport.js +132 -0
- package/build/transports/HttpInboundTransport.js.map +1 -0
- package/build/transports/VsAgentWsInboundTransport.d.ts +30 -0
- package/build/transports/VsAgentWsInboundTransport.js +143 -0
- package/build/transports/VsAgentWsInboundTransport.js.map +1 -0
- package/build/transports/VsAgentWsOutboundTransport.d.ts +20 -0
- package/build/transports/VsAgentWsOutboundTransport.js +129 -0
- package/build/transports/VsAgentWsOutboundTransport.js.map +1 -0
- package/build/types.d.ts +30 -0
- package/build/types.js +5 -0
- package/build/types.js.map +1 -0
- package/build/utils/agent.d.ts +20 -0
- package/build/utils/agent.js +49 -0
- package/build/utils/agent.js.map +1 -0
- package/build/utils/data.d.ts +1 -0
- package/build/utils/data.js +255 -0
- package/build/utils/data.js.map +1 -0
- package/build/utils/parsers.d.ts +11 -0
- package/build/utils/parsers.js +36 -0
- package/build/utils/parsers.js.map +1 -0
- package/build/utils/util.d.ts +3 -0
- package/build/utils/util.js +151 -0
- package/build/utils/util.js.map +1 -0
- package/build/utils/webhook.d.ts +13 -0
- package/build/utils/webhook.js +56 -0
- package/build/utils/webhook.js.map +1 -0
- package/build/utils/webhookEvent.d.ts +5 -0
- package/build/utils/webhookEvent.js +26 -0
- package/build/utils/webhookEvent.js.map +1 -0
- package/package.json +53 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createVsAgent.js","sourceRoot":"","sources":["../../src/agent/createVsAgent.ts"],"names":[],"mappings":";;AA0DA,sCAqBC;AA1ED,uCAAqD;AA4BrD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,aAAa,CAC3B,OAAgC;IAEhC,MAAM,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAC1C,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,CAAC,iCAAM,GAAG,GAAK,MAAM,CAAC,OAAO,EAAG,EAChD,EAA6B,CACV,CAAA;IAErB,OAAO,IAAI,iBAAO,CAAmB;QACnC,MAAM,kCACD,OAAO,CAAC,MAAM,KACjB,0BAA0B,EAAE,OAAO,CAAC,0BAA0B,GAC/D;QACD,OAAO,EAAE,aAAa;QACtB,YAAY,EAAE,OAAO,CAAC,YAAY;QAClC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,uBAAuB,EAAE,OAAO,CAAC,uBAAuB;QACxD,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;QAC1C,iBAAiB,EAAE,OAAO,CAAC,iBAAiB;QAC5C,KAAK,EAAE,OAAO,CAAC,KAAK;KACrB,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AnonCredsRevocationRegistryDefinition } from '@credo-ts/anoncreds';
|
|
2
|
+
import type { AgentContext } from '@credo-ts/core';
|
|
3
|
+
import { BasicTailsFileService } from '@credo-ts/anoncreds';
|
|
4
|
+
export declare class FullTailsFileService extends BasicTailsFileService {
|
|
5
|
+
private tailsServerBaseUrl;
|
|
6
|
+
constructor(options: {
|
|
7
|
+
tailsDirectoryPath?: string;
|
|
8
|
+
tailsServerBaseUrl: string;
|
|
9
|
+
});
|
|
10
|
+
uploadTailsFile(agentContext: AgentContext, options: {
|
|
11
|
+
revocationRegistryDefinition: AnonCredsRevocationRegistryDefinition;
|
|
12
|
+
}): Promise<{
|
|
13
|
+
tailsFileUrl: string;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
export declare const baseFilePath = "./tails";
|
|
17
|
+
export declare const tailsIndex: Record<string, string>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.tailsIndex = exports.baseFilePath = exports.FullTailsFileService = void 0;
|
|
7
|
+
const anoncreds_1 = require("@credo-ts/anoncreds");
|
|
8
|
+
const core_1 = require("@credo-ts/core");
|
|
9
|
+
const crypto_1 = require("crypto");
|
|
10
|
+
const fs_1 = __importDefault(require("fs"));
|
|
11
|
+
class FullTailsFileService extends anoncreds_1.BasicTailsFileService {
|
|
12
|
+
constructor(options) {
|
|
13
|
+
super(options);
|
|
14
|
+
this.tailsServerBaseUrl = options.tailsServerBaseUrl;
|
|
15
|
+
}
|
|
16
|
+
async uploadTailsFile(agentContext, options) {
|
|
17
|
+
const revocationRegistryDefinition = options.revocationRegistryDefinition;
|
|
18
|
+
const localTailsFilePath = revocationRegistryDefinition.value.tailsLocation;
|
|
19
|
+
const tailsFileId = core_1.utils.uuid();
|
|
20
|
+
try {
|
|
21
|
+
await saveTailsFile(localTailsFilePath, tailsFileId, agentContext.config.logger);
|
|
22
|
+
agentContext.config.logger.info('Tails file processed successfully!');
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
agentContext.config.logger.error(`Failed to process tails file: ${error.message}`);
|
|
26
|
+
}
|
|
27
|
+
return { tailsFileUrl: `${this.tailsServerBaseUrl}/${encodeURIComponent(tailsFileId)}` };
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.FullTailsFileService = FullTailsFileService;
|
|
31
|
+
exports.baseFilePath = './tails';
|
|
32
|
+
const indexFilePath = `./${exports.baseFilePath}/index.json`;
|
|
33
|
+
if (!fs_1.default.existsSync(exports.baseFilePath)) {
|
|
34
|
+
fs_1.default.mkdirSync(exports.baseFilePath, { recursive: true });
|
|
35
|
+
}
|
|
36
|
+
exports.tailsIndex = (fs_1.default.existsSync(indexFilePath) ? JSON.parse(fs_1.default.readFileSync(indexFilePath, { encoding: 'utf-8' })) : {});
|
|
37
|
+
function fileHash(filePath, algorithm = 'sha256') {
|
|
38
|
+
return new Promise((resolve, reject) => {
|
|
39
|
+
const shasum = (0, crypto_1.createHash)(algorithm);
|
|
40
|
+
try {
|
|
41
|
+
const s = fs_1.default.createReadStream(filePath);
|
|
42
|
+
s.on('data', function (data) {
|
|
43
|
+
shasum.update(data);
|
|
44
|
+
});
|
|
45
|
+
// making digest
|
|
46
|
+
s.on('end', function () {
|
|
47
|
+
const hash = shasum.digest('hex');
|
|
48
|
+
return resolve(hash);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
return reject('error in calculation');
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function saveTailsFile(localFilePath, tailsFileId, logger) {
|
|
57
|
+
logger.info(`Processing tails file: ${tailsFileId}`);
|
|
58
|
+
if (!localFilePath)
|
|
59
|
+
throw new Error('No file path was provided.');
|
|
60
|
+
if (!tailsFileId)
|
|
61
|
+
throw new Error('Missing tailsFileId');
|
|
62
|
+
if (exports.tailsIndex[tailsFileId])
|
|
63
|
+
throw new Error(`There is already an entry for: ${tailsFileId}`);
|
|
64
|
+
const hash = await fileHash(localFilePath);
|
|
65
|
+
const destinationPath = `${exports.baseFilePath}/${hash}`;
|
|
66
|
+
if (fs_1.default.existsSync(destinationPath)) {
|
|
67
|
+
logger.warn('Tails file already exists');
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
fs_1.default.copyFileSync(localFilePath, destinationPath);
|
|
71
|
+
}
|
|
72
|
+
exports.tailsIndex[tailsFileId] = hash;
|
|
73
|
+
fs_1.default.writeFileSync(indexFilePath, JSON.stringify(exports.tailsIndex));
|
|
74
|
+
logger.info(`Successfully processed tails file ${tailsFileId}`);
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=FullTailsFileService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullTailsFileService.js","sourceRoot":"","sources":["../../src/credentials/FullTailsFileService.ts"],"names":[],"mappings":";;;;;;AAGA,mDAA2D;AAC3D,yCAAsC;AACtC,mCAAmC;AACnC,4CAAmB;AAEnB,MAAa,oBAAqB,SAAQ,iCAAqB;IAE7D,YAAmB,OAAoE;QACrF,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,CAAA;IACtD,CAAC;IAEM,KAAK,CAAC,eAAe,CAC1B,YAA0B,EAC1B,OAEC;QAED,MAAM,4BAA4B,GAAG,OAAO,CAAC,4BAA4B,CAAA;QACzE,MAAM,kBAAkB,GAAG,4BAA4B,CAAC,KAAK,CAAC,aAAa,CAAA;QAE3E,MAAM,WAAW,GAAG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B,YAAE,CAAC,aAAa,CAAC,aAAa,EAAE,IAAI,CAAC,SAAS,CAAC,kBAAU,CAAC,CAAC,CAAA;IAE3D,MAAM,CAAC,IAAI,CAAC,qCAAqC,WAAW,EAAE,CAAC,CAAA;AACjE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AgentContext, DocumentLoader } from '@credo-ts/core';
|
|
2
|
+
export declare const SECURITY_V1: any;
|
|
3
|
+
export declare const SECURITY_V2: any;
|
|
4
|
+
export declare const X25519_V1: any;
|
|
5
|
+
export declare const MULTIKEY_V1: any;
|
|
6
|
+
export declare const ED25519_2018_V1: any;
|
|
7
|
+
export declare const ED25519_2020_V1: any;
|
|
8
|
+
export declare const SECP256K1_2019_V1: any;
|
|
9
|
+
export declare const CREDENTIALS_V1: any;
|
|
10
|
+
export declare const CREDENTIALS_EXAMPLE_V1: any;
|
|
11
|
+
export declare const DID_V1: any;
|
|
12
|
+
export declare const ODRL: any;
|
|
13
|
+
export declare const SCHEMA_ORG: any;
|
|
14
|
+
export declare const PRESENTATION_SUBMISSION: any;
|
|
15
|
+
export declare const PURL_OB_V3P0: any;
|
|
16
|
+
export declare const VC_REVOCATION_LIST_2020: any;
|
|
17
|
+
export declare const DATA_INTEGRITY_V2: any;
|
|
18
|
+
export declare const LINKED_VP_V1: any;
|
|
19
|
+
export declare function defaultDocumentLoader(agentContext: AgentContext): DocumentLoader;
|
|
20
|
+
export interface JsonLd {
|
|
21
|
+
compact(document: any, context: any, options?: any): any;
|
|
22
|
+
fromRDF(document: any): any;
|
|
23
|
+
frame(document: any, revealDocument: any, options?: any): any;
|
|
24
|
+
canonize(document: any, options?: any): any;
|
|
25
|
+
expand(document: any, options?: any): any;
|
|
26
|
+
getValues(document: any, key: string): any;
|
|
27
|
+
addValue(document: any, key: string, value: any): void;
|
|
28
|
+
}
|
|
29
|
+
export interface DocumentLoaderResult {
|
|
30
|
+
contextUrl?: string | null;
|
|
31
|
+
documentUrl: string;
|
|
32
|
+
document: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
declare const _default: JsonLd;
|
|
35
|
+
export default _default;
|