@verana-labs/vs-agent-model 2.0.0-dev.2 → 2.0.0-dev.20
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/build/types.d.ts +4 -0
- package/build/utils/ecs.d.ts +12 -0
- package/build/utils/ecs.js +34 -7
- package/build/utils/ecs.js.map +1 -1
- package/package.json +1 -1
package/build/types.d.ts
CHANGED
|
@@ -25,12 +25,16 @@ export interface CredentialIssuanceRequest {
|
|
|
25
25
|
jsonSchemaCredentialId: string;
|
|
26
26
|
claims: JsonObject;
|
|
27
27
|
did?: string;
|
|
28
|
+
participantSessionId?: string;
|
|
29
|
+
agentParticipantId?: number;
|
|
30
|
+
walletAgentParticipantId?: number;
|
|
28
31
|
}
|
|
29
32
|
export interface CredentialIssuanceResponse {
|
|
30
33
|
status: number;
|
|
31
34
|
didcommInvitationUrl?: string;
|
|
32
35
|
jsonSchemaCredentialId?: string;
|
|
33
36
|
credential?: Record<string, unknown>;
|
|
37
|
+
digestJCS?: string;
|
|
34
38
|
}
|
|
35
39
|
export interface CredentialRevocationRequest {
|
|
36
40
|
format: 'jsonld' | 'anoncreds';
|
package/build/utils/ecs.d.ts
CHANGED
|
@@ -5,6 +5,18 @@ export declare enum ECS {
|
|
|
5
5
|
USER_AGENT = "ecs-user-agent",
|
|
6
6
|
BADGE = "ecs-badge"
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Registers the indexer base URL that serves schema references for a given chain id.
|
|
10
|
+
* Entries override the built-in defaults, so an agent connected to any chain can
|
|
11
|
+
* dereference `vpr:verana:<chain>:cs:<id>` references through its own indexer.
|
|
12
|
+
*/
|
|
13
|
+
export declare function configureChainIndexers(entries: Record<string, string | undefined>): void;
|
|
14
|
+
/**
|
|
15
|
+
* Resolves a schema reference to a fetchable URL. VPR URIs are mapped to the indexer
|
|
16
|
+
* registered for their chain; any other input (e.g. an HTTPS URL) is returned as is.
|
|
17
|
+
*
|
|
18
|
+
* @throws Error if the input is a VPR URI that cannot be mapped to an indexer URL.
|
|
19
|
+
*/
|
|
8
20
|
export declare function mapToEcosystem(input: string): string;
|
|
9
21
|
export declare const ECS_SCHEMA_DIGESTS: Record<ECS, string>;
|
|
10
22
|
export declare function computeSchemaDigest(schemaObj: Record<string, unknown>): Promise<string>;
|
package/build/utils/ecs.js
CHANGED
|
@@ -12,6 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.ECS_SCHEMA_DIGESTS = exports.ECS = void 0;
|
|
15
|
+
exports.configureChainIndexers = configureChainIndexers;
|
|
15
16
|
exports.mapToEcosystem = mapToEcosystem;
|
|
16
17
|
exports.computeSchemaDigest = computeSchemaDigest;
|
|
17
18
|
exports.identifySchema = identifySchema;
|
|
@@ -25,14 +26,40 @@ var ECS;
|
|
|
25
26
|
ECS["USER_AGENT"] = "ecs-user-agent";
|
|
26
27
|
ECS["BADGE"] = "ecs-badge";
|
|
27
28
|
})(ECS || (exports.ECS = ECS = {}));
|
|
28
|
-
const
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const DEFAULT_CHAIN_INDEXERS = {
|
|
30
|
+
'vna-testnet-1': 'https://idx.testnet.verana.network',
|
|
31
|
+
'vna-devnet-1': 'https://idx.devnet.verana.network',
|
|
32
|
+
};
|
|
33
|
+
const indexerByChain = new Map(Object.entries(DEFAULT_CHAIN_INDEXERS));
|
|
34
|
+
/**
|
|
35
|
+
* Registers the indexer base URL that serves schema references for a given chain id.
|
|
36
|
+
* Entries override the built-in defaults, so an agent connected to any chain can
|
|
37
|
+
* dereference `vpr:verana:<chain>:cs:<id>` references through its own indexer.
|
|
38
|
+
*/
|
|
39
|
+
function configureChainIndexers(entries) {
|
|
40
|
+
for (const [chainId, baseUrl] of Object.entries(entries)) {
|
|
41
|
+
if (!chainId || !baseUrl)
|
|
42
|
+
continue;
|
|
43
|
+
indexerByChain.set(chainId, baseUrl.replace(/\/+$/, ''));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Resolves a schema reference to a fetchable URL. VPR URIs are mapped to the indexer
|
|
48
|
+
* registered for their chain; any other input (e.g. an HTTPS URL) is returned as is.
|
|
49
|
+
*
|
|
50
|
+
* @throws Error if the input is a VPR URI that cannot be mapped to an indexer URL.
|
|
51
|
+
*/
|
|
32
52
|
function mapToEcosystem(input) {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
53
|
+
if (!input.startsWith('vpr:verana:'))
|
|
54
|
+
return input;
|
|
55
|
+
const ref = input.match(/^vpr:verana:([^:/]+):cs:(\d+)$/);
|
|
56
|
+
if (!ref)
|
|
57
|
+
throw new Error(`Malformed VPR schema reference "${input}"`);
|
|
58
|
+
const base = indexerByChain.get(ref[1]);
|
|
59
|
+
if (!base) {
|
|
60
|
+
throw new Error(`No indexer configured for chain "${ref[1]}" needed to resolve "${input}"`);
|
|
61
|
+
}
|
|
62
|
+
return `${base}/v4/credential-schema/js/${ref[2]}`;
|
|
36
63
|
}
|
|
37
64
|
// v4 spec [ECS-EC] reference digests
|
|
38
65
|
exports.ECS_SCHEMA_DIGESTS = {
|
package/build/utils/ecs.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecs.js","sourceRoot":"","sources":["../../src/utils/ecs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"ecs.js","sourceRoot":"","sources":["../../src/utils/ecs.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAoBA,wDAKC;AAQD,wCAWC;AA0BD,kDAUC;AAQD,wCAMC;AAmBD,wCAcC;AAED,wCAOC;AAxID,IAAY,GAMX;AAND,WAAY,GAAG;IACb,8BAAuB,CAAA;IACvB,sBAAe,CAAA;IACf,8BAAuB,CAAA;IACvB,oCAA6B,CAAA;IAC7B,0BAAmB,CAAA;AACrB,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