@verana-labs/vs-agent-sdk 1.11.0-dev.9 → 1.11.1-dev.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/README.md +172 -0
- package/build/agent/VsAgent.d.ts +15 -3
- package/build/agent/VsAgent.js +168 -40
- package/build/agent/VsAgent.js.map +1 -1
- package/build/agent/createVsAgent.d.ts +1 -1
- package/build/blockchain/IndexerWebSocketService.d.ts +39 -0
- package/build/blockchain/IndexerWebSocketService.js +217 -0
- package/build/blockchain/IndexerWebSocketService.js.map +1 -0
- package/build/blockchain/VeranaChainService.d.ts +2 -0
- package/build/blockchain/VeranaChainService.js +7 -4
- package/build/blockchain/VeranaChainService.js.map +1 -1
- package/build/blockchain/VeranaHelpers.d.ts +4 -0
- package/build/blockchain/VeranaHelpers.js +29 -0
- package/build/blockchain/VeranaHelpers.js.map +1 -0
- package/build/blockchain/VeranaIndexerService.d.ts +11 -0
- package/build/blockchain/VeranaIndexerService.js +43 -0
- package/build/blockchain/VeranaIndexerService.js.map +1 -0
- package/build/blockchain/handlers/IndexerHandlerRegistry.d.ts +25 -0
- package/build/blockchain/handlers/IndexerHandlerRegistry.js +34 -0
- package/build/blockchain/handlers/IndexerHandlerRegistry.js.map +1 -0
- package/build/blockchain/handlers/defaultHandlers.d.ts +6 -0
- package/build/blockchain/handlers/defaultHandlers.js +126 -0
- package/build/blockchain/handlers/defaultHandlers.js.map +1 -0
- package/build/blockchain/handlers/index.d.ts +3 -0
- package/build/blockchain/handlers/index.js +20 -0
- package/build/blockchain/handlers/index.js.map +1 -0
- package/build/blockchain/handlers/stateMutations.d.ts +12 -0
- package/build/blockchain/handlers/stateMutations.js +113 -0
- package/build/blockchain/handlers/stateMutations.js.map +1 -0
- package/build/blockchain/index.d.ts +4 -0
- package/build/blockchain/index.js +4 -0
- package/build/blockchain/index.js.map +1 -1
- package/build/blockchain/types.d.ts +107 -0
- package/build/blockchain/types.js +2 -1
- package/build/blockchain/types.js.map +1 -1
- package/build/did/WebDidRegistrar.d.ts +3 -1
- package/build/did/WebDidRegistrar.js +10 -1
- package/build/did/WebDidRegistrar.js.map +1 -1
- package/build/did/migrateWebVhLog.d.ts +34 -0
- package/build/did/migrateWebVhLog.js +230 -0
- package/build/did/migrateWebVhLog.js.map +1 -0
- package/build/index.d.ts +2 -0
- package/build/index.js +2 -0
- package/build/index.js.map +1 -1
- package/build/plugins/setupBaseDidComm.d.ts +2 -0
- package/build/plugins/setupBaseDidComm.js +9 -1
- package/build/plugins/setupBaseDidComm.js.map +1 -1
- package/build/transports/VsAgentWsInboundTransport.js +1 -1
- package/build/transports/VsAgentWsInboundTransport.js.map +1 -1
- package/build/utils/agent.d.ts +2 -1
- package/build/utils/agent.js +16 -10
- package/build/utils/agent.js.map +1 -1
- package/build/utils/setupSelfTr.d.ts +115 -0
- package/build/utils/setupSelfTr.js +452 -0
- package/build/utils/setupSelfTr.js.map +1 -0
- package/build/utils/trustCredentialStore.d.ts +18 -0
- package/build/utils/trustCredentialStore.js +196 -0
- package/build/utils/trustCredentialStore.js.map +1 -0
- package/package.json +13 -10
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { VsAgent } from '../../agent/VsAgent';
|
|
2
|
+
import { IndexerActivity, VeranaSyncState } from '../types';
|
|
3
|
+
export declare function upsertTrustRegistry(state: VeranaSyncState, activity: IndexerActivity): void;
|
|
4
|
+
export declare function bumpActiveGfVersion(state: VeranaSyncState, activity: IndexerActivity): void;
|
|
5
|
+
export declare function upsertCredentialSchema(state: VeranaSyncState, activity: IndexerActivity): void;
|
|
6
|
+
export declare function upsertPermission(state: VeranaSyncState, activity: IndexerActivity, overrides?: {
|
|
7
|
+
vpState?: string;
|
|
8
|
+
revoked?: boolean;
|
|
9
|
+
slashed?: boolean;
|
|
10
|
+
effectiveUntil?: string;
|
|
11
|
+
}): void;
|
|
12
|
+
export declare function publishVtjscIfOwner(state: VeranaSyncState, agent: VsAgent, schemaEntityId: string): Promise<void>;
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.upsertTrustRegistry = upsertTrustRegistry;
|
|
4
|
+
exports.bumpActiveGfVersion = bumpActiveGfVersion;
|
|
5
|
+
exports.upsertCredentialSchema = upsertCredentialSchema;
|
|
6
|
+
exports.upsertPermission = upsertPermission;
|
|
7
|
+
exports.publishVtjscIfOwner = publishVtjscIfOwner;
|
|
8
|
+
const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
|
|
9
|
+
const data_1 = require("../../utils/data");
|
|
10
|
+
const trustCredentialStore_1 = require("../../utils/trustCredentialStore");
|
|
11
|
+
const DEFAULT_CHAIN_ID = 'vna-testnet-1';
|
|
12
|
+
function upsertTrustRegistry(state, activity) {
|
|
13
|
+
var _a, _b, _c, _d, _e, _f;
|
|
14
|
+
const block = Number(activity.block_height) || 0;
|
|
15
|
+
const id = String(activity.entity_id);
|
|
16
|
+
const c = activity.changes;
|
|
17
|
+
const existing = state.trustRegistries[id];
|
|
18
|
+
state.trustRegistries[id] = {
|
|
19
|
+
id: Number(id),
|
|
20
|
+
did: String((_b = (_a = c['did']) !== null && _a !== void 0 ? _a : existing === null || existing === void 0 ? void 0 : existing.did) !== null && _b !== void 0 ? _b : ''),
|
|
21
|
+
controller: String((_d = (_c = c['controller']) !== null && _c !== void 0 ? _c : existing === null || existing === void 0 ? void 0 : existing.controller) !== null && _d !== void 0 ? _d : ''),
|
|
22
|
+
archived: Boolean((_f = (_e = c['archived']) !== null && _e !== void 0 ? _e : existing === null || existing === void 0 ? void 0 : existing.archived) !== null && _f !== void 0 ? _f : false),
|
|
23
|
+
activeGfVersion: existing === null || existing === void 0 ? void 0 : existing.activeGfVersion,
|
|
24
|
+
lastModifiedBlock: block,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function bumpActiveGfVersion(state, activity) {
|
|
28
|
+
var _a, _b, _c, _d;
|
|
29
|
+
const block = Number(activity.block_height) || 0;
|
|
30
|
+
const id = String(activity.entity_id);
|
|
31
|
+
const existing = state.trustRegistries[id];
|
|
32
|
+
state.trustRegistries[id] = {
|
|
33
|
+
id: Number(id),
|
|
34
|
+
did: String((_a = existing === null || existing === void 0 ? void 0 : existing.did) !== null && _a !== void 0 ? _a : ''),
|
|
35
|
+
controller: String((_b = existing === null || existing === void 0 ? void 0 : existing.controller) !== null && _b !== void 0 ? _b : ''),
|
|
36
|
+
archived: (_c = existing === null || existing === void 0 ? void 0 : existing.archived) !== null && _c !== void 0 ? _c : false,
|
|
37
|
+
activeGfVersion: ((_d = existing === null || existing === void 0 ? void 0 : existing.activeGfVersion) !== null && _d !== void 0 ? _d : 0) + 1,
|
|
38
|
+
lastModifiedBlock: block,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function upsertCredentialSchema(state, activity) {
|
|
42
|
+
var _a, _b, _c, _d, _e;
|
|
43
|
+
const block = Number(activity.block_height) || 0;
|
|
44
|
+
const id = String(activity.entity_id);
|
|
45
|
+
const c = activity.changes;
|
|
46
|
+
const existing = state.credentialSchemas[id];
|
|
47
|
+
const archivedRaw = c['archived'];
|
|
48
|
+
const archived = archivedRaw !== undefined ? archivedRaw !== null && archivedRaw !== false : ((_a = existing === null || existing === void 0 ? void 0 : existing.archived) !== null && _a !== void 0 ? _a : false);
|
|
49
|
+
state.credentialSchemas[id] = {
|
|
50
|
+
id: Number(id),
|
|
51
|
+
trId: Number((_c = (_b = c['tr_id']) !== null && _b !== void 0 ? _b : existing === null || existing === void 0 ? void 0 : existing.trId) !== null && _c !== void 0 ? _c : 0),
|
|
52
|
+
jsonSchema: String((_e = (_d = c['json_schema']) !== null && _d !== void 0 ? _d : existing === null || existing === void 0 ? void 0 : existing.jsonSchema) !== null && _e !== void 0 ? _e : ''),
|
|
53
|
+
issuerMode: c['issuer_perm_management_mode']
|
|
54
|
+
? String(c['issuer_perm_management_mode'])
|
|
55
|
+
: existing === null || existing === void 0 ? void 0 : existing.issuerMode,
|
|
56
|
+
verifierMode: c['verifier_perm_management_mode']
|
|
57
|
+
? String(c['verifier_perm_management_mode'])
|
|
58
|
+
: existing === null || existing === void 0 ? void 0 : existing.verifierMode,
|
|
59
|
+
archived,
|
|
60
|
+
lastModifiedBlock: block,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function upsertPermission(state, activity, overrides = {}) {
|
|
64
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
65
|
+
const block = Number(activity.block_height) || 0;
|
|
66
|
+
const id = String(activity.entity_id);
|
|
67
|
+
const c = activity.changes;
|
|
68
|
+
const existing = state.permissions[id];
|
|
69
|
+
state.permissions[id] = {
|
|
70
|
+
id: Number(id),
|
|
71
|
+
schemaId: Number((_b = (_a = c['schema_id']) !== null && _a !== void 0 ? _a : existing === null || existing === void 0 ? void 0 : existing.schemaId) !== null && _b !== void 0 ? _b : 0),
|
|
72
|
+
did: String((_d = (_c = c['did']) !== null && _c !== void 0 ? _c : existing === null || existing === void 0 ? void 0 : existing.did) !== null && _d !== void 0 ? _d : ''),
|
|
73
|
+
type: Number((_f = (_e = c['type']) !== null && _e !== void 0 ? _e : existing === null || existing === void 0 ? void 0 : existing.type) !== null && _f !== void 0 ? _f : 0),
|
|
74
|
+
vpState: (_g = overrides.vpState) !== null && _g !== void 0 ? _g : String((_j = (_h = c['vp_state']) !== null && _h !== void 0 ? _h : existing === null || existing === void 0 ? void 0 : existing.vpState) !== null && _j !== void 0 ? _j : ''),
|
|
75
|
+
effectiveUntil: (_l = (_k = overrides.effectiveUntil) !== null && _k !== void 0 ? _k : existing === null || existing === void 0 ? void 0 : existing.effectiveUntil) !== null && _l !== void 0 ? _l : '',
|
|
76
|
+
revoked: (_o = (_m = overrides.revoked) !== null && _m !== void 0 ? _m : existing === null || existing === void 0 ? void 0 : existing.revoked) !== null && _o !== void 0 ? _o : false,
|
|
77
|
+
slashed: (_q = (_p = overrides.slashed) !== null && _p !== void 0 ? _p : existing === null || existing === void 0 ? void 0 : existing.slashed) !== null && _q !== void 0 ? _q : false,
|
|
78
|
+
lastModifiedBlock: block,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
async function publishVtjscIfOwner(state, agent, schemaEntityId) {
|
|
82
|
+
var _a, _b;
|
|
83
|
+
const schema = state.credentialSchemas[schemaEntityId];
|
|
84
|
+
if (!schema) {
|
|
85
|
+
agent.config.logger.warn(`[VTJSC] Schema ${schemaEntityId} not found in state`);
|
|
86
|
+
}
|
|
87
|
+
const tr = state.trustRegistries[String(schema.trId)];
|
|
88
|
+
if (!tr) {
|
|
89
|
+
agent.config.logger.warn(`[VTJSC] Trust Registry ${schema.trId} not found in state`);
|
|
90
|
+
}
|
|
91
|
+
const chainId = (_b = (_a = agent.veranaChain) === null || _a === void 0 ? void 0 : _a.getChainId) !== null && _b !== void 0 ? _b : DEFAULT_CHAIN_ID;
|
|
92
|
+
const jsonSchemaRef = `vpr:verana:${chainId}/cs/v1/js/${schema.id}`;
|
|
93
|
+
let digestSRI;
|
|
94
|
+
try {
|
|
95
|
+
digestSRI = await (0, vs_agent_model_1.computeSchemaDigest)(JSON.parse(schema.jsonSchema));
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
agent.config.logger.error(`[VTJSC] Failed to parse/digest schema ${schemaEntityId}`, e);
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
try {
|
|
102
|
+
await (0, trustCredentialStore_1.createJsc)(agent, agent.publicApiBaseUrl, (0, data_1.getEcsSchemas)(agent.publicApiBaseUrl), {
|
|
103
|
+
schemaBaseId: String(schema.id),
|
|
104
|
+
jsonSchemaRef,
|
|
105
|
+
precomputedDigestSRI: digestSRI,
|
|
106
|
+
});
|
|
107
|
+
agent.config.logger.info(`[VTJSC] Published VTJSC for schema ${schema.id} (TR ${schema.trId}) at block ${state.lastBlockHeight}`);
|
|
108
|
+
}
|
|
109
|
+
catch (e) {
|
|
110
|
+
agent.config.logger.error(`[VTJSC] Failed to publish VTJSC for schema ${schema.id}`, e);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=stateMutations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateMutations.js","sourceRoot":"","sources":["../../../src/blockchain/handlers/stateMutations.ts"],"names":[],"mappings":";;AASA,kDAcC;AAED,kDAaC;AAED,wDAuBC;AAED,4CA0BC;AAED,kDAsCC;AAnID,gEAAiE;AAGjE,2CAAgD;AAChD,2EAA4D;AAG5D,MAAM,gBAAgB,GAAG,eAAe,CAAA;AAExC,SAAgB,mBAAmB,CAAC,KAAsB,EAAE,QAAyB;;IACnF,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAA;IAChD,MAAM,EAAE,GAAG,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;IACrC,MAAM,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAA;IAC1B,MAAM,QAAQ,GAAG,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,CAAA;IAE1C,KAAK,CAAC,eAAe,CAAC,EAAE,CAAC,GAAG;QAC1B,EAAE,EAAE,MAAM,CAAC,EAAE,CAAC;QACd,GAAG,EAAE,MAAM,CAAC,MAAA,MAAA,CAAC,CAAC,KAAK,CAAC,mCAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,GAAG,mCAAI,EAAE,CAAC;QAC5C,UAAU,EAAE,MAAM,CAAC,MAAA,MAAA,CAAC,CAAC,YAAY,CAAC,mCAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,UAAU,mCAAI,EAAE,CAAC;QACjE,QAAQ,EAAE,OAAO,CAAC,MAAA,MAAA,CAAC,CAAC,UAAU,CAAC,mCAAI,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,mCAAI,KAAK,CAAC;QAC/D,eAAe,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K,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CACtB,sCAAsC,MAAM,CAAC,EAAE,QAAQ,MAAM,CAAC,IAAI,cAAc,KAAK,CAAC,eAAe,EAAE,CACxG,CAAA;IACH,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,8CAA8C,MAAM,CAAC,EAAE,EAAE,EAAE,CAAU,CAAC,CAAA;IAClG,CAAC;AACH,CAAC"}
|
|
@@ -14,6 +14,10 @@ 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("./IndexerWebSocketService"), exports);
|
|
18
|
+
__exportStar(require("./VeranaHelpers"), exports);
|
|
17
19
|
__exportStar(require("./VeranaChainService"), exports);
|
|
20
|
+
__exportStar(require("./VeranaIndexerService"), exports);
|
|
18
21
|
__exportStar(require("./types"), exports);
|
|
22
|
+
__exportStar(require("./handlers"), exports);
|
|
19
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/blockchain/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAoC;AACpC,0CAAuB"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/blockchain/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4DAAyC;AACzC,kDAA+B;AAC/B,uDAAoC;AACpC,yDAAsC;AACtC,0CAAuB;AACvB,6CAA0B"}
|
|
@@ -1,5 +1,112 @@
|
|
|
1
1
|
import { BaseLogger } from '@credo-ts/core';
|
|
2
2
|
export declare const VERANA_BECH32_PREFIX = "verana";
|
|
3
|
+
export declare const RECORD_ID = "verana-blockchain-sync-state";
|
|
4
|
+
export type IndexerEventRecord = {
|
|
5
|
+
type: 'indexer-event';
|
|
6
|
+
event_type: string;
|
|
7
|
+
did: string;
|
|
8
|
+
block_height: number;
|
|
9
|
+
tx_hash: string;
|
|
10
|
+
timestamp: string;
|
|
11
|
+
payload: {
|
|
12
|
+
module: string;
|
|
13
|
+
action: string;
|
|
14
|
+
message_type: string;
|
|
15
|
+
tx_index: number;
|
|
16
|
+
message_index: number;
|
|
17
|
+
sender: string;
|
|
18
|
+
related_dids: string[];
|
|
19
|
+
entity_type?: string;
|
|
20
|
+
entity_id?: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export interface IndexerEventsResponse {
|
|
24
|
+
events: IndexerEventRecord[];
|
|
25
|
+
count: number;
|
|
26
|
+
after_block_height: number;
|
|
27
|
+
}
|
|
28
|
+
export type IndexerEntityType = 'TrustRegistry' | 'CredentialSchema' | 'Permission' | 'PermissionSession' | 'TrustDeposit';
|
|
29
|
+
export interface IndexerActivity {
|
|
30
|
+
timestamp: string;
|
|
31
|
+
block_height: string | number;
|
|
32
|
+
entity_type: IndexerEntityType | string;
|
|
33
|
+
entity_id: string;
|
|
34
|
+
msg: string;
|
|
35
|
+
changes: Record<string, unknown>;
|
|
36
|
+
account?: string;
|
|
37
|
+
}
|
|
38
|
+
export interface IndexerChangesResponse {
|
|
39
|
+
block_height: number;
|
|
40
|
+
next_change_at: number | null;
|
|
41
|
+
activity: IndexerActivity[];
|
|
42
|
+
}
|
|
43
|
+
export interface VeranaIdxConfig {
|
|
44
|
+
baseUrl: string;
|
|
45
|
+
logger: BaseLogger;
|
|
46
|
+
}
|
|
47
|
+
export interface SyncedTrustRegistry {
|
|
48
|
+
id: number;
|
|
49
|
+
did: string;
|
|
50
|
+
controller: string;
|
|
51
|
+
archived: boolean;
|
|
52
|
+
activeGfVersion?: number;
|
|
53
|
+
lastModifiedBlock: number;
|
|
54
|
+
}
|
|
55
|
+
export interface SyncedCredentialSchema {
|
|
56
|
+
id: number;
|
|
57
|
+
trId: number;
|
|
58
|
+
jsonSchema: string;
|
|
59
|
+
issuerMode?: string;
|
|
60
|
+
verifierMode?: string;
|
|
61
|
+
archived: boolean;
|
|
62
|
+
lastModifiedBlock: number;
|
|
63
|
+
}
|
|
64
|
+
export interface SyncedPermission {
|
|
65
|
+
id: number;
|
|
66
|
+
schemaId: number;
|
|
67
|
+
did: string;
|
|
68
|
+
type: number;
|
|
69
|
+
vpState?: string;
|
|
70
|
+
effectiveUntil?: string;
|
|
71
|
+
revoked: boolean;
|
|
72
|
+
slashed: boolean;
|
|
73
|
+
lastModifiedBlock: number;
|
|
74
|
+
}
|
|
75
|
+
export interface VeranaSyncState {
|
|
76
|
+
lastBlockHeight: number;
|
|
77
|
+
trustRegistries: Record<string, SyncedTrustRegistry>;
|
|
78
|
+
credentialSchemas: Record<string, SyncedCredentialSchema>;
|
|
79
|
+
permissions: Record<string, SyncedPermission>;
|
|
80
|
+
}
|
|
81
|
+
export interface TrustRegistryDto {
|
|
82
|
+
id: number;
|
|
83
|
+
did: string;
|
|
84
|
+
controller: string;
|
|
85
|
+
archived: string | null;
|
|
86
|
+
active_gf_version?: number;
|
|
87
|
+
}
|
|
88
|
+
export interface CredentialSchemaDto {
|
|
89
|
+
id: number;
|
|
90
|
+
tr_id: number;
|
|
91
|
+
json_schema: string;
|
|
92
|
+
issuer_perm_management_mode?: string;
|
|
93
|
+
verifier_perm_management_mode?: string;
|
|
94
|
+
archived: string | null;
|
|
95
|
+
created: string;
|
|
96
|
+
modified: string;
|
|
97
|
+
}
|
|
98
|
+
export interface PermissionDto {
|
|
99
|
+
id: number;
|
|
100
|
+
schema_id: number;
|
|
101
|
+
did: string | null;
|
|
102
|
+
type: number;
|
|
103
|
+
perm_state: 'ACTIVE' | 'REVOKED' | 'SLASHED' | 'REPAID' | 'EXPIRED' | 'FUTURE' | 'INACTIVE';
|
|
104
|
+
vp_state?: string;
|
|
105
|
+
revoked: string | null;
|
|
106
|
+
slashed: string | null;
|
|
107
|
+
effective_until?: string;
|
|
108
|
+
modified: string;
|
|
109
|
+
}
|
|
3
110
|
export interface PermQueryClient {
|
|
4
111
|
GetPermission(req: {
|
|
5
112
|
id: Long;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VERANA_BECH32_PREFIX = void 0;
|
|
3
|
+
exports.RECORD_ID = exports.VERANA_BECH32_PREFIX = void 0;
|
|
4
4
|
exports.VERANA_BECH32_PREFIX = 'verana';
|
|
5
|
+
exports.RECORD_ID = 'verana-blockchain-sync-state';
|
|
5
6
|
//# sourceMappingURL=types.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/blockchain/types.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAG,QAAQ,CAAA"}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/blockchain/types.ts"],"names":[],"mappings":";;;AAEa,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAC/B,QAAA,SAAS,GAAG,8BAA8B,CAAA"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { AgentContext, DidCreateOptions, DidCreateResult, DidDeactivateOptions, DidDeactivateResult, DidRegistrar, DidUpdateOptions, DidUpdateResult, DidDocument } from '@credo-ts/core';
|
|
1
|
+
import { AgentContext, DidCreateOptions, DidCreateResult, DidDeactivateOptions, DidDeactivateResult, DidDocumentKey, DidRegistrar, DidUpdateOptions, DidUpdateResult, DidDocument } from '@credo-ts/core';
|
|
2
2
|
interface WebDidCreateOptions extends DidCreateOptions {
|
|
3
3
|
domain: string;
|
|
4
|
+
keys?: DidDocumentKey[];
|
|
4
5
|
}
|
|
5
6
|
interface WebDidUpdateOptions extends DidUpdateOptions {
|
|
6
7
|
didDocument: DidDocument;
|
|
7
8
|
domain?: string;
|
|
9
|
+
keys?: DidDocumentKey[];
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* DID Registrar implementation for the 'webvh' method.
|
|
@@ -36,6 +36,7 @@ class WebDidRegistrar {
|
|
|
36
36
|
did,
|
|
37
37
|
didDocument,
|
|
38
38
|
role: core_1.DidDocumentRole.Created,
|
|
39
|
+
keys: options.keys,
|
|
39
40
|
});
|
|
40
41
|
didRecord.setTags({ domain });
|
|
41
42
|
await didRepository.save(agentContext, didRecord);
|
|
@@ -61,7 +62,7 @@ class WebDidRegistrar {
|
|
|
61
62
|
* @returns The result of the DID update, with error handling and validation.
|
|
62
63
|
*/
|
|
63
64
|
async update(agentContext, options) {
|
|
64
|
-
var _a;
|
|
65
|
+
var _a, _b, _c;
|
|
65
66
|
try {
|
|
66
67
|
const { domain } = options;
|
|
67
68
|
const did = (_a = options.did) !== null && _a !== void 0 ? _a : `did:web:${domain}`;
|
|
@@ -76,6 +77,14 @@ class WebDidRegistrar {
|
|
|
76
77
|
if (!didRecord)
|
|
77
78
|
return this.handleError('Did not found');
|
|
78
79
|
didRecord.didDocument = inputDidDocument;
|
|
80
|
+
if ((_b = options.keys) === null || _b === void 0 ? void 0 : _b.length) {
|
|
81
|
+
const existingKeys = (_c = didRecord.keys) !== null && _c !== void 0 ? _c : [];
|
|
82
|
+
const existingIds = new Set(existingKeys.map(k => k.didDocumentRelativeKeyId));
|
|
83
|
+
didRecord.keys = [
|
|
84
|
+
...existingKeys,
|
|
85
|
+
...options.keys.filter(k => !existingIds.has(k.didDocumentRelativeKeyId)),
|
|
86
|
+
];
|
|
87
|
+
}
|
|
79
88
|
await didRepository.update(agentContext, didRecord);
|
|
80
89
|
return {
|
|
81
90
|
didDocumentMetadata: {},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebDidRegistrar.js","sourceRoot":"","sources":["../../src/did/WebDidRegistrar.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"WebDidRegistrar.js","sourceRoot":"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Log, Signer, Verifier } from 'didwebvh-ts';
|
|
3
|
+
export interface RebuildWebVhLogOptions {
|
|
4
|
+
/** Signer using a key that matches the active `updateKeys[0]` of the rebuilt prefix. */
|
|
5
|
+
signer: Signer;
|
|
6
|
+
/** Verifier used both for resolution checks and for the `documentStateIsValid` step inside `updateDID`. */
|
|
7
|
+
verifier: Verifier;
|
|
8
|
+
/** Optional domain hint (matches the tag stored on the DidRecord). */
|
|
9
|
+
domain?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Pure rebuild logic, decoupled from credo / askar so it can be unit-tested.
|
|
13
|
+
*
|
|
14
|
+
* If `log` resolves cleanly under the current didwebvh-ts version, returns `null`
|
|
15
|
+
* (nothing to do). Otherwise, if the failure is the known `<2.7.4` "hash chain
|
|
16
|
+
* broken" bug, rebuilds entries 2..N (preserving entry #1, SCID, every entry's
|
|
17
|
+
* `state` and `parameters`) and returns the new log. For any other resolution
|
|
18
|
+
* error, returns `null` and lets the caller decide what to do.
|
|
19
|
+
*/
|
|
20
|
+
export declare function rebuildWebVhLog(log: DIDLog, { signer, verifier, domain }: RebuildWebVhLogOptions): Promise<DIDLog | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Detect a `did:webvh` log that became unresolvable because of the
|
|
23
|
+
* `didwebvh-ts` <2.7.4 entry-hash bug (placeholder versionId used for entries
|
|
24
|
+
* after the first). If so, rebuild the log preserving:
|
|
25
|
+
* - entry #1 byte-for-byte (preserving the SCID and therefore the public DID)
|
|
26
|
+
* - the `state` and `parameters` of entries 2..N (services, keys, controller, etc.)
|
|
27
|
+
*
|
|
28
|
+
* Only the entryHash and proof of entries 2..N are recomputed/re-signed using
|
|
29
|
+
* the controller key the agent already holds in askar.
|
|
30
|
+
*
|
|
31
|
+
* Returns true if migration ran successfully, false if it was not needed.
|
|
32
|
+
* Throws if the rebuild fails or the result is somehow invalid.
|
|
33
|
+
*/
|
|
34
|
+
export declare function migrateWebVhLogIfBroken(agentContext: AgentContext, didRecord: DidRecord, logger: Logger): Promise<boolean>;
|
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.rebuildWebVhLog = rebuildWebVhLog;
|
|
4
|
+
exports.migrateWebVhLogIfBroken = migrateWebVhLogIfBroken;
|
|
5
|
+
const askar_1 = require("@credo-ts/askar");
|
|
6
|
+
const core_1 = require("@credo-ts/core");
|
|
7
|
+
const askar_shared_1 = require("@openwallet-foundation/askar-shared");
|
|
8
|
+
const didwebvh_ts_1 = require("didwebvh-ts");
|
|
9
|
+
/**
|
|
10
|
+
* Verifier that delegates Ed25519 verification to the agent's KMS.
|
|
11
|
+
*/
|
|
12
|
+
class KmsVerifier {
|
|
13
|
+
constructor(agentContext) {
|
|
14
|
+
this.agentContext = agentContext;
|
|
15
|
+
}
|
|
16
|
+
async verify(signature, message, publicKey) {
|
|
17
|
+
try {
|
|
18
|
+
const kms = this.agentContext.dependencyManager.resolve(core_1.Kms.KeyManagementApi);
|
|
19
|
+
const publicJwk = core_1.Kms.PublicJwk.fromPublicKey({ kty: 'OKP', crv: 'Ed25519', publicKey });
|
|
20
|
+
const { verified } = await kms.verify({
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
22
|
+
key: { publicJwk: publicJwk.toJson() },
|
|
23
|
+
algorithm: 'EdDSA',
|
|
24
|
+
signature,
|
|
25
|
+
data: message,
|
|
26
|
+
});
|
|
27
|
+
return verified;
|
|
28
|
+
}
|
|
29
|
+
catch (_a) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Signer that signs with an Ed25519 key managed by the agent's KMS,
|
|
36
|
+
* exposing the public key as a `did:key:` verification method id.
|
|
37
|
+
*/
|
|
38
|
+
class KmsSigner {
|
|
39
|
+
constructor(agentContext, kmsKeyId, publicKeyMultibase) {
|
|
40
|
+
this.agentContext = agentContext;
|
|
41
|
+
this.kmsKeyId = kmsKeyId;
|
|
42
|
+
this.publicKeyMultibase = publicKeyMultibase;
|
|
43
|
+
}
|
|
44
|
+
getVerificationMethodId() {
|
|
45
|
+
return `did:key:${this.publicKeyMultibase}`;
|
|
46
|
+
}
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
|
+
async sign(input) {
|
|
49
|
+
const kms = this.agentContext.dependencyManager.resolve(core_1.Kms.KeyManagementApi);
|
|
50
|
+
const data = await (0, didwebvh_ts_1.prepareDataForSigning)(input.document, input.proof);
|
|
51
|
+
const { signature } = await kms.sign({
|
|
52
|
+
keyId: this.kmsKeyId,
|
|
53
|
+
algorithm: 'EdDSA',
|
|
54
|
+
data,
|
|
55
|
+
});
|
|
56
|
+
return { proofValue: (0, didwebvh_ts_1.multibaseEncode)(signature, didwebvh_ts_1.MultibaseEncoding.BASE58_BTC) };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
const normalizeMethodArray = (arr) =>
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
+
arr === null || arr === void 0 ? void 0 : arr.map((item) => (typeof item === 'string' ? item : item.id));
|
|
63
|
+
/**
|
|
64
|
+
* `resolveDIDFromLog` throws on validation failures (hash chain, signature,
|
|
65
|
+
* etc.). Normalize that into a discriminated result so callers can branch on
|
|
66
|
+
* the failure mode without try/catch boilerplate.
|
|
67
|
+
*/
|
|
68
|
+
async function tryResolveLog(log, verifier) {
|
|
69
|
+
try {
|
|
70
|
+
await (0, didwebvh_ts_1.resolveDIDFromLog)(log, { verifier });
|
|
71
|
+
return { ok: true };
|
|
72
|
+
}
|
|
73
|
+
catch (error) {
|
|
74
|
+
return { ok: false, reason: error instanceof Error ? error.message : String(error) };
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Pure rebuild logic, decoupled from credo / askar so it can be unit-tested.
|
|
79
|
+
*
|
|
80
|
+
* If `log` resolves cleanly under the current didwebvh-ts version, returns `null`
|
|
81
|
+
* (nothing to do). Otherwise, if the failure is the known `<2.7.4` "hash chain
|
|
82
|
+
* broken" bug, rebuilds entries 2..N (preserving entry #1, SCID, every entry's
|
|
83
|
+
* `state` and `parameters`) and returns the new log. For any other resolution
|
|
84
|
+
* error, returns `null` and lets the caller decide what to do.
|
|
85
|
+
*/
|
|
86
|
+
async function rebuildWebVhLog(log, { signer, verifier, domain }) {
|
|
87
|
+
var _a, _b, _c;
|
|
88
|
+
if (!log || log.length === 0)
|
|
89
|
+
return null;
|
|
90
|
+
const initial = await tryResolveLog(log, verifier);
|
|
91
|
+
if (initial.ok)
|
|
92
|
+
return null;
|
|
93
|
+
if (!/hash chain broken/i.test(initial.reason))
|
|
94
|
+
return null;
|
|
95
|
+
if (log.length < 2)
|
|
96
|
+
return null;
|
|
97
|
+
const originalScid = log[0].parameters.scid;
|
|
98
|
+
let newLog = [log[0]];
|
|
99
|
+
for (let i = 1; i < log.length; i++) {
|
|
100
|
+
const oldEntry = log[i];
|
|
101
|
+
const oldState = oldEntry.state;
|
|
102
|
+
const oldParams = oldEntry.parameters;
|
|
103
|
+
const lastParams = newLog[newLog.length - 1].parameters;
|
|
104
|
+
const activeUpdateKeys = (_a = lastParams.updateKeys) !== null && _a !== void 0 ? _a : [];
|
|
105
|
+
if (activeUpdateKeys.length === 0) {
|
|
106
|
+
throw new Error(`Cannot rebuild webvh log: no active updateKeys at entry ${i + 1}`);
|
|
107
|
+
}
|
|
108
|
+
const controllerValue = Array.isArray(oldState.controller) ? oldState.controller[0] : oldState.controller;
|
|
109
|
+
const { log: rebuilt } = await (0, didwebvh_ts_1.updateDID)({
|
|
110
|
+
log: newLog,
|
|
111
|
+
signer,
|
|
112
|
+
verifier,
|
|
113
|
+
domain,
|
|
114
|
+
updateKeys: (_b = oldParams.updateKeys) !== null && _b !== void 0 ? _b : activeUpdateKeys,
|
|
115
|
+
verificationMethods: oldState.verificationMethod,
|
|
116
|
+
services: oldState.service,
|
|
117
|
+
controller: controllerValue,
|
|
118
|
+
authentication: normalizeMethodArray(oldState.authentication),
|
|
119
|
+
assertionMethod: normalizeMethodArray(oldState.assertionMethod),
|
|
120
|
+
keyAgreement: normalizeMethodArray(oldState.keyAgreement),
|
|
121
|
+
alsoKnownAs: oldState.alsoKnownAs,
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
123
|
+
context: oldState['@context'],
|
|
124
|
+
portable: oldParams.portable,
|
|
125
|
+
nextKeyHashes: oldParams.nextKeyHashes,
|
|
126
|
+
// Forward witness only when it carries meaningful values. Passing an empty
|
|
127
|
+
// `{}` would make `updateDID` expand it into `{ threshold: 0, witnesses: [] }`,
|
|
128
|
+
// which then no longer matches the original entry's parameters.
|
|
129
|
+
witness: oldParams.witness && (((_c = oldParams.witness.witnesses) === null || _c === void 0 ? void 0 : _c.length) || oldParams.witness.threshold)
|
|
130
|
+
? oldParams.witness
|
|
131
|
+
: undefined,
|
|
132
|
+
watchers: oldParams.watchers,
|
|
133
|
+
updated: oldEntry.versionTime,
|
|
134
|
+
});
|
|
135
|
+
newLog = rebuilt;
|
|
136
|
+
}
|
|
137
|
+
const verify = await tryResolveLog(newLog, verifier);
|
|
138
|
+
if (!verify.ok) {
|
|
139
|
+
throw new Error(`Rebuilt webvh log is still invalid: ${verify.reason}`);
|
|
140
|
+
}
|
|
141
|
+
if (newLog[0].parameters.scid !== originalScid) {
|
|
142
|
+
// Should be impossible since entry #1 is unchanged, but guard anyway.
|
|
143
|
+
throw new Error(`Rebuilt webvh log produced a different SCID; aborting migration`);
|
|
144
|
+
}
|
|
145
|
+
return newLog;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Scans all Ed25519 keys in the Askar store and returns the key name
|
|
149
|
+
* whose public key matches the given multibase fingerprint.
|
|
150
|
+
* Used to recover a lost kmsKeyId when didRecord.keys is empty after a schema upgrade.
|
|
151
|
+
*/
|
|
152
|
+
async function findKmsKeyIdForFingerprint(agentContext, fingerprint) {
|
|
153
|
+
try {
|
|
154
|
+
const storeManager = agentContext.dependencyManager.resolve(askar_1.AskarStoreManager);
|
|
155
|
+
return await storeManager.withSession(agentContext, async (session) => {
|
|
156
|
+
const entries = await session.fetchAllKeys({ algorithm: askar_shared_1.KeyAlgorithm.Ed25519 });
|
|
157
|
+
for (const entry of entries) {
|
|
158
|
+
const pubBytes = entry.key.publicBytes;
|
|
159
|
+
const computed = (0, didwebvh_ts_1.multibaseEncode)(new Uint8Array([237, 1, ...pubBytes]), didwebvh_ts_1.MultibaseEncoding.BASE58_BTC);
|
|
160
|
+
entry.key.handle.free();
|
|
161
|
+
if (computed === fingerprint)
|
|
162
|
+
return entry.name;
|
|
163
|
+
}
|
|
164
|
+
return undefined;
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
catch (_a) {
|
|
168
|
+
agentContext.config.logger.warn(`Failed to scan Askar keys, cannot recover controller key for webvh log migration`);
|
|
169
|
+
return undefined;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Detect a `did:webvh` log that became unresolvable because of the
|
|
174
|
+
* `didwebvh-ts` <2.7.4 entry-hash bug (placeholder versionId used for entries
|
|
175
|
+
* after the first). If so, rebuild the log preserving:
|
|
176
|
+
* - entry #1 byte-for-byte (preserving the SCID and therefore the public DID)
|
|
177
|
+
* - the `state` and `parameters` of entries 2..N (services, keys, controller, etc.)
|
|
178
|
+
*
|
|
179
|
+
* Only the entryHash and proof of entries 2..N are recomputed/re-signed using
|
|
180
|
+
* the controller key the agent already holds in askar.
|
|
181
|
+
*
|
|
182
|
+
* Returns true if migration ran successfully, false if it was not needed.
|
|
183
|
+
* Throws if the rebuild fails or the result is somehow invalid.
|
|
184
|
+
*/
|
|
185
|
+
async function migrateWebVhLogIfBroken(agentContext, didRecord, logger) {
|
|
186
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
187
|
+
const log = didRecord.metadata.get('log');
|
|
188
|
+
if (!log || log.length === 0)
|
|
189
|
+
return false;
|
|
190
|
+
const verifier = new KmsVerifier(agentContext);
|
|
191
|
+
// Cheap pre-check so we can produce a clear log message before doing real work.
|
|
192
|
+
const preCheck = await tryResolveLog(log, verifier);
|
|
193
|
+
if (preCheck.ok)
|
|
194
|
+
return false;
|
|
195
|
+
if (!/hash chain broken/i.test(preCheck.reason)) {
|
|
196
|
+
logger.warn(`webvh DID log for ${didRecord.did} is invalid and not eligible for hash-chain migration: ${preCheck.reason}`);
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
const domain = didRecord.getTag('domain');
|
|
200
|
+
const activeUpdateKey = (_b = (_a = log[log.length - 1].parameters.updateKeys) === null || _a === void 0 ? void 0 : _a[0]) !== null && _b !== void 0 ? _b : (_c = log[0].parameters.updateKeys) === null || _c === void 0 ? void 0 : _c[0];
|
|
201
|
+
if (!activeUpdateKey) {
|
|
202
|
+
throw new Error(`Cannot migrate webvh log for ${didRecord.did}: no updateKeys present`);
|
|
203
|
+
}
|
|
204
|
+
let kmsKeyId = (_e = (_d = didRecord.keys) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.kmsKeyId;
|
|
205
|
+
if (!kmsKeyId) {
|
|
206
|
+
// The key mapping may have been lost after a schema update.
|
|
207
|
+
// Try to recover the key from Askar using the update key fingerprint.
|
|
208
|
+
kmsKeyId = await findKmsKeyIdForFingerprint(agentContext, activeUpdateKey);
|
|
209
|
+
if (!kmsKeyId) {
|
|
210
|
+
throw new Error(`Cannot migrate webvh log for ${didRecord.did}: no controller key on DID record`);
|
|
211
|
+
}
|
|
212
|
+
logger.warn(`webvh DID ${didRecord.did}: controller key recovered from Askar scan`);
|
|
213
|
+
// Update the DID record with the recovered key.
|
|
214
|
+
const vm = (_g = (_f = didRecord.didDocument) === null || _f === void 0 ? void 0 : _f.verificationMethod) === null || _g === void 0 ? void 0 : _g.find(v => v.publicKeyMultibase === activeUpdateKey);
|
|
215
|
+
const relativeKeyId = (vm === null || vm === void 0 ? void 0 : vm.id) ? `#${vm.id.split('#')[1]}` : '#key-1';
|
|
216
|
+
didRecord.keys = [{ kmsKeyId, didDocumentRelativeKeyId: relativeKeyId }];
|
|
217
|
+
}
|
|
218
|
+
logger.warn(`webvh DID log for ${didRecord.did} is invalid (likely legacy didwebvh-ts <2.7.4 hash bug). ` +
|
|
219
|
+
`Rebuilding entries 2..${log.length} while preserving SCID.`);
|
|
220
|
+
const signer = new KmsSigner(agentContext, kmsKeyId, activeUpdateKey);
|
|
221
|
+
const newLog = await rebuildWebVhLog(log, { signer, verifier, domain });
|
|
222
|
+
if (!newLog)
|
|
223
|
+
return false;
|
|
224
|
+
didRecord.metadata.set('log', newLog);
|
|
225
|
+
const didRepository = agentContext.dependencyManager.resolve(core_1.DidRepository);
|
|
226
|
+
await didRepository.update(agentContext, didRecord);
|
|
227
|
+
logger.info(`webvh DID log for ${didRecord.did} successfully migrated; ${newLog.length} entries; SCID preserved (${log[0].parameters.scid}).`);
|
|
228
|
+
return true;
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=migrateWebVhLog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrateWebVhLog.js","sourceRoot":"","sources":["../../src/did/migrateWebVhLog.ts"],"names":[],"mappings":";;AA6GA,0CAmEC;AA4CD,0DA4DC;AAxRD,2CAAmD;AACnD,yCAAoF;AACpF,sEAAkE;AAClE,6CAYoB;AAEpB;;GAEG;AACH,MAAM,WAAW;IACf,YAAoC,YAA0B;QAA1B,iBAAY,GAAZ,YAAY,CAAc;IAAG,CAAC;IAE3D,KAAK,CAAC,MAAM,CAAC,SAAqB,EAAE,OAAmB,EAAE,SAAqB;QACnF,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,IAAI,CAAC,YAAY,CAAC,iBAAiB,CAAC,OAAO,CAAC,UAAG,CAAC,gBAAgB,CAAC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|
|
|
17
17
|
export type { WebhookData } from './utils/webhook';
|
|
18
18
|
export { sendWebhookEvent, sendMessageReceivedEvent } from './utils/webhookEvent';
|
|
19
19
|
export * from './utils/util';
|
|
20
|
+
export * from './utils/setupSelfTr';
|
|
21
|
+
export * from './utils/trustCredentialStore';
|
|
20
22
|
export * from './blockchain';
|