@verana-labs/vs-agent-sdk 2.0.0-dev.8 → 2.0.0-dev.80
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 +28 -0
- package/build/adminApi/AdminApiError.js +60 -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 +4 -0
- package/build/adminApi/index.js +21 -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/adminApi/pagination/PageDto.d.ts +7 -0
- package/build/adminApi/pagination/PageDto.js +50 -0
- package/build/adminApi/pagination/PageDto.js.map +1 -0
- package/build/adminApi/pagination/PaginationQueryDto.d.ts +11 -0
- package/build/adminApi/pagination/PaginationQueryDto.js +46 -0
- package/build/adminApi/pagination/PaginationQueryDto.js.map +1 -0
- package/build/adminApi/pagination/cursor.d.ts +28 -0
- package/build/adminApi/pagination/cursor.js +64 -0
- package/build/adminApi/pagination/cursor.js.map +1 -0
- package/build/adminApi/pagination/index.d.ts +4 -0
- package/build/adminApi/pagination/index.js +21 -0
- package/build/adminApi/pagination/index.js.map +1 -0
- package/build/adminApi/pagination/paginate.d.ts +27 -0
- package/build/adminApi/pagination/paginate.js +77 -0
- package/build/adminApi/pagination/paginate.js.map +1 -0
- package/build/agent/VsAgent.d.ts +22 -34
- package/build/agent/VsAgent.js +84 -205
- package/build/agent/VsAgent.js.map +1 -1
- package/build/agent/createVsAgent.d.ts +5 -6
- 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 +38 -27
- package/build/blockchain/VeranaChainService.js +169 -177
- 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/feePreflight.d.ts +32 -0
- package/build/blockchain/feePreflight.js +89 -0
- package/build/blockchain/feePreflight.js.map +1 -0
- package/build/blockchain/handlers/authorizationHandlers.js +2 -2
- package/build/blockchain/handlers/authorizationHandlers.js.map +1 -1
- package/build/blockchain/handlers/defaultHandlers.js +6 -1
- 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 +76 -0
- package/build/blockchain/handlers/selfIssuanceHandlers.js.map +1 -0
- package/build/blockchain/handlers/stateMutations.d.ts +26 -3
- package/build/blockchain/handlers/stateMutations.js +317 -41
- package/build/blockchain/handlers/stateMutations.js.map +1 -1
- 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/indexerMappers.d.ts +3 -0
- package/build/blockchain/indexerMappers.js +53 -0
- package/build/blockchain/indexerMappers.js.map +1 -0
- package/build/blockchain/triggerResolver.d.ts +26 -0
- package/build/blockchain/triggerResolver.js +120 -0
- package/build/blockchain/triggerResolver.js.map +1 -0
- package/build/blockchain/types.d.ts +13 -70
- package/build/blockchain/types.js.map +1 -1
- package/build/bootstrap/EcsBootstrapService.d.ts +13 -3
- package/build/bootstrap/EcsBootstrapService.js +172 -94
- package/build/bootstrap/EcsBootstrapService.js.map +1 -1
- package/build/connections/ParentConnectionModule.d.ts +20 -0
- package/build/connections/ParentConnectionModule.js +56 -0
- package/build/connections/ParentConnectionModule.js.map +1 -0
- 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 +150 -86
- 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 +29 -17
- package/build/events/VtFlowEvents.js.map +1 -1
- package/build/index.d.ts +7 -1
- package/build/index.js +15 -2
- package/build/index.js.map +1 -1
- package/build/plugins/setupBaseDidComm.js +9 -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 +14 -13
- package/build/types.js +1 -2
- package/build/types.js.map +1 -1
- package/build/utils/agent.d.ts +29 -4
- package/build/utils/agent.js +91 -22
- package/build/utils/agent.js.map +1 -1
- package/build/utils/boundedFetch.d.ts +13 -0
- package/build/utils/boundedFetch.js +47 -0
- package/build/utils/boundedFetch.js.map +1 -0
- 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 +46 -0
- package/build/utils/ecsClaims.js +115 -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 +7 -0
- package/build/utils/index.js +7 -0
- package/build/utils/index.js.map +1 -1
- package/build/utils/publishedDidRecord.d.ts +15 -0
- package/build/utils/publishedDidRecord.js +83 -0
- package/build/utils/publishedDidRecord.js.map +1 -0
- package/build/utils/selfIssuedEcsCredential.d.ts +8 -0
- package/build/utils/selfIssuedEcsCredential.js +153 -0
- package/build/utils/selfIssuedEcsCredential.js.map +1 -0
- package/build/utils/setupSelfTr.d.ts +35 -74
- package/build/utils/setupSelfTr.js +93 -312
- package/build/utils/setupSelfTr.js.map +1 -1
- package/build/utils/trustCredentialStore.d.ts +78 -9
- package/build/utils/trustCredentialStore.js +324 -136
- package/build/utils/trustCredentialStore.js.map +1 -1
- package/build/utils/typeMetadata.d.ts +43 -0
- package/build/utils/typeMetadata.js +77 -0
- package/build/utils/typeMetadata.js.map +1 -0
- package/build/utils/util.d.ts +19 -0
- package/build/utils/util.js +24 -0
- package/build/utils/util.js.map +1 -1
- package/build/utils/vcdm2.d.ts +34 -0
- package/build/utils/vcdm2.js +60 -0
- package/build/utils/vcdm2.js.map +1 -0
- package/build/utils/vtjscResolver.d.ts +23 -0
- package/build/utils/vtjscResolver.js +53 -0
- package/build/utils/vtjscResolver.js.map +1 -0
- package/build/vtFlow/VtFlowOrchestrator.d.ts +107 -15
- package/build/vtFlow/VtFlowOrchestrator.js +678 -116
- 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 +18 -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
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toParticipant = toParticipant;
|
|
4
|
+
exports.toCredentialSchema = toCredentialSchema;
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const ROLE = {
|
|
7
|
+
[types_1.ParticipantRole.Issuer]: 1,
|
|
8
|
+
[types_1.ParticipantRole.Verifier]: 2,
|
|
9
|
+
[types_1.ParticipantRole.IssuerGrantor]: 3,
|
|
10
|
+
[types_1.ParticipantRole.VerifierGrantor]: 4,
|
|
11
|
+
[types_1.ParticipantRole.Ecosystem]: 5,
|
|
12
|
+
[types_1.ParticipantRole.Holder]: 6,
|
|
13
|
+
};
|
|
14
|
+
const OP_STATE = {
|
|
15
|
+
PENDING: types_1.ValidationState.PENDING,
|
|
16
|
+
VALIDATED: types_1.ValidationState.VALIDATED,
|
|
17
|
+
TERMINATED: types_1.ValidationState.TERMINATED,
|
|
18
|
+
};
|
|
19
|
+
const ONBOARDING_MODE = {
|
|
20
|
+
OPEN: 1,
|
|
21
|
+
ECOSYSTEM_ONBOARDING_PROCESS: 2,
|
|
22
|
+
GRANTOR_ONBOARDING_PROCESS: 3,
|
|
23
|
+
};
|
|
24
|
+
const date = (v) => (v ? new Date(v) : undefined);
|
|
25
|
+
function toParticipant(dto) {
|
|
26
|
+
var _a, _b, _c, _d, _e;
|
|
27
|
+
return {
|
|
28
|
+
id: dto.id,
|
|
29
|
+
schemaId: dto.schema_id,
|
|
30
|
+
role: (_a = ROLE[dto.role]) !== null && _a !== void 0 ? _a : 0,
|
|
31
|
+
did: (_b = dto.did) !== null && _b !== void 0 ? _b : '',
|
|
32
|
+
corporation: '',
|
|
33
|
+
validatorParticipantId: (_c = dto.validator_participant_id) !== null && _c !== void 0 ? _c : 0,
|
|
34
|
+
opState: dto.op_state ? ((_d = OP_STATE[dto.op_state]) !== null && _d !== void 0 ? _d : types_1.ValidationState.UNSPECIFIED) : undefined,
|
|
35
|
+
opSummaryDigest: (_e = dto.op_summary_digest) !== null && _e !== void 0 ? _e : '',
|
|
36
|
+
revoked: date(dto.revoked),
|
|
37
|
+
slashed: date(dto.slashed),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
function toCredentialSchema(dto) {
|
|
41
|
+
var _a, _b, _c, _d;
|
|
42
|
+
return {
|
|
43
|
+
id: dto.id,
|
|
44
|
+
ecosystemId: dto.ecosystem_id,
|
|
45
|
+
jsonSchema: dto.json_schema,
|
|
46
|
+
digestAlgorithm: dto.digest_algorithm,
|
|
47
|
+
issuerOnboardingMode: (_b = ONBOARDING_MODE[(_a = dto.issuer_onboarding_mode) !== null && _a !== void 0 ? _a : '']) !== null && _b !== void 0 ? _b : 0,
|
|
48
|
+
verifierOnboardingMode: (_d = ONBOARDING_MODE[(_c = dto.verifier_onboarding_mode) !== null && _c !== void 0 ? _c : '']) !== null && _d !== void 0 ? _d : 0,
|
|
49
|
+
holderOnboardingMode: 0,
|
|
50
|
+
archived: date(dto.archived),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=indexerMappers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexerMappers.js","sourceRoot":"","sources":["../../src/blockchain/indexerMappers.ts"],"names":[],"mappings":";;AAgCA,sCAaC;AAED,gDAWC;AA1DD,mCAOgB;AAEhB,MAAM,IAAI,GAA2B;IACnC,CAAC,uBAAe,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3B,CAAC,uBAAe,CAAC,QAAQ,CAAC,EAAE,CAAC;IAC7B,CAAC,uBAAe,CAAC,aAAa,CAAC,EAAE,CAAC;IAClC,CAAC,uBAAe,CAAC,eAAe,CAAC,EAAE,CAAC;IACpC,CAAC,uBAAe,CAAC,SAAS,CAAC,EAAE,CAAC;IAC9B,CAAC,uBAAe,CAAC,MAAM,CAAC,EAAE,CAAC;CAC5B,CAAA;AAED,MAAM,QAAQ,GAAoC;IAChD,OAAO,EAAE,uBAAe,CAAC,OAAO;IAChC,SAAS,EAAE,uBAAe,CAAC,SAAS;IACpC,UAAU,EAAE,uBAAe,CAAC,UAAU;CACvC,CAAA;AAED,MAAM,eAAe,GAA2B;IAC9C,IAAI,EAAE,CAAC;IACP,4BAA4B,EAAE,CAAC;IAC/B,0BAA0B,EAAE,CAAC;CAC9B,CAAA;AAED,MAAM,IAAI,GAAG,CAAC,CAA4B,EAAoB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAA;AAE9F,SAAgB,aAAa,CAAC,GAAmB;;IAC/C,OAAO;QACL,EAAE,EAAE,GAAG,CAAC,EAAE;QACV,QAAQ,EAAE,GAAG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
|
|
4
|
+
* `TriggerResolver`. Path 1 of MOD-PP-MSG-15 needs that record, and only a HOLDER record can list
|
|
5
|
+
* the message (MOD-PP-MSG-1-1, MOD-PP-MSG-14-1), so any other entry always fails on chain.
|
|
6
|
+
*/
|
|
7
|
+
export declare function findResolverParticipantId(agent: VsAgent): Promise<number | undefined>;
|
|
8
|
+
/**
|
|
9
|
+
* [VSA-VT-LVP-5], [VSA-VPR-TX-4]: sends `TriggerResolver` for one entry, and reports the outcome in
|
|
10
|
+
* the log. A failure is an error line that names the entry, the cause, and the reason: the trust
|
|
11
|
+
* state of the agent stays stale until an operator acts on it. This function never throws.
|
|
12
|
+
*/
|
|
13
|
+
export declare function triggerResolver(agent: VsAgent, participantId: number, cause: string): Promise<void>;
|
|
14
|
+
/** `triggerResolver` for the entry that covers the DID of the agent, when it holds one. Never throws. */
|
|
15
|
+
export declare function triggerResolverForOwnDid(agent: VsAgent, cause: string): Promise<void>;
|
|
16
|
+
/**
|
|
17
|
+
* Schedules `triggerResolverForOwnDid` after a short window, so that a burst of DID record writes
|
|
18
|
+
* sends one transaction. The call returns at once.
|
|
19
|
+
*/
|
|
20
|
+
export declare function scheduleTriggerResolverForOwnDid(agent: VsAgent, cause: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Sends every trigger that a coalescing window still holds, and waits for it. The agent calls this
|
|
23
|
+
* when it shuts down: [IDX-VT-EVAL-3] makes the trigger the only signal of a publication change, so a
|
|
24
|
+
* trigger the window still holds at exit would leave the trust state of the agent stale for good.
|
|
25
|
+
*/
|
|
26
|
+
export declare function flushPendingTriggerResolvers(): Promise<void>;
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findResolverParticipantId = findResolverParticipantId;
|
|
4
|
+
exports.triggerResolver = triggerResolver;
|
|
5
|
+
exports.triggerResolverForOwnDid = triggerResolverForOwnDid;
|
|
6
|
+
exports.scheduleTriggerResolverForOwnDid = scheduleTriggerResolverForOwnDid;
|
|
7
|
+
exports.flushPendingTriggerResolvers = flushPendingTriggerResolvers;
|
|
8
|
+
const types_1 = require("./types");
|
|
9
|
+
const verana_types_1 = require("@verana-labs/verana-types");
|
|
10
|
+
const feePreflight_1 = require("./feePreflight");
|
|
11
|
+
/** DID record writes come in bursts, and the resolver reads the current document, so one trigger covers a burst. */
|
|
12
|
+
const COALESCE_WINDOW_MS = 2000;
|
|
13
|
+
const pendingByDid = new Map();
|
|
14
|
+
function errorMessage(error) {
|
|
15
|
+
return error instanceof Error ? error.message : String(error);
|
|
16
|
+
}
|
|
17
|
+
// AUTHZ-CHECK-3 step 1, as the flow orchestrator applies it
|
|
18
|
+
function isActiveParticipant(participant) {
|
|
19
|
+
const now = Date.now();
|
|
20
|
+
if (!participant.effective_from || Date.parse(participant.effective_from) > now)
|
|
21
|
+
return false;
|
|
22
|
+
if (participant.effective_until && Date.parse(participant.effective_until) <= now)
|
|
23
|
+
return false;
|
|
24
|
+
return !participant.revoked && !participant.slashed;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* [VSA-VPR-TX-5]: an active HOLDER entry of the agent whose `ParticipantAuthorizationRecord` lists
|
|
28
|
+
* `TriggerResolver`. Path 1 of MOD-PP-MSG-15 needs that record, and only a HOLDER record can list
|
|
29
|
+
* the message (MOD-PP-MSG-1-1, MOD-PP-MSG-14-1), so any other entry always fails on chain.
|
|
30
|
+
*/
|
|
31
|
+
async function findResolverParticipantId(agent) {
|
|
32
|
+
var _a;
|
|
33
|
+
const did = agent.did;
|
|
34
|
+
if (!did)
|
|
35
|
+
return undefined;
|
|
36
|
+
const participants = await agent.indexer.listParticipants({ did, role: types_1.ParticipantRole.Holder });
|
|
37
|
+
return (_a = participants.find(p => {
|
|
38
|
+
var _a;
|
|
39
|
+
return p.did === did &&
|
|
40
|
+
p.role === types_1.ParticipantRole.Holder &&
|
|
41
|
+
isActiveParticipant(p) &&
|
|
42
|
+
((_a = agent.authorizationService) === null || _a === void 0 ? void 0 : _a.canSign(p.id, verana_types_1.veranaTypeUrls.MsgTriggerResolver));
|
|
43
|
+
})) === null || _a === void 0 ? void 0 : _a.id;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* [VSA-VT-LVP-5], [VSA-VPR-TX-4]: sends `TriggerResolver` for one entry, and reports the outcome in
|
|
47
|
+
* the log. A failure is an error line that names the entry, the cause, and the reason: the trust
|
|
48
|
+
* state of the agent stays stale until an operator acts on it. This function never throws.
|
|
49
|
+
*/
|
|
50
|
+
async function triggerResolver(agent, participantId, cause) {
|
|
51
|
+
const chain = agent.veranaChain;
|
|
52
|
+
const logger = agent.config.logger;
|
|
53
|
+
if (!chain)
|
|
54
|
+
return;
|
|
55
|
+
const target = `TriggerResolver for participant ${participantId} (${cause})`;
|
|
56
|
+
const granter = (0, feePreflight_1.feeGranterFor)(agent, participantId);
|
|
57
|
+
try {
|
|
58
|
+
// the fee pre-flight of the broadcast names the payer it could not charge
|
|
59
|
+
const { txHash } = await chain.triggerResolver(participantId, { granter });
|
|
60
|
+
logger.info(`[TriggerResolver] ${target} sent: tx ${txHash}${granter ? `, fee granter ${granter}` : ''}`);
|
|
61
|
+
}
|
|
62
|
+
catch (error) {
|
|
63
|
+
if (error instanceof feePreflight_1.FeePreflightError) {
|
|
64
|
+
logger.error(`[TriggerResolver] ${target} not sent: ${error.reason}: ${error.message}`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
logger.error(`[TriggerResolver] ${target} failed: ${errorMessage(error)}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/** `triggerResolver` for the entry that covers the DID of the agent, when it holds one. Never throws. */
|
|
71
|
+
async function triggerResolverForOwnDid(agent, cause) {
|
|
72
|
+
if (!agent.veranaChain)
|
|
73
|
+
return;
|
|
74
|
+
let participantId;
|
|
75
|
+
try {
|
|
76
|
+
participantId = await findResolverParticipantId(agent);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
agent.config.logger.error(`[TriggerResolver] cannot find the Participant entry of ${agent.did} (${cause}): ${errorMessage(error)}`);
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (participantId === undefined) {
|
|
83
|
+
agent.config.logger.warn(`[TriggerResolver] no active HOLDER entry of ${agent.did} whose authorization lists TriggerResolver: nothing sent (${cause})`);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
await triggerResolver(agent, participantId, cause);
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Schedules `triggerResolverForOwnDid` after a short window, so that a burst of DID record writes
|
|
90
|
+
* sends one transaction. The call returns at once.
|
|
91
|
+
*/
|
|
92
|
+
function scheduleTriggerResolverForOwnDid(agent, cause) {
|
|
93
|
+
var _a, _b;
|
|
94
|
+
const key = (_a = agent.did) !== null && _a !== void 0 ? _a : '';
|
|
95
|
+
const pending = pendingByDid.get(key);
|
|
96
|
+
if (pending)
|
|
97
|
+
clearTimeout(pending.timer);
|
|
98
|
+
const send = async () => {
|
|
99
|
+
pendingByDid.delete(key);
|
|
100
|
+
await triggerResolverForOwnDid(agent, cause);
|
|
101
|
+
};
|
|
102
|
+
const timer = setTimeout(() => void send(), COALESCE_WINDOW_MS);
|
|
103
|
+
// the window must not hold a shutdown open; `flushPendingTriggerResolvers` sends what it holds
|
|
104
|
+
(_b = timer.unref) === null || _b === void 0 ? void 0 : _b.call(timer);
|
|
105
|
+
pendingByDid.set(key, { timer, send });
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Sends every trigger that a coalescing window still holds, and waits for it. The agent calls this
|
|
109
|
+
* when it shuts down: [IDX-VT-EVAL-3] makes the trigger the only signal of a publication change, so a
|
|
110
|
+
* trigger the window still holds at exit would leave the trust state of the agent stale for good.
|
|
111
|
+
*/
|
|
112
|
+
async function flushPendingTriggerResolvers() {
|
|
113
|
+
const pending = [...pendingByDid.values()];
|
|
114
|
+
pendingByDid.clear();
|
|
115
|
+
for (const { timer, send } of pending) {
|
|
116
|
+
clearTimeout(timer);
|
|
117
|
+
await send();
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=triggerResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"triggerResolver.js","sourceRoot":"","sources":["../../src/blockchain/triggerResolver.ts"],"names":[],"mappings":";;AA4BA,8DAWC;AAOD,0CAkBC;AAGD,4DAkBC;AAMD,4EAYC;AAOD,oEAOC;AApHD,mCAA8D;AAE9D,4DAA0D;AAE1D,iDAAiE;AAEjE,oHAAoH;AACpH,MAAM,kBAAkB,GAAG,IAAK,CAAA;AAChC,MAAM,YAAY,GAAG,IAAI,GAAG,EAA+E,CAAA;AAE3G,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC/D,CAAC;AAED,4DAA4D;AAC5D,SAAS,mBAAmB,CAAC,WAA2B;IACtD,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAA;IACtB,IAAI,CAAC,WAAW,CAAC,cAAc,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,GAAG,GAAG;QAAE,OAAO,KAAK,CAAA;IAC7F,IAAI,WAAW,CAAC,eAAe,IAAI,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC,eAAe,CAAC,IAAI,GAAG;QAAE,OAAO,KAAK,CAAA;IAC/F,OAAO,CAAC,WAAW,CAAC,OAAO,IAAI,CAAC,WAAW,CAAC,OAAO,CAAA;AACrD,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,yBAAyB,CAAC,KAAc;;IAC5D,MAAM,GAAG,GAAG,KAAK,CAAC,GAAG,CAAA;IACrB,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAA;IAC1B,MAAM,YAAY,GAAG,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,MAAM,wBAAwB,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;IAC9C,CAAC,CAAA;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,KAAK,IAAI,EAAE,EAAE,kBAAkB,CAAC,CAAA;IAC/D,+FAA+F;IAC/F,MAAA,KAAK,CAAC,KAAK,qDAAI,CAAA;IACf,YAAY,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;AACxC,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,4BAA4B;IAChD,MAAM,OAAO,GAAG,CAAC,GAAG,YAAY,CAAC,MAAM,EAAE,CAAC,CAAA;IAC1C,YAAY,CAAC,KAAK,EAAE,CAAA;IACpB,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,OAAO,EAAE,CAAC;QACtC,YAAY,CAAC,KAAK,CAAC,CAAA;QACnB,MAAM,IAAI,EAAE,CAAA;IACd,CAAC;AACH,CAAC"}
|
|
@@ -57,6 +57,10 @@ export interface IndexerSubscribeMessage {
|
|
|
57
57
|
dids?: string[];
|
|
58
58
|
corporationId?: number;
|
|
59
59
|
}
|
|
60
|
+
export interface IndexerSubscribedMessage {
|
|
61
|
+
type: 'subscribed';
|
|
62
|
+
block: number;
|
|
63
|
+
}
|
|
60
64
|
export interface IndexerEventsResponse {
|
|
61
65
|
events: IndexerEventRecord[];
|
|
62
66
|
count: number;
|
|
@@ -131,6 +135,7 @@ export interface CredentialSchemaDto {
|
|
|
131
135
|
digest_algorithm: string;
|
|
132
136
|
issuer_onboarding_mode?: string;
|
|
133
137
|
verifier_onboarding_mode?: string;
|
|
138
|
+
holder_validation_validity_period?: number;
|
|
134
139
|
archived: string | null;
|
|
135
140
|
created: string;
|
|
136
141
|
modified: string;
|
|
@@ -162,10 +167,16 @@ export interface ParticipantDto {
|
|
|
162
167
|
op_state?: string;
|
|
163
168
|
revoked: string | null;
|
|
164
169
|
slashed: string | null;
|
|
165
|
-
|
|
170
|
+
effective_from?: string | null;
|
|
171
|
+
effective_until?: string | null;
|
|
166
172
|
modified: string;
|
|
167
173
|
validator_participant_id?: number | null;
|
|
168
174
|
op_summary_digest?: string;
|
|
175
|
+
validation_fees?: number;
|
|
176
|
+
issuance_fees?: number;
|
|
177
|
+
verification_fees?: number;
|
|
178
|
+
issuance_fee_discount?: number;
|
|
179
|
+
verification_fee_discount?: number;
|
|
169
180
|
}
|
|
170
181
|
export interface CorporationDto {
|
|
171
182
|
id: number;
|
|
@@ -191,18 +202,6 @@ export interface DigestDto {
|
|
|
191
202
|
digest: string;
|
|
192
203
|
created: string;
|
|
193
204
|
}
|
|
194
|
-
export interface RawParticipant {
|
|
195
|
-
id: number;
|
|
196
|
-
schemaId: number;
|
|
197
|
-
role: number;
|
|
198
|
-
did: string;
|
|
199
|
-
corporationId?: number;
|
|
200
|
-
validatorParticipantId: number;
|
|
201
|
-
opState?: number;
|
|
202
|
-
opSummaryDigest?: string;
|
|
203
|
-
revoked: Date | undefined;
|
|
204
|
-
slashed: Date | undefined;
|
|
205
|
-
}
|
|
206
205
|
export interface Ecosystem {
|
|
207
206
|
id: number;
|
|
208
207
|
did: string;
|
|
@@ -220,10 +219,6 @@ export interface CredentialSchema {
|
|
|
220
219
|
holderOnboardingMode: number;
|
|
221
220
|
archived: Date | undefined;
|
|
222
221
|
}
|
|
223
|
-
export interface StoredDigest {
|
|
224
|
-
digest: string;
|
|
225
|
-
created: Date | undefined;
|
|
226
|
-
}
|
|
227
222
|
export interface OperatorAuthorization {
|
|
228
223
|
id: number;
|
|
229
224
|
corporationId: number;
|
|
@@ -249,66 +244,14 @@ export interface VsOperatorAuthorization {
|
|
|
249
244
|
vsOperator: string;
|
|
250
245
|
records: ParticipantAuthorizationRecord[];
|
|
251
246
|
}
|
|
252
|
-
export interface ParticipantQueryClient {
|
|
253
|
-
GetParticipant(req: {
|
|
254
|
-
id: number;
|
|
255
|
-
}): Promise<{
|
|
256
|
-
participant?: RawParticipant;
|
|
257
|
-
}>;
|
|
258
|
-
FindParticipantsWithDID(req: object): Promise<{
|
|
259
|
-
participants: RawParticipant[];
|
|
260
|
-
}>;
|
|
261
|
-
GetParticipantSession(req: {
|
|
262
|
-
id: string;
|
|
263
|
-
}): Promise<{
|
|
264
|
-
session?: unknown;
|
|
265
|
-
}>;
|
|
266
|
-
}
|
|
267
|
-
export interface EcosystemQueryClient {
|
|
268
|
-
GetEcosystem(req: {
|
|
269
|
-
id: number;
|
|
270
|
-
}): Promise<{
|
|
271
|
-
ecosystem?: Ecosystem;
|
|
272
|
-
}>;
|
|
273
|
-
}
|
|
274
|
-
export interface CredentialSchemaQueryClient {
|
|
275
|
-
GetCredentialSchema(req: {
|
|
276
|
-
id: number;
|
|
277
|
-
}): Promise<{
|
|
278
|
-
schema?: CredentialSchema;
|
|
279
|
-
}>;
|
|
280
|
-
}
|
|
281
|
-
export interface DigestQueryClient {
|
|
282
|
-
GetDigest(req: {
|
|
283
|
-
digest: string;
|
|
284
|
-
}): Promise<{
|
|
285
|
-
digest?: StoredDigest;
|
|
286
|
-
}>;
|
|
287
|
-
}
|
|
288
|
-
export interface DelegationQueryClient {
|
|
289
|
-
ListOperatorAuthorizations(req: {
|
|
290
|
-
corporationId: number;
|
|
291
|
-
operator: string;
|
|
292
|
-
responseMaxSize: number;
|
|
293
|
-
}): Promise<{
|
|
294
|
-
operatorAuthorizations: OperatorAuthorization[];
|
|
295
|
-
}>;
|
|
296
|
-
ListVSOperatorAuthorizations(req: {
|
|
297
|
-
corporationId: number;
|
|
298
|
-
vsOperator: string;
|
|
299
|
-
responseMaxSize: number;
|
|
300
|
-
}): Promise<{
|
|
301
|
-
vsOperatorAuthorizations: VsOperatorAuthorization[];
|
|
302
|
-
}>;
|
|
303
|
-
}
|
|
304
247
|
export interface VeranaChainConfig {
|
|
305
248
|
rpcUrl: string;
|
|
306
249
|
chainId?: string;
|
|
307
250
|
mnemonic: string;
|
|
308
251
|
logger: BaseLogger;
|
|
309
252
|
gasPrice?: string;
|
|
253
|
+
gasAdjustment?: number;
|
|
310
254
|
corporationAddress?: string;
|
|
311
|
-
autoTriggerResolver?: boolean;
|
|
312
255
|
}
|
|
313
256
|
/** Wrapper for optional uint64 values per `verana.pp.v1.OptionalUInt64`. */
|
|
314
257
|
export interface OptionalUInt64 {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/blockchain/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,mEAAe,CAAA;IACf,2DAAW,CAAA;IACX,+DAAa,CAAA;IACb,iEAAc,CAAA;AAChB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAeY,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAC/B,QAAA,SAAS,GAAG,8BAA8B,CAAA;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/blockchain/types.ts"],"names":[],"mappings":";;;AAEA,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,mEAAe,CAAA;IACf,2DAAW,CAAA;IACX,+DAAa,CAAA;IACb,iEAAc,CAAA;AAChB,CAAC,EALW,eAAe,+BAAf,eAAe,QAK1B;AAeY,QAAA,oBAAoB,GAAG,QAAQ,CAAA;AAC/B,QAAA,SAAS,GAAG,8BAA8B,CAAA;AAgJvD,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,oCAAiB,CAAA;IACjB,wCAAqB,CAAA;IACrB,mDAAgC,CAAA;IAChC,uDAAoC,CAAA;IACpC,0CAAuB,CAAA;IACvB,oCAAiB,CAAA;AACnB,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AAED,IAAY,gBAQX;AARD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,qCAAiB,CAAA;IACjB,yCAAqB,CAAA;IACrB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,uCAAmB,CAAA;IACnB,qCAAiB,CAAA;AACnB,CAAC,EARW,gBAAgB,gCAAhB,gBAAgB,QAQ3B"}
|
|
@@ -16,10 +16,19 @@ export declare class EcsBootstrapService {
|
|
|
16
16
|
run(): Promise<void>;
|
|
17
17
|
private runStandalone;
|
|
18
18
|
private preflight;
|
|
19
|
+
private operatorSkipReason;
|
|
19
20
|
private acceptPendingOffers;
|
|
21
|
+
/**
|
|
22
|
+
* StartParticipantOP pays a trust deposit, and it cannot be undone. The onboarding request that
|
|
23
|
+
* must follow it travels over DIDComm from the chain event handler, which catches its own
|
|
24
|
+
* failure. The indexer marks that block processed all the same and never replays it, so an
|
|
25
|
+
* unreachable validator leaves the entry at PENDING for ever. This boot step closes that gap.
|
|
26
|
+
*/
|
|
27
|
+
private resumePendingOnboardings;
|
|
28
|
+
private resumeOnboarding;
|
|
29
|
+
private isSelfValidated;
|
|
20
30
|
private discoverEcsSchemas;
|
|
21
31
|
private discoverFromEcosystem;
|
|
22
|
-
private classifySchema;
|
|
23
32
|
private ensureHolderParticipant;
|
|
24
33
|
private findOwnActiveRoot;
|
|
25
34
|
private ensureSelfIssuedParticipant;
|
|
@@ -28,6 +37,7 @@ export declare class EcsBootstrapService {
|
|
|
28
37
|
private triggerResolverBestEffort;
|
|
29
38
|
private isUsableParticipant;
|
|
30
39
|
private runDelegated;
|
|
31
|
-
private
|
|
32
|
-
private
|
|
40
|
+
private findParentServiceIssuer;
|
|
41
|
+
private assertTrustedEcosystem;
|
|
42
|
+
private onboardingClaims;
|
|
33
43
|
}
|