@private.me/xbind 1.3.5 → 3.0.0
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/LICENSES.md +212 -0
- package/README.md +388 -6
- package/dist-standalone/_deps/mldsa-wasm/dist/mldsa.js +1 -1920
- package/dist-standalone/_deps/shared/cjs/errors.js +1 -639
- package/dist-standalone/_deps/shared/cjs/index.js +1 -496
- package/dist-standalone/_deps/shared/cjs/types.js +1 -317
- package/dist-standalone/_deps/shared/errors.js +1 -255
- package/dist-standalone/_deps/shared/index.js +1 -74
- package/dist-standalone/_deps/shared/types.js +1 -90
- package/dist-standalone/_deps/ux-helpers/cjs/errors.js +1 -1
- package/dist-standalone/_deps/ux-helpers/cjs/index.js +1 -1
- package/dist-standalone/_deps/ux-helpers/cjs/pagination.js +1 -1
- package/dist-standalone/_deps/ux-helpers/cjs/progress.js +1 -1
- package/dist-standalone/_deps/ux-helpers/cjs/search.js +1 -1
- package/dist-standalone/_deps/ux-helpers/cjs/types.js +1 -1
- package/dist-standalone/_deps/ux-helpers/errors.js +1 -1
- package/dist-standalone/_deps/ux-helpers/index.js +1 -1
- package/dist-standalone/_deps/ux-helpers/pagination.js +1 -1
- package/dist-standalone/_deps/ux-helpers/progress.js +1 -1
- package/dist-standalone/_deps/ux-helpers/search.js +1 -1
- package/dist-standalone/_deps/xchange/auto-accept.js +1 -1
- package/dist-standalone/_deps/xchange/cjs/auto-accept.js +1 -1
- package/dist-standalone/_deps/xchange/cjs/errors.js +1 -1
- package/dist-standalone/_deps/xchange/cjs/index.js +1 -1
- package/dist-standalone/_deps/xchange/cjs/invite-client.js +1 -1
- package/dist-standalone/_deps/xchange/cjs/lazy-init.js +1 -1
- package/dist-standalone/_deps/xchange/cjs/trust-integration.js +1 -1
- package/dist-standalone/_deps/xchange/cjs/xchange.js +1 -1
- package/dist-standalone/_deps/xchange/errors.js +1 -1
- package/dist-standalone/_deps/xchange/index.js +1 -1
- package/dist-standalone/_deps/xchange/invite-client.js +1 -1
- package/dist-standalone/_deps/xchange/lazy-init.js +1 -1
- package/dist-standalone/_deps/xchange/trust-integration.js +1 -1
- package/dist-standalone/_deps/xchange/xchange.js +1 -1
- package/dist-standalone/_deps/xregistry/cjs/discovery.js +1 -1
- package/dist-standalone/_deps/xregistry/cjs/errors.js +1 -1
- package/dist-standalone/_deps/xregistry/cjs/index.js +1 -1
- package/dist-standalone/_deps/xregistry/cjs/registry.js +1 -1
- package/dist-standalone/_deps/xregistry/cjs/schema.js +1 -1
- package/dist-standalone/_deps/xregistry/cjs/types.js +1 -1
- package/dist-standalone/_deps/xregistry/discovery.js +1 -1
- package/dist-standalone/_deps/xregistry/errors.js +1 -1
- package/dist-standalone/_deps/xregistry/index.js +1 -1
- package/dist-standalone/_deps/xregistry/registry.js +1 -1
- package/dist-standalone/_deps/xregistry/schema.js +1 -1
- package/dist-standalone/_deps/xregistry/types.js +1 -1
- package/dist-standalone/agent-call.js +1 -642
- package/dist-standalone/agent-sdk.js +1 -328
- package/dist-standalone/agent.d.ts +95 -5
- package/dist-standalone/agent.js +1 -1545
- package/dist-standalone/approval.js +1 -193
- package/dist-standalone/async-iterators.d.ts +275 -0
- package/dist-standalone/async-iterators.js +1 -0
- package/dist-standalone/auth.js +1 -219
- package/dist-standalone/auto-accept.js +1 -229
- package/dist-standalone/backup-config.js +1 -201
- package/dist-standalone/backup.d.ts +114 -0
- package/dist-standalone/backup.js +1 -0
- package/dist-standalone/batch-operations.d.ts +297 -0
- package/dist-standalone/batch-operations.js +1 -0
- package/dist-standalone/cancellation.d.ts +301 -0
- package/dist-standalone/cancellation.js +1 -0
- package/dist-standalone/checkpoint.js +1 -186
- package/dist-standalone/circuit-breaker.d.ts +351 -0
- package/dist-standalone/circuit-breaker.js +1 -0
- package/dist-standalone/cjs/agent-call.js +1 -651
- package/dist-standalone/cjs/agent-sdk.js +1 -332
- package/dist-standalone/cjs/agent.js +1 -1582
- package/dist-standalone/cjs/approval.js +1 -199
- package/dist-standalone/cjs/async-iterators.js +1 -0
- package/dist-standalone/cjs/auth.js +1 -225
- package/dist-standalone/cjs/auto-accept.js +1 -233
- package/dist-standalone/cjs/backup-config.js +1 -207
- package/dist-standalone/cjs/backup.js +1 -0
- package/dist-standalone/cjs/batch-operations.js +1 -0
- package/dist-standalone/cjs/cancellation.js +1 -0
- package/dist-standalone/cjs/checkpoint.js +1 -193
- package/dist-standalone/cjs/circuit-breaker.js +1 -0
- package/dist-standalone/cjs/cli/init.js +1 -486
- package/dist-standalone/cjs/config-validation.js +1 -0
- package/dist-standalone/cjs/connect.js +1 -312
- package/dist-standalone/cjs/connection-pool.js +1 -0
- package/dist-standalone/cjs/correlation-id.js +1 -339
- package/dist-standalone/cjs/crypto-utils.js +1 -0
- package/dist-standalone/cjs/debug-mode.js +1 -0
- package/dist-standalone/cjs/did-document.js +1 -101
- package/dist-standalone/cjs/did-privateme.js +1 -130
- package/dist-standalone/cjs/did-web.js +1 -201
- package/dist-standalone/cjs/discovery.js +1 -462
- package/dist-standalone/cjs/dual-mode.js +1 -251
- package/dist-standalone/cjs/email-templates.js +1 -313
- package/dist-standalone/cjs/email-transport.js +1 -239
- package/dist-standalone/cjs/envelope.js +1 -510
- package/dist-standalone/cjs/errors.js +1 -826
- package/dist-standalone/cjs/event-emitter.js +1 -0
- package/dist-standalone/cjs/gateway-state.js +1 -55
- package/dist-standalone/cjs/gateway-transport.js +1 -120
- package/dist-standalone/cjs/graceful-degradation.js +1 -0
- package/dist-standalone/cjs/guardrails.js +1 -223
- package/dist-standalone/cjs/health-check.js +1 -0
- package/dist-standalone/cjs/http-compat.js +1 -272
- package/dist-standalone/cjs/http-status-map.js +1 -571
- package/dist-standalone/cjs/identity.js +1 -540
- package/dist-standalone/cjs/index.js +1 -237
- package/dist-standalone/cjs/invitation.js +1 -421
- package/dist-standalone/cjs/invite.js +1 -328
- package/dist-standalone/cjs/key-agreement.js +1 -246
- package/dist-standalone/cjs/lazy-init.js +1 -300
- package/dist-standalone/cjs/logger.js +1 -0
- package/dist-standalone/cjs/mdns-discovery.js +1 -202
- package/dist-standalone/cjs/nonce-store.js +1 -66
- package/dist-standalone/cjs/pairing-manager.js +1 -223
- package/dist-standalone/cjs/plugin-system.js +1 -0
- package/dist-standalone/cjs/plugins/logging.js +1 -0
- package/dist-standalone/cjs/plugins/metrics.js +1 -0
- package/dist-standalone/cjs/plugins/validation.js +1 -0
- package/dist-standalone/cjs/policy.js +1 -320
- package/dist-standalone/cjs/progress-callbacks.js +1 -0
- package/dist-standalone/cjs/redis-nonce-store.js +1 -76
- package/dist-standalone/cjs/registry-middleware.js +1 -50
- package/dist-standalone/cjs/retry-strategies.js +1 -0
- package/dist-standalone/cjs/retry-transport.js +1 -102
- package/dist-standalone/cjs/runtime/browser.js +1 -0
- package/dist-standalone/cjs/runtime/edge.js +1 -0
- package/dist-standalone/cjs/runtime/react-native.js +1 -0
- package/dist-standalone/cjs/security-policy.js +1 -245
- package/dist-standalone/cjs/serialization.js +1 -0
- package/dist-standalone/cjs/split-channel.js +1 -177
- package/dist-standalone/cjs/subscription-proof.js +1 -230
- package/dist-standalone/cjs/succession.js +1 -148
- package/dist-standalone/cjs/timeouts.js +1 -0
- package/dist-standalone/cjs/trace-context.js +1 -0
- package/dist-standalone/cjs/trace-spans.js +1 -0
- package/dist-standalone/cjs/transport.js +1 -63
- package/dist-standalone/cjs/trust-registry.js +1 -742
- package/dist-standalone/cjs/types/error-response.js +1 -56
- package/dist-standalone/cjs/vault-auth.js +1 -0
- package/dist-standalone/cjs/vault-store-loader.js +1 -0
- package/dist-standalone/cjs/verify.js +1 -25
- package/dist-standalone/cjs/version-info.js +1 -0
- package/dist-standalone/cjs/xfetch.js +1 -252
- package/dist-standalone/cli/init.js +1 -449
- package/dist-standalone/cli/setup.js +1 -514
- package/dist-standalone/cli/types.js +1 -27
- package/dist-standalone/cli/xbind.js +1 -148
- package/dist-standalone/config-validation.d.ts +185 -0
- package/dist-standalone/config-validation.js +1 -0
- package/dist-standalone/connect.js +1 -274
- package/dist-standalone/connection-pool.d.ts +251 -0
- package/dist-standalone/connection-pool.js +1 -0
- package/dist-standalone/correlation-id.js +1 -326
- package/dist-standalone/crypto-utils.d.ts +60 -0
- package/dist-standalone/crypto-utils.js +1 -0
- package/dist-standalone/debug-mode.d.ts +286 -0
- package/dist-standalone/debug-mode.js +1 -0
- package/dist-standalone/did-document.js +1 -96
- package/dist-standalone/did-privateme.js +1 -121
- package/dist-standalone/did-web.js +1 -196
- package/dist-standalone/discovery.js +1 -458
- package/dist-standalone/dual-mode.js +1 -247
- package/dist-standalone/email-templates.js +1 -309
- package/dist-standalone/email-transport.js +1 -232
- package/dist-standalone/envelope.d.ts +29 -1
- package/dist-standalone/envelope.js +1 -497
- package/dist-standalone/errors.d.ts +10 -0
- package/dist-standalone/errors.js +1 -811
- package/dist-standalone/event-emitter.d.ts +395 -0
- package/dist-standalone/event-emitter.js +1 -0
- package/dist-standalone/gateway-state.js +1 -51
- package/dist-standalone/gateway-transport.js +1 -116
- package/dist-standalone/graceful-degradation.d.ts +246 -0
- package/dist-standalone/graceful-degradation.js +1 -0
- package/dist-standalone/guardrails.js +1 -216
- package/dist-standalone/health-check.d.ts +150 -0
- package/dist-standalone/health-check.js +1 -0
- package/dist-standalone/http-compat.js +1 -267
- package/dist-standalone/http-status-map.js +1 -561
- package/dist-standalone/identity.d.ts +64 -1
- package/dist-standalone/identity.js +1 -515
- package/dist-standalone/index.d.ts +45 -3
- package/dist-standalone/index.js +1 -52
- package/dist-standalone/invitation.js +1 -415
- package/dist-standalone/invite.js +1 -324
- package/dist-standalone/key-agreement.d.ts +61 -13
- package/dist-standalone/key-agreement.js +1 -236
- package/dist-standalone/lazy-init.js +1 -295
- package/dist-standalone/logger.d.ts +77 -0
- package/dist-standalone/logger.js +1 -0
- package/dist-standalone/mdns-discovery.js +1 -195
- package/dist-standalone/nonce-store.d.ts +16 -3
- package/dist-standalone/nonce-store.js +1 -62
- package/dist-standalone/package.json +0 -1
- package/dist-standalone/pairing-manager.js +1 -219
- package/dist-standalone/plugin-system.d.ts +145 -0
- package/dist-standalone/plugin-system.js +1 -0
- package/dist-standalone/policy.js +1 -315
- package/dist-standalone/progress-callbacks.d.ts +394 -0
- package/dist-standalone/progress-callbacks.js +1 -0
- package/dist-standalone/redis-nonce-store.js +1 -72
- package/dist-standalone/registry-middleware.js +1 -47
- package/dist-standalone/retry-strategies.d.ts +382 -0
- package/dist-standalone/retry-strategies.js +1 -0
- package/dist-standalone/retry-transport.js +1 -98
- package/dist-standalone/security-policy.js +1 -239
- package/dist-standalone/serialization.d.ts +244 -0
- package/dist-standalone/serialization.js +1 -0
- package/dist-standalone/split-channel.d.ts +49 -1
- package/dist-standalone/split-channel.js +1 -171
- package/dist-standalone/subscription-proof.js +1 -224
- package/dist-standalone/succession.js +1 -142
- package/dist-standalone/timeouts.d.ts +275 -0
- package/dist-standalone/timeouts.js +1 -0
- package/dist-standalone/trace-context.d.ts +252 -0
- package/dist-standalone/trace-context.js +1 -0
- package/dist-standalone/trace-spans.d.ts +360 -0
- package/dist-standalone/trace-spans.js +1 -0
- package/dist-standalone/transport.js +1 -59
- package/dist-standalone/trust-registry.d.ts +106 -5
- package/dist-standalone/trust-registry.js +1 -702
- package/dist-standalone/vault-auth.d.ts +91 -0
- package/dist-standalone/vault-auth.js +1 -0
- package/dist-standalone/vault-store-loader.d.ts +110 -0
- package/dist-standalone/vault-store-loader.js +1 -0
- package/dist-standalone/verify.js +1 -16
- package/dist-standalone/version-info.d.ts +259 -0
- package/dist-standalone/version-info.js +1 -0
- package/dist-standalone/xfetch.js +1 -247
- package/llms.txt +1 -0
- package/package.json +65 -5
- package/share1.dat +0 -0
- package/dist-standalone/_deps/crypto/base64.d.ts +0 -29
- package/dist-standalone/_deps/crypto/base64.js +0 -222
- package/dist-standalone/_deps/crypto/cjs/base64.js +0 -665
- package/dist-standalone/_deps/crypto/cjs/errors.js +0 -675
- package/dist-standalone/_deps/crypto/cjs/hmac.js +0 -473
- package/dist-standalone/_deps/crypto/cjs/index.js +0 -852
- package/dist-standalone/_deps/crypto/cjs/package.json +0 -1
- package/dist-standalone/_deps/crypto/cjs/padding.js +0 -511
- package/dist-standalone/_deps/crypto/cjs/share-header.js +0 -372
- package/dist-standalone/_deps/crypto/cjs/shares.js +0 -874
- package/dist-standalone/_deps/crypto/cjs/tlv.js +0 -1021
- package/dist-standalone/_deps/crypto/cjs/uuid.js +0 -443
- package/dist-standalone/_deps/crypto/cjs/verify.js +0 -414
- package/dist-standalone/_deps/crypto/cjs/xorida.js +0 -923
- package/dist-standalone/_deps/crypto/errors.d.ts +0 -51
- package/dist-standalone/_deps/crypto/errors.js +0 -199
- package/dist-standalone/_deps/crypto/hmac.d.ts +0 -39
- package/dist-standalone/_deps/crypto/hmac.js +0 -134
- package/dist-standalone/_deps/crypto/index.d.ts +0 -20
- package/dist-standalone/_deps/crypto/index.js +0 -145
- package/dist-standalone/_deps/crypto/padding.d.ts +0 -19
- package/dist-standalone/_deps/crypto/padding.js +0 -159
- package/dist-standalone/_deps/crypto/share-header.d.ts +0 -44
- package/dist-standalone/_deps/crypto/share-header.js +0 -92
- package/dist-standalone/_deps/crypto/shares.d.ts +0 -27
- package/dist-standalone/_deps/crypto/shares.js +0 -295
- package/dist-standalone/_deps/crypto/tlv.d.ts +0 -26
- package/dist-standalone/_deps/crypto/tlv.js +0 -364
- package/dist-standalone/_deps/crypto/uuid.d.ts +0 -22
- package/dist-standalone/_deps/crypto/uuid.js +0 -136
- package/dist-standalone/_deps/crypto/verify.d.ts +0 -15
- package/dist-standalone/_deps/crypto/verify.js +0 -71
- package/dist-standalone/_deps/crypto/xorida.d.ts +0 -44
- package/dist-standalone/_deps/crypto/xorida.js +0 -366
- package/dist-standalone/_deps/shared/errors.d.ts.map +0 -1
- package/dist-standalone/_deps/shared/errors.js.map +0 -1
- package/dist-standalone/_deps/shared/index.d.ts.map +0 -1
- package/dist-standalone/_deps/shared/index.js.map +0 -1
- package/dist-standalone/_deps/shared/types.d.ts.map +0 -1
- package/dist-standalone/_deps/shared/types.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/errors.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/errors.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/index.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/index.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/pagination.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/pagination.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/progress.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/progress.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/search.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/search.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/types.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/cjs/types.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/errors.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/errors.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/index.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/index.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/pagination.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/pagination.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/progress.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/progress.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/search.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/search.js.map +0 -1
- package/dist-standalone/_deps/ux-helpers/types.d.ts.map +0 -1
- package/dist-standalone/_deps/ux-helpers/types.js.map +0 -1
- package/dist-standalone/_deps/xregistry/discovery.d.ts.map +0 -1
- package/dist-standalone/_deps/xregistry/discovery.js.map +0 -1
- package/dist-standalone/_deps/xregistry/errors.d.ts.map +0 -1
- package/dist-standalone/_deps/xregistry/errors.js.map +0 -1
- package/dist-standalone/_deps/xregistry/index.d.ts.map +0 -1
- package/dist-standalone/_deps/xregistry/index.js.map +0 -1
- package/dist-standalone/_deps/xregistry/registry.d.ts.map +0 -1
- package/dist-standalone/_deps/xregistry/registry.js.map +0 -1
- package/dist-standalone/_deps/xregistry/schema.d.ts.map +0 -1
- package/dist-standalone/_deps/xregistry/schema.js.map +0 -1
- package/dist-standalone/_deps/xregistry/types.d.ts.map +0 -1
- package/dist-standalone/_deps/xregistry/types.js.map +0 -1
|
@@ -1,826 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* @module errors
|
|
4
|
-
* Named error class hierarchy for xBind agent-sdk.
|
|
5
|
-
*
|
|
6
|
-
* These classes are supplementary — existing `Result<T, E>` string codes are
|
|
7
|
-
* unchanged. Use `toXBindError()` to convert a string error code into a
|
|
8
|
-
* class-based error for try/catch consumers.
|
|
9
|
-
*/
|
|
10
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
|
-
exports.XBindBillingError = exports.XBindAgentError = exports.XBindSplitChannelError = exports.XBindKeyAgreementError = exports.XBindRegistryError = exports.XBindTransportError = exports.XBindEnvelopeError = exports.XBindIdentityError = exports.XBindError = void 0;
|
|
12
|
-
exports.createXBindErrorDetail = createXBindErrorDetail;
|
|
13
|
-
exports.toXBindError = toXBindError;
|
|
14
|
-
exports.isXBindError = isXBindError;
|
|
15
|
-
const ux_helpers_1 = require("../_deps/ux-helpers/index.js");
|
|
16
|
-
const DOC_BASE = 'https://private.me/docs/xbind';
|
|
17
|
-
/** Base error class for all XBind errors. */
|
|
18
|
-
class XBindError extends Error {
|
|
19
|
-
/** Machine-readable error code matching the Result<T,E> string unions. */
|
|
20
|
-
code;
|
|
21
|
-
/** Sub-code parsed from colon-separated codes (e.g. 'DECRYPTION' from 'DECRYPT_FAILED:DECRYPTION'). */
|
|
22
|
-
subCode;
|
|
23
|
-
/** URL to relevant documentation for this error. */
|
|
24
|
-
docUrl;
|
|
25
|
-
constructor(code, message, docUrl) {
|
|
26
|
-
super(message);
|
|
27
|
-
this.name = 'XBindError';
|
|
28
|
-
const parts = code.split(':');
|
|
29
|
-
this.code = parts[0] ?? code;
|
|
30
|
-
this.subCode = parts.length > 1 ? parts.slice(1).join(':') : undefined;
|
|
31
|
-
this.docUrl = docUrl;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
exports.XBindError = XBindError;
|
|
35
|
-
/** Ed25519/X25519 identity errors (keygen, sign, verify, DID, import/export). */
|
|
36
|
-
class XBindIdentityError extends XBindError {
|
|
37
|
-
constructor(code, message) {
|
|
38
|
-
super(code, message, `${DOC_BASE}#identity`);
|
|
39
|
-
this.name = 'XBindIdentityError';
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.XBindIdentityError = XBindIdentityError;
|
|
43
|
-
/** Envelope creation, encryption, decryption, and parsing errors. */
|
|
44
|
-
class XBindEnvelopeError extends XBindError {
|
|
45
|
-
constructor(code, message) {
|
|
46
|
-
super(code, message, `${DOC_BASE}#envelope`);
|
|
47
|
-
this.name = 'XBindEnvelopeError';
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
exports.XBindEnvelopeError = XBindEnvelopeError;
|
|
51
|
-
/** Transport-layer errors (send failures, network, timeouts). */
|
|
52
|
-
class XBindTransportError extends XBindError {
|
|
53
|
-
constructor(code, message) {
|
|
54
|
-
super(code, message, `${DOC_BASE}#transport`);
|
|
55
|
-
this.name = 'XBindTransportError';
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
exports.XBindTransportError = XBindTransportError;
|
|
59
|
-
/** Trust registry errors (lookup, registration, revocation). */
|
|
60
|
-
class XBindRegistryError extends XBindError {
|
|
61
|
-
constructor(code, message) {
|
|
62
|
-
super(code, message, `${DOC_BASE}#registry`);
|
|
63
|
-
this.name = 'XBindRegistryError';
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.XBindRegistryError = XBindRegistryError;
|
|
67
|
-
/** X25519 ECDH key agreement errors. */
|
|
68
|
-
class XBindKeyAgreementError extends XBindError {
|
|
69
|
-
constructor(code, message) {
|
|
70
|
-
super(code, message, `${DOC_BASE}#key-agreement`);
|
|
71
|
-
this.name = 'XBindKeyAgreementError';
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
exports.XBindKeyAgreementError = XBindKeyAgreementError;
|
|
75
|
-
/** XorIDA split-channel errors (split, reconstruct, HMAC, shares). */
|
|
76
|
-
class XBindSplitChannelError extends XBindError {
|
|
77
|
-
constructor(code, message) {
|
|
78
|
-
super(code, message, `${DOC_BASE}#split-channel`);
|
|
79
|
-
this.name = 'XBindSplitChannelError';
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
exports.XBindSplitChannelError = XBindSplitChannelError;
|
|
83
|
-
/** High-level Agent errors (wraps subsystem errors with context). */
|
|
84
|
-
class XBindAgentError extends XBindError {
|
|
85
|
-
constructor(code, message) {
|
|
86
|
-
super(code, message, `${DOC_BASE}#agent`);
|
|
87
|
-
this.name = 'XBindAgentError';
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
exports.XBindAgentError = XBindAgentError;
|
|
91
|
-
/** Billing and payment errors (subscriptions, limits, verification). */
|
|
92
|
-
class XBindBillingError extends XBindError {
|
|
93
|
-
constructor(code, message) {
|
|
94
|
-
super(code, message, `${DOC_BASE}#billing`);
|
|
95
|
-
this.name = "XBindBillingError";
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
exports.XBindBillingError = XBindBillingError;
|
|
99
|
-
/**
|
|
100
|
-
* Create detailed error information for a given error code.
|
|
101
|
-
*
|
|
102
|
-
* @param code - Error code (e.g., 'INVALID_DID')
|
|
103
|
-
* @param additionalContext - Optional context (field name, custom hint)
|
|
104
|
-
* @returns ACIErrorDetail with code, message, hint, field, and docs
|
|
105
|
-
*/
|
|
106
|
-
function createXBindErrorDetail(code, additionalContext) {
|
|
107
|
-
const baseCode = code.split(':')[0] ?? code;
|
|
108
|
-
const entry = ERROR_DETAILS[baseCode];
|
|
109
|
-
if (entry) {
|
|
110
|
-
return (0, ux_helpers_1.createDetailedError)(code, entry.message, {
|
|
111
|
-
hint: additionalContext?.hint ?? entry.hint,
|
|
112
|
-
field: additionalContext?.field ?? entry.field,
|
|
113
|
-
docs: entry.docs,
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
// Fallback for unknown codes
|
|
117
|
-
return (0, ux_helpers_1.createDetailedError)(code, `XBind error: ${code}`, {
|
|
118
|
-
docs: DOC_BASE,
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
/** Detailed error information for each error code. */
|
|
122
|
-
const ERROR_DETAILS = {
|
|
123
|
-
// Identity
|
|
124
|
-
KEYGEN_FAILED: {
|
|
125
|
-
message: 'Key generation failed',
|
|
126
|
-
hint: 'Actions: (1) Verify Web Crypto API available (browser/Node.js 15+), (2) Check security context (HTTPS or localhost), (3) Retry operation',
|
|
127
|
-
suggested_action: 'Verify runtime environment supports Web Crypto API and retry key generation',
|
|
128
|
-
severity: 'critical',
|
|
129
|
-
docs: `${DOC_BASE}#identity`,
|
|
130
|
-
aws: 'InternalFailure',
|
|
131
|
-
grpc: 13,
|
|
132
|
-
http: 500,
|
|
133
|
-
},
|
|
134
|
-
SIGN_FAILED: {
|
|
135
|
-
message: 'Signing failed',
|
|
136
|
-
hint: 'Actions: (1) Verify private key is valid and not corrupted, (2) Check key format (must be PKCS8), (3) Ensure key was properly imported',
|
|
137
|
-
suggested_action: 'Verify private key is valid and properly imported with extractable flag',
|
|
138
|
-
severity: 'high',
|
|
139
|
-
docs: `${DOC_BASE}#identity`,
|
|
140
|
-
aws: 'InternalFailure',
|
|
141
|
-
grpc: 13,
|
|
142
|
-
http: 500,
|
|
143
|
-
},
|
|
144
|
-
VERIFY_FAILED: {
|
|
145
|
-
message: 'Signature verification failed',
|
|
146
|
-
hint: 'Actions: (1) Verify public key matches sender, (2) Check message integrity (not truncated/modified), (3) Confirm signature format is valid base64',
|
|
147
|
-
suggested_action: 'Verify sender public key and message integrity before retrying',
|
|
148
|
-
severity: 'critical',
|
|
149
|
-
docs: `${DOC_BASE}#identity`,
|
|
150
|
-
aws: 'InvalidParameterValue',
|
|
151
|
-
grpc: 3,
|
|
152
|
-
http: 400,
|
|
153
|
-
},
|
|
154
|
-
INVALID_DID: {
|
|
155
|
-
message: 'DID format is invalid',
|
|
156
|
-
hint: 'Actions: (1) Verify DID starts with "did:" prefix, (2) Check method is valid (e.g., did:key:z6Mk...), (3) Use validateDID() helper before processing',
|
|
157
|
-
field: 'did',
|
|
158
|
-
suggested_action: 'Use validateDID() helper to verify format before processing',
|
|
159
|
-
severity: 'high',
|
|
160
|
-
docs: `${DOC_BASE}#identity`,
|
|
161
|
-
aws: 'InvalidParameterValue',
|
|
162
|
-
grpc: 3,
|
|
163
|
-
http: 400,
|
|
164
|
-
},
|
|
165
|
-
INVALID_KEY_LENGTH: {
|
|
166
|
-
message: 'Key material has incorrect length',
|
|
167
|
-
hint: 'Actions: (1) Verify X25519 key is exactly 32 bytes, (2) Check base64 decoding result, (3) Log key.length to confirm size mismatch',
|
|
168
|
-
suggested_action: 'Verify key is exactly 32 bytes and properly base64-decoded',
|
|
169
|
-
severity: 'high',
|
|
170
|
-
docs: `${DOC_BASE}#key-agreement`,
|
|
171
|
-
aws: 'InvalidParameterValue',
|
|
172
|
-
grpc: 3,
|
|
173
|
-
http: 400,
|
|
174
|
-
},
|
|
175
|
-
EXPORT_FAILED: {
|
|
176
|
-
message: 'PKCS8 export failed',
|
|
177
|
-
hint: 'Actions: (1) Verify key was created with extractable:true, (2) Check browser/Node.js supports PKCS8 export, (3) Use Web Crypto API docs: https://mdn.io/SubtleCrypto.exportKey',
|
|
178
|
-
suggested_action: 'Create key with extractable:true flag and verify Web Crypto API support',
|
|
179
|
-
severity: 'medium',
|
|
180
|
-
docs: `${DOC_BASE}#identity`,
|
|
181
|
-
aws: 'InternalFailure',
|
|
182
|
-
grpc: 13,
|
|
183
|
-
http: 500,
|
|
184
|
-
},
|
|
185
|
-
IMPORT_FAILED: {
|
|
186
|
-
message: 'PKCS8 import failed',
|
|
187
|
-
hint: 'Actions: (1) Validate PKCS8 format (PEM or raw bytes), (2) Decode base64 if needed, (3) Check algorithm matches (Ed25519/X25519), (4) Verify key data is not corrupted',
|
|
188
|
-
suggested_action: 'Validate PKCS8 format and verify key data is not corrupted',
|
|
189
|
-
severity: 'high',
|
|
190
|
-
docs: `${DOC_BASE}#identity`,
|
|
191
|
-
aws: 'InvalidParameterValue',
|
|
192
|
-
grpc: 3,
|
|
193
|
-
http: 400,
|
|
194
|
-
},
|
|
195
|
-
// Envelope
|
|
196
|
-
INVALID_VERSION: {
|
|
197
|
-
message: 'Unsupported envelope version',
|
|
198
|
-
hint: 'Actions: (1) Check envelope.version field, (2) Verify sender uses compatible version (v1-v4 supported), (3) Update SDK or request sender upgrade',
|
|
199
|
-
field: 'version',
|
|
200
|
-
suggested_action: 'Update SDK or request sender to use compatible version (v1-v4)',
|
|
201
|
-
severity: 'high',
|
|
202
|
-
docs: `${DOC_BASE}#envelope`,
|
|
203
|
-
aws: 'ValidationException',
|
|
204
|
-
grpc: 3,
|
|
205
|
-
http: 400,
|
|
206
|
-
},
|
|
207
|
-
INVALID_ALG: {
|
|
208
|
-
message: 'Unknown encryption algorithm',
|
|
209
|
-
hint: 'Actions: (1) Verify envelope.alg === "AES-256-GCM", (2) Check sender uses correct algorithm, (3) Log algorithm value to confirm mismatch',
|
|
210
|
-
field: 'alg',
|
|
211
|
-
suggested_action: 'Verify sender uses AES-256-GCM algorithm',
|
|
212
|
-
severity: 'high',
|
|
213
|
-
docs: `${DOC_BASE}#envelope`,
|
|
214
|
-
aws: 'ValidationException',
|
|
215
|
-
grpc: 3,
|
|
216
|
-
http: 400,
|
|
217
|
-
},
|
|
218
|
-
INVALID_NONCE: {
|
|
219
|
-
message: 'Nonce is missing or invalid',
|
|
220
|
-
hint: 'Actions: (1) Verify nonce exists and is 12 bytes, (2) Check base64 decoding, (3) Ensure nonce is unique per envelope (check replay buffer)',
|
|
221
|
-
field: 'nonce',
|
|
222
|
-
suggested_action: 'Verify nonce is 12 bytes and properly base64-encoded',
|
|
223
|
-
severity: 'critical',
|
|
224
|
-
docs: `${DOC_BASE}#envelope`,
|
|
225
|
-
aws: 'ValidationException',
|
|
226
|
-
grpc: 3,
|
|
227
|
-
http: 400,
|
|
228
|
-
},
|
|
229
|
-
INVALID_FIELDS: {
|
|
230
|
-
message: 'Required envelope fields are missing',
|
|
231
|
-
hint: 'Actions: (1) Verify sender/recipient DIDs present, (2) Check payload is not empty, (3) Validate envelope has: version, alg, nonce, ciphertext, tag',
|
|
232
|
-
suggested_action: 'Validate all required envelope fields are present',
|
|
233
|
-
severity: 'high',
|
|
234
|
-
docs: `${DOC_BASE}#envelope`,
|
|
235
|
-
aws: 'ValidationException',
|
|
236
|
-
grpc: 3,
|
|
237
|
-
http: 400,
|
|
238
|
-
},
|
|
239
|
-
ENCRYPT_FAILED: {
|
|
240
|
-
message: 'AES-256-GCM encryption failed',
|
|
241
|
-
hint: 'Actions: (1) Verify shared key is exactly 32 bytes, (2) Check plaintext is valid UTF-8, (3) Ensure nonce is 12 bytes, (4) Review Web Crypto error details',
|
|
242
|
-
suggested_action: 'Verify key is 32 bytes and nonce is 12 bytes before encryption',
|
|
243
|
-
severity: 'high',
|
|
244
|
-
docs: `${DOC_BASE}#envelope`,
|
|
245
|
-
aws: 'InternalFailure',
|
|
246
|
-
grpc: 13,
|
|
247
|
-
http: 500,
|
|
248
|
-
},
|
|
249
|
-
DECRYPT_FAILED: {
|
|
250
|
-
message: 'Decryption failed',
|
|
251
|
-
hint: 'Actions: (1) Verify correct key is being used, (2) Check ciphertext integrity (not truncated), (3) Confirm authentication tag is valid, (4) Verify sender used same algorithm',
|
|
252
|
-
suggested_action: 'Verify correct key and check ciphertext integrity',
|
|
253
|
-
severity: 'critical',
|
|
254
|
-
docs: `${DOC_BASE}#envelope`,
|
|
255
|
-
aws: 'InternalFailure',
|
|
256
|
-
grpc: 13,
|
|
257
|
-
http: 500,
|
|
258
|
-
},
|
|
259
|
-
PARSE_FAILED: {
|
|
260
|
-
message: 'Envelope deserialization failed',
|
|
261
|
-
hint: 'Actions: (1) Validate JSON structure, (2) Check for truncation or corruption in data, (3) Verify base64 encoding of nested fields, (4) Use JSON.parse() to identify syntax error',
|
|
262
|
-
suggested_action: 'Validate JSON structure and check for data corruption',
|
|
263
|
-
severity: 'high',
|
|
264
|
-
docs: `${DOC_BASE}#envelope`,
|
|
265
|
-
aws: 'ValidationException',
|
|
266
|
-
grpc: 3,
|
|
267
|
-
http: 400,
|
|
268
|
-
},
|
|
269
|
-
// Transport
|
|
270
|
-
SEND_FAILED: {
|
|
271
|
-
message: 'Message send failed',
|
|
272
|
-
hint: 'Actions: (1) Check network connectivity (ping registry), (2) Verify recipient email is valid, (3) Confirm recipient is registered in trust registry, (4) Retry with exponential backoff',
|
|
273
|
-
suggested_action: 'Check network connectivity and retry with exponential backoff',
|
|
274
|
-
severity: 'high',
|
|
275
|
-
docs: `${DOC_BASE}#transport`,
|
|
276
|
-
aws: 'ServiceUnavailable',
|
|
277
|
-
grpc: 14,
|
|
278
|
-
http: 503,
|
|
279
|
-
},
|
|
280
|
-
NETWORK_ERROR: {
|
|
281
|
-
message: 'Network request failed',
|
|
282
|
-
hint: 'Actions: (1) Verify internet connection, (2) Check DNS resolution, (3) Try pinging registry endpoint, (4) Implement retry with exponential backoff (2s, 4s, 8s)',
|
|
283
|
-
suggested_action: 'Verify internet connection and implement exponential backoff retry',
|
|
284
|
-
severity: 'high',
|
|
285
|
-
docs: `${DOC_BASE}#transport`,
|
|
286
|
-
aws: 'ServiceUnavailable',
|
|
287
|
-
grpc: 14,
|
|
288
|
-
http: 503,
|
|
289
|
-
},
|
|
290
|
-
RECIPIENT_UNREACHABLE: {
|
|
291
|
-
message: 'Recipient is unreachable',
|
|
292
|
-
hint: 'Actions: (1) Verify recipient email address is spelled correctly, (2) Check if recipient is registered with xBind, (3) Confirm recipient is online, (4) Ask recipient to check their registration status',
|
|
293
|
-
field: 'to',
|
|
294
|
-
suggested_action: 'Verify recipient is registered with xBind and online',
|
|
295
|
-
severity: 'medium',
|
|
296
|
-
docs: `${DOC_BASE}#transport`,
|
|
297
|
-
aws: 'ServiceUnavailable',
|
|
298
|
-
grpc: 14,
|
|
299
|
-
http: 503,
|
|
300
|
-
},
|
|
301
|
-
TIMEOUT: {
|
|
302
|
-
message: 'Transport operation timed out',
|
|
303
|
-
hint: 'Actions: (1) Increase timeout threshold (default: 30s), (2) Check network latency (ping registry), (3) Retry operation, (4) Verify registry is responsive',
|
|
304
|
-
suggested_action: 'Increase timeout threshold and check network latency',
|
|
305
|
-
severity: 'medium',
|
|
306
|
-
docs: `${DOC_BASE}#transport`,
|
|
307
|
-
aws: 'RequestTimeout',
|
|
308
|
-
grpc: 4,
|
|
309
|
-
http: 408,
|
|
310
|
-
},
|
|
311
|
-
// Registry
|
|
312
|
-
NOT_FOUND: {
|
|
313
|
-
message: 'Agent not found in trust registry',
|
|
314
|
-
hint: 'Actions: (1) Ask recipient to join XBind and register, (2) Verify recipient email is correct, (3) Query registry with recipient DID/email, (4) Check registration timestamp on recipient side',
|
|
315
|
-
field: 'to',
|
|
316
|
-
suggested_action: 'Ask recipient to register with xBind',
|
|
317
|
-
severity: 'medium',
|
|
318
|
-
docs: `${DOC_BASE}#registry`,
|
|
319
|
-
aws: 'ResourceNotFoundException',
|
|
320
|
-
grpc: 5,
|
|
321
|
-
http: 404,
|
|
322
|
-
},
|
|
323
|
-
ALREADY_REGISTERED: {
|
|
324
|
-
message: 'Agent is already registered',
|
|
325
|
-
hint: 'Actions: (1) Use updateAgent() instead of registerAgent(), (2) Provide new public keys or metadata, (3) Verify DID matches existing registration, (4) Check for duplicate registrations',
|
|
326
|
-
suggested_action: 'Use updateAgent() instead of registerAgent()',
|
|
327
|
-
severity: 'low',
|
|
328
|
-
docs: `${DOC_BASE}#registry`,
|
|
329
|
-
aws: 'ResourceAlreadyExists',
|
|
330
|
-
grpc: 6,
|
|
331
|
-
http: 409,
|
|
332
|
-
},
|
|
333
|
-
REVOKED: {
|
|
334
|
-
message: 'Agent has been revoked from the registry',
|
|
335
|
-
hint: 'Actions: (1) Contact registry administrator, (2) Check revocation timestamp and reason, (3) Request re-registration if revocation was accidental, (4) Verify agent identity with admin',
|
|
336
|
-
suggested_action: 'Contact registry administrator to resolve revocation',
|
|
337
|
-
severity: 'high',
|
|
338
|
-
docs: `${DOC_BASE}#registry`,
|
|
339
|
-
aws: 'AccessDenied',
|
|
340
|
-
grpc: 7,
|
|
341
|
-
http: 403,
|
|
342
|
-
},
|
|
343
|
-
// Key agreement
|
|
344
|
-
DERIVE_FAILED: {
|
|
345
|
-
message: 'ECDH key derivation failed',
|
|
346
|
-
hint: 'Actions: (1) Verify peer public key is valid X25519 (32 bytes), (2) Check key is not corrupted, (3) Confirm algorithm is X25519 ECDH, (4) Review Web Crypto error details',
|
|
347
|
-
suggested_action: 'Verify peer public key is valid X25519 and not corrupted',
|
|
348
|
-
severity: 'high',
|
|
349
|
-
docs: `${DOC_BASE}#key-agreement`,
|
|
350
|
-
aws: 'InternalFailure',
|
|
351
|
-
grpc: 13,
|
|
352
|
-
http: 500,
|
|
353
|
-
},
|
|
354
|
-
KEM_ENCAPSULATE_FAILED: {
|
|
355
|
-
message: 'ML-KEM-768 encapsulation failed',
|
|
356
|
-
hint: 'Actions: (1) Verify recipient public key is valid ML-KEM-768, (2) Check key encoding (must be valid format), (3) Confirm post-quantum support enabled, (4) Validate key length and structure',
|
|
357
|
-
suggested_action: 'Verify recipient ML-KEM-768 public key and post-quantum support',
|
|
358
|
-
severity: 'high',
|
|
359
|
-
docs: `${DOC_BASE}#key-agreement`,
|
|
360
|
-
aws: 'InternalFailure',
|
|
361
|
-
grpc: 13,
|
|
362
|
-
http: 500,
|
|
363
|
-
},
|
|
364
|
-
KEM_DECAPSULATE_FAILED: {
|
|
365
|
-
message: 'ML-KEM-768 decapsulation failed',
|
|
366
|
-
hint: 'Actions: (1) Verify ciphertext integrity (not truncated), (2) Check secret key is valid, (3) Confirm ciphertext matches secret key, (4) Verify ML-KEM library is initialized',
|
|
367
|
-
suggested_action: 'Verify ciphertext integrity and ML-KEM secret key',
|
|
368
|
-
severity: 'high',
|
|
369
|
-
docs: `${DOC_BASE}#key-agreement`,
|
|
370
|
-
aws: 'InternalFailure',
|
|
371
|
-
grpc: 13,
|
|
372
|
-
http: 500,
|
|
373
|
-
},
|
|
374
|
-
HKDF_FAILED: {
|
|
375
|
-
message: 'HKDF key derivation failed',
|
|
376
|
-
hint: 'Actions: (1) Verify both ECDH and KEM shared secrets are valid, (2) Check HKDF input size, (3) Ensure hash algorithm (SHA-256) is available, (4) Review Web Crypto HKDF implementation',
|
|
377
|
-
suggested_action: 'Verify shared secrets are valid and SHA-256 is available',
|
|
378
|
-
severity: 'high',
|
|
379
|
-
docs: `${DOC_BASE}#key-agreement`,
|
|
380
|
-
aws: 'InternalFailure',
|
|
381
|
-
grpc: 13,
|
|
382
|
-
http: 500,
|
|
383
|
-
},
|
|
384
|
-
MLKEM_NOT_AVAILABLE: {
|
|
385
|
-
message: 'ML-KEM-768 key not available',
|
|
386
|
-
hint: 'Actions: (1) Enable post-quantum: Agent.create({postQuantum: true}), (2) Check runtime supports ML-KEM-768, (3) Verify agent was initialized with PQ keys, (4) Regenerate identity with PQ enabled',
|
|
387
|
-
suggested_action: 'Create agent with postQuantum: true',
|
|
388
|
-
severity: 'medium',
|
|
389
|
-
docs: `${DOC_BASE}#key-agreement`,
|
|
390
|
-
},
|
|
391
|
-
PQ_SIGN_FAILED: {
|
|
392
|
-
message: 'ML-DSA-65 signing failed',
|
|
393
|
-
hint: 'Actions: (1) Verify ML-DSA-65 secret key is valid and not corrupted, (2) Check post-quantum support is enabled, (3) Ensure message to sign is not empty, (4) Review ML-DSA library logs',
|
|
394
|
-
suggested_action: 'Verify ML-DSA-65 secret key and post-quantum support',
|
|
395
|
-
severity: 'high',
|
|
396
|
-
docs: `${DOC_BASE}#identity`,
|
|
397
|
-
aws: 'InternalFailure',
|
|
398
|
-
grpc: 13,
|
|
399
|
-
http: 500,
|
|
400
|
-
},
|
|
401
|
-
PQ_VERIFY_FAILED: {
|
|
402
|
-
message: 'ML-DSA-65 verification failed',
|
|
403
|
-
hint: 'Actions: (1) Verify public key matches signer, (2) Check signature format and encoding, (3) Confirm message matches what was signed, (4) Ensure post-quantum keys are synchronized',
|
|
404
|
-
suggested_action: 'Verify signer public key and signature format',
|
|
405
|
-
severity: 'high',
|
|
406
|
-
docs: `${DOC_BASE}#identity`,
|
|
407
|
-
aws: 'InvalidParameterValue',
|
|
408
|
-
grpc: 3,
|
|
409
|
-
http: 400,
|
|
410
|
-
},
|
|
411
|
-
// Split-channel
|
|
412
|
-
SPLIT_FAILED: {
|
|
413
|
-
message: 'XorIDA split failed',
|
|
414
|
-
hint: 'Actions: (1) Verify threshold <= shareCount, (2) Check threshold >= 2, (3) Validate payload size < 1MB, (4) Ensure sufficient memory for split operation',
|
|
415
|
-
suggested_action: 'Verify threshold parameters and payload size',
|
|
416
|
-
severity: 'high',
|
|
417
|
-
docs: `${DOC_BASE}#split-channel`,
|
|
418
|
-
aws: 'InternalFailure',
|
|
419
|
-
grpc: 13,
|
|
420
|
-
http: 500,
|
|
421
|
-
},
|
|
422
|
-
INSUFFICIENT_SHARES: {
|
|
423
|
-
message: 'Not enough shares to reconstruct',
|
|
424
|
-
hint: 'Actions: (1) Log number of shares collected, (2) Check threshold requirement, (3) Collect more shares from recipients, (4) Verify shares are from same split (group ID match)',
|
|
425
|
-
suggested_action: 'Collect more shares to meet threshold requirement',
|
|
426
|
-
severity: 'high',
|
|
427
|
-
docs: `${DOC_BASE}#split-channel`,
|
|
428
|
-
aws: 'ValidationException',
|
|
429
|
-
grpc: 3,
|
|
430
|
-
http: 400,
|
|
431
|
-
},
|
|
432
|
-
INCONSISTENT_SHARES: {
|
|
433
|
-
message: 'Shares have mismatched group IDs or lengths',
|
|
434
|
-
hint: 'Actions: (1) Verify all shares are from same split, (2) Check group IDs match, (3) Ensure shares have same length, (4) Discard mismatched shares and request correct ones',
|
|
435
|
-
suggested_action: 'Verify all shares are from the same split operation',
|
|
436
|
-
severity: 'high',
|
|
437
|
-
docs: `${DOC_BASE}#split-channel`,
|
|
438
|
-
aws: 'ValidationException',
|
|
439
|
-
grpc: 3,
|
|
440
|
-
http: 400,
|
|
441
|
-
},
|
|
442
|
-
HMAC_VERIFICATION_FAILED: {
|
|
443
|
-
message: 'Share HMAC check failed',
|
|
444
|
-
hint: 'Actions: (1) Check share data is not corrupted in transit, (2) Verify share was not tampered with, (3) Confirm sender used correct HMAC key, (4) Request fresh share from sender',
|
|
445
|
-
suggested_action: 'Request fresh share from sender',
|
|
446
|
-
severity: 'critical',
|
|
447
|
-
docs: `${DOC_BASE}#split-channel`,
|
|
448
|
-
aws: 'UnauthorizedOperation',
|
|
449
|
-
grpc: 16,
|
|
450
|
-
http: 401,
|
|
451
|
-
},
|
|
452
|
-
UNPAD_FAILED: {
|
|
453
|
-
message: 'Padding removal failed after reconstruction',
|
|
454
|
-
hint: 'Actions: (1) Verify reconstruction succeeded before unpadding, (2) Check reconstructed data is valid UTF-8, (3) Confirm padding algorithm matches (PKCS7), (4) Inspect raw reconstructed bytes',
|
|
455
|
-
suggested_action: 'Verify reconstruction succeeded and data is valid UTF-8',
|
|
456
|
-
severity: 'high',
|
|
457
|
-
docs: `${DOC_BASE}#split-channel`,
|
|
458
|
-
aws: 'InternalFailure',
|
|
459
|
-
grpc: 13,
|
|
460
|
-
http: 500,
|
|
461
|
-
},
|
|
462
|
-
INVALID_SHARE_DATA: {
|
|
463
|
-
message: 'Share data is malformed',
|
|
464
|
-
hint: 'Actions: (1) Verify share is valid base64, (2) Check share structure (TLV format if applicable), (3) Log raw share bytes to inspect, (4) Request correctly-formatted share from sender',
|
|
465
|
-
suggested_action: 'Verify share is valid base64 and request correctly-formatted share',
|
|
466
|
-
severity: 'high',
|
|
467
|
-
docs: `${DOC_BASE}#split-channel`,
|
|
468
|
-
aws: 'ValidationException',
|
|
469
|
-
grpc: 3,
|
|
470
|
-
http: 400,
|
|
471
|
-
},
|
|
472
|
-
// Xchange
|
|
473
|
-
XCHANGE_KEYGEN_FAILED: {
|
|
474
|
-
message: 'Xchange key generation failed',
|
|
475
|
-
hint: 'Actions: (1) Verify Web Crypto API available (HTTPS/localhost), (2) Check runtime supports key generation, (3) Ensure sufficient entropy, (4) Retry with fresh context',
|
|
476
|
-
suggested_action: 'Verify Web Crypto API available and retry',
|
|
477
|
-
severity: 'high',
|
|
478
|
-
docs: `${DOC_BASE}#xchange`,
|
|
479
|
-
aws: 'InternalFailure',
|
|
480
|
-
grpc: 13,
|
|
481
|
-
http: 500,
|
|
482
|
-
},
|
|
483
|
-
XCHANGE_ENCRYPT_FAILED: {
|
|
484
|
-
message: 'Xchange bundle encryption failed',
|
|
485
|
-
hint: 'Actions: (1) Check payload size < 64KB, (2) Verify encryption key is 32 bytes, (3) Ensure bundle structure is valid, (4) Review payload for null bytes',
|
|
486
|
-
suggested_action: 'Verify payload size and encryption key length',
|
|
487
|
-
severity: 'high',
|
|
488
|
-
docs: `${DOC_BASE}#xchange`,
|
|
489
|
-
aws: 'InternalFailure',
|
|
490
|
-
grpc: 13,
|
|
491
|
-
http: 500,
|
|
492
|
-
},
|
|
493
|
-
XCHANGE_DECRYPT_FAILED: {
|
|
494
|
-
message: 'Xchange bundle decryption failed',
|
|
495
|
-
hint: 'Actions: (1) Verify reconstruction completed before decryption, (2) Check decryption key matches encryption key, (3) Confirm bundle integrity (auth tag valid), (4) Inspect bundle format',
|
|
496
|
-
suggested_action: 'Verify reconstruction completed and decryption key is correct',
|
|
497
|
-
severity: 'high',
|
|
498
|
-
docs: `${DOC_BASE}#xchange`,
|
|
499
|
-
aws: 'InternalFailure',
|
|
500
|
-
grpc: 13,
|
|
501
|
-
http: 500,
|
|
502
|
-
},
|
|
503
|
-
INVALID_BUNDLE: {
|
|
504
|
-
message: 'Xchange bundle is malformed',
|
|
505
|
-
hint: 'Actions: (1) Verify bundle size >= 60 bytes (32B key + 12B IV + 16B tag), (2) Check bundle structure, (3) Decode and inspect bundle contents, (4) Request correctly-formed bundle',
|
|
506
|
-
suggested_action: 'Verify bundle size and request correctly-formed bundle',
|
|
507
|
-
severity: 'high',
|
|
508
|
-
docs: `${DOC_BASE}#xchange`,
|
|
509
|
-
aws: 'ValidationException',
|
|
510
|
-
grpc: 3,
|
|
511
|
-
http: 400,
|
|
512
|
-
},
|
|
513
|
-
// Agent (high-level)
|
|
514
|
-
IDENTITY_FAILED: {
|
|
515
|
-
message: 'Agent identity creation failed',
|
|
516
|
-
hint: 'Actions: (1) Verify Web Crypto API available, (2) Check HTTPS or localhost context, (3) Ensure runtime is Node.js 15+ or modern browser, (4) Retry agent initialization',
|
|
517
|
-
suggested_action: 'Verify Web Crypto API available and retry agent initialization',
|
|
518
|
-
severity: 'critical',
|
|
519
|
-
docs: `${DOC_BASE}#agent`,
|
|
520
|
-
aws: 'InternalFailure',
|
|
521
|
-
grpc: 13,
|
|
522
|
-
http: 500,
|
|
523
|
-
},
|
|
524
|
-
REGISTRATION_FAILED: {
|
|
525
|
-
message: 'Agent registration with trust registry failed',
|
|
526
|
-
hint: 'Actions: (1) Verify registry URL is correct and reachable, (2) Check auth token is valid and not expired, (3) Confirm registry is online (status page), (4) Retry with exponential backoff',
|
|
527
|
-
suggested_action: 'Verify registry URL and auth token, then retry with exponential backoff',
|
|
528
|
-
severity: 'high',
|
|
529
|
-
docs: `${DOC_BASE}#agent`,
|
|
530
|
-
aws: 'ServiceUnavailable',
|
|
531
|
-
grpc: 14,
|
|
532
|
-
http: 503,
|
|
533
|
-
},
|
|
534
|
-
RECIPIENT_NOT_FOUND: {
|
|
535
|
-
message: 'Recipient agent not found in registry',
|
|
536
|
-
hint: 'Actions: (1) Verify recipient email/DID is correct, (2) Ask recipient to register with XBind first, (3) Check registration on recipient side (inspect registry), (4) Wait for registration to propagate',
|
|
537
|
-
field: 'to',
|
|
538
|
-
suggested_action: 'Ask recipient to register with xBind',
|
|
539
|
-
severity: 'medium',
|
|
540
|
-
docs: `${DOC_BASE}#agent`,
|
|
541
|
-
aws: 'ResourceNotFoundException',
|
|
542
|
-
grpc: 5,
|
|
543
|
-
http: 404,
|
|
544
|
-
},
|
|
545
|
-
RECIPIENT_REVOKED: {
|
|
546
|
-
message: 'Recipient agent has been revoked',
|
|
547
|
-
hint: 'Actions: (1) Inform recipient to contact registry admin, (2) Verify revocation reason, (3) Request re-registration if accidental, (4) Confirm revocation status via registry lookup',
|
|
548
|
-
field: 'to',
|
|
549
|
-
suggested_action: 'Inform recipient to contact registry administrator',
|
|
550
|
-
severity: 'high',
|
|
551
|
-
docs: `${DOC_BASE}#agent`,
|
|
552
|
-
aws: 'AccessDenied',
|
|
553
|
-
grpc: 7,
|
|
554
|
-
http: 403,
|
|
555
|
-
},
|
|
556
|
-
KEY_AGREEMENT_FAILED: {
|
|
557
|
-
message: 'ECDH key agreement with recipient failed',
|
|
558
|
-
hint: 'Actions: (1) Verify recipient public key is valid, (2) Check key format (X25519, 32 bytes), (3) Confirm keys from same algorithm family, (4) Request fresh key from recipient',
|
|
559
|
-
suggested_action: 'Request fresh key from recipient',
|
|
560
|
-
severity: 'high',
|
|
561
|
-
docs: `${DOC_BASE}#agent`,
|
|
562
|
-
aws: 'InternalFailure',
|
|
563
|
-
grpc: 13,
|
|
564
|
-
http: 500,
|
|
565
|
-
},
|
|
566
|
-
ENVELOPE_FAILED: {
|
|
567
|
-
message: 'Envelope creation failed',
|
|
568
|
-
hint: 'Actions: (1) Check payload size < 10MB, (2) Verify recipient DID is valid, (3) Confirm sender identity is set, (4) Validate all required fields present',
|
|
569
|
-
suggested_action: 'Verify payload size and recipient DID',
|
|
570
|
-
severity: 'high',
|
|
571
|
-
docs: `${DOC_BASE}#agent`,
|
|
572
|
-
aws: 'InternalFailure',
|
|
573
|
-
grpc: 13,
|
|
574
|
-
http: 500,
|
|
575
|
-
},
|
|
576
|
-
VERIFICATION_FAILED: {
|
|
577
|
-
message: 'Incoming envelope verification failed',
|
|
578
|
-
hint: 'Actions: (1) Check sender DID is in trust registry, (2) Verify sender signature is valid, (3) Confirm sender is not revoked, (4) Review trust policy settings',
|
|
579
|
-
suggested_action: 'Verify sender is in trust registry and not revoked',
|
|
580
|
-
severity: 'critical',
|
|
581
|
-
docs: `${DOC_BASE}#agent`,
|
|
582
|
-
aws: 'UnauthorizedOperation',
|
|
583
|
-
grpc: 16,
|
|
584
|
-
http: 401,
|
|
585
|
-
},
|
|
586
|
-
REPLAY_DETECTED: {
|
|
587
|
-
message: 'Duplicate nonce detected — possible replay attack',
|
|
588
|
-
hint: 'Actions: (1) DISCARD MESSAGE for security, (2) Log nonce and sender DID, (3) Alert user to potential attack, (4) Check for compromised sender account',
|
|
589
|
-
suggested_action: 'DISCARD MESSAGE and alert user to potential replay attack',
|
|
590
|
-
severity: 'critical',
|
|
591
|
-
docs: `${DOC_BASE}#agent`,
|
|
592
|
-
aws: 'AccessDenied',
|
|
593
|
-
grpc: 7,
|
|
594
|
-
http: 403,
|
|
595
|
-
},
|
|
596
|
-
SCOPE_DENIED: {
|
|
597
|
-
message: 'Sender does not have permission for the requested scope',
|
|
598
|
-
hint: 'Actions: (1) Check sender scope permissions in registry, (2) Verify scope value is correct, (3) Contact registry admin to grant permission, (4) Confirm sender registered with requested scope',
|
|
599
|
-
field: 'scope',
|
|
600
|
-
suggested_action: 'Contact registry admin to grant permission',
|
|
601
|
-
severity: 'medium',
|
|
602
|
-
docs: `${DOC_BASE}#agent`,
|
|
603
|
-
aws: 'AccessDenied',
|
|
604
|
-
grpc: 7,
|
|
605
|
-
http: 403,
|
|
606
|
-
},
|
|
607
|
-
RECEIVER_SCOPE_DENIED: {
|
|
608
|
-
message: 'Recipient does not accept messages with this scope',
|
|
609
|
-
hint: 'Actions: (1) Check recipient receive scope settings, (2) Verify scope matches recipient policy, (3) Ask recipient to enable scope in settings, (4) Confirm recipient registry entry',
|
|
610
|
-
field: 'scope',
|
|
611
|
-
suggested_action: 'Ask recipient to enable scope in settings',
|
|
612
|
-
severity: 'medium',
|
|
613
|
-
docs: `${DOC_BASE}#agent`,
|
|
614
|
-
aws: 'AccessDenied',
|
|
615
|
-
grpc: 7,
|
|
616
|
-
http: 403,
|
|
617
|
-
},
|
|
618
|
-
TIMESTAMP_EXPIRED: {
|
|
619
|
-
message: 'Envelope timestamp is outside the allowed window',
|
|
620
|
-
hint: 'Actions: (1) Synchronize system clocks (NTP), (2) Check time difference between sender and receiver, (3) Increase timestamp window (if configurable), (4) Verify no system time drift',
|
|
621
|
-
suggested_action: 'Synchronize system clocks using NTP',
|
|
622
|
-
severity: 'medium',
|
|
623
|
-
docs: `${DOC_BASE}#agent`,
|
|
624
|
-
aws: 'RequestExpired',
|
|
625
|
-
grpc: 9,
|
|
626
|
-
http: 412,
|
|
627
|
-
},
|
|
628
|
-
INCOMPATIBLE_VERSION: {
|
|
629
|
-
message: 'Client version is incompatible with server',
|
|
630
|
-
hint: 'Actions: (1) Update xBind SDK to latest version, (2) Check minimum supported version in docs, (3) Verify server API version requirements, (4) Contact support if upgrade not possible',
|
|
631
|
-
suggested_action: 'Update xBind SDK to latest version',
|
|
632
|
-
severity: 'high',
|
|
633
|
-
docs: `${DOC_BASE}#agent`,
|
|
634
|
-
aws: 'ValidationException',
|
|
635
|
-
grpc: 3,
|
|
636
|
-
http: 400,
|
|
637
|
-
},
|
|
638
|
-
FEATURE_NOT_SUPPORTED: {
|
|
639
|
-
message: 'Requested feature is not supported',
|
|
640
|
-
hint: 'Actions: (1) Check feature availability in current plan, (2) Verify SDK version supports feature, (3) Review feature documentation, (4) Consider upgrading plan or SDK version',
|
|
641
|
-
suggested_action: 'Check feature availability in current plan or SDK version',
|
|
642
|
-
severity: 'medium',
|
|
643
|
-
docs: `${DOC_BASE}#agent`,
|
|
644
|
-
aws: 'ValidationException',
|
|
645
|
-
grpc: 12,
|
|
646
|
-
http: 501,
|
|
647
|
-
},
|
|
648
|
-
QUOTA_EXCEEDED: {
|
|
649
|
-
message: 'Operation quota exceeded',
|
|
650
|
-
hint: 'Actions: (1) Check current usage against plan limits, (2) Implement rate limiting and backoff, (3) Upgrade to higher tier plan, (4) Wait for quota reset period',
|
|
651
|
-
suggested_action: 'Implement rate limiting or upgrade plan',
|
|
652
|
-
severity: 'medium',
|
|
653
|
-
docs: `${DOC_BASE}#agent`,
|
|
654
|
-
aws: 'ThrottlingException',
|
|
655
|
-
grpc: 8,
|
|
656
|
-
http: 429,
|
|
657
|
-
},
|
|
658
|
-
ACCOUNT_SUSPENDED: {
|
|
659
|
-
message: 'Account has been suspended',
|
|
660
|
-
hint: 'Actions: (1) Contact support to determine suspension reason, (2) Review terms of service compliance, (3) Resolve any payment or policy issues, (4) Request account reactivation',
|
|
661
|
-
suggested_action: 'Contact support to resolve suspension',
|
|
662
|
-
severity: 'critical',
|
|
663
|
-
docs: `${DOC_BASE}#agent`,
|
|
664
|
-
aws: 'AccessDeniedException',
|
|
665
|
-
grpc: 7,
|
|
666
|
-
http: 403,
|
|
667
|
-
},
|
|
668
|
-
ACCOUNT_NOT_FOUND: {
|
|
669
|
-
message: 'Account does not exist',
|
|
670
|
-
hint: 'Actions: (1) Verify account identifier is correct, (2) Check if account was deleted, (3) Confirm registration completed successfully, (4) Create new account if needed',
|
|
671
|
-
suggested_action: 'Verify account identifier or create new account',
|
|
672
|
-
severity: 'high',
|
|
673
|
-
docs: `${DOC_BASE}#agent`,
|
|
674
|
-
aws: 'ResourceNotFoundException',
|
|
675
|
-
grpc: 5,
|
|
676
|
-
http: 404,
|
|
677
|
-
},
|
|
678
|
-
// Billing & Payment
|
|
679
|
-
BILLING_FAILURE: {
|
|
680
|
-
message: 'Billing operation failed',
|
|
681
|
-
hint: 'Actions: (1) Verify payment method is valid and not expired, (2) Check Stripe account status, (3) Review billing logs for specific error, (4) Contact support if issue persists',
|
|
682
|
-
suggested_action: 'Verify payment method and check billing logs',
|
|
683
|
-
severity: 'high',
|
|
684
|
-
docs: `${DOC_BASE}#billing`,
|
|
685
|
-
aws: 'RequestLimitExceeded',
|
|
686
|
-
grpc: 8,
|
|
687
|
-
http: 402,
|
|
688
|
-
},
|
|
689
|
-
PAYMENT_REQUIRED: {
|
|
690
|
-
message: 'Payment required to access this resource',
|
|
691
|
-
hint: 'Actions: (1) Add payment method in account settings, (2) Subscribe to appropriate tier, (3) Verify billing information is current, (4) Check account status',
|
|
692
|
-
suggested_action: 'Add payment method and subscribe to access this resource',
|
|
693
|
-
severity: 'medium',
|
|
694
|
-
docs: `${DOC_BASE}#billing`,
|
|
695
|
-
aws: 'AccessDenied',
|
|
696
|
-
grpc: 7,
|
|
697
|
-
http: 402,
|
|
698
|
-
},
|
|
699
|
-
SUBSCRIPTION_REQUIRED: {
|
|
700
|
-
message: 'Valid subscription required',
|
|
701
|
-
hint: 'Actions: (1) Subscribe to a paid tier in account settings, (2) Verify subscription is active and not expired, (3) Check billing status, (4) Review subscription features',
|
|
702
|
-
suggested_action: 'Subscribe to a paid tier to access this feature',
|
|
703
|
-
severity: 'medium',
|
|
704
|
-
docs: `${DOC_BASE}#billing`,
|
|
705
|
-
aws: 'AccessDenied',
|
|
706
|
-
grpc: 7,
|
|
707
|
-
http: 403,
|
|
708
|
-
},
|
|
709
|
-
TIER_LIMIT_EXCEEDED: {
|
|
710
|
-
message: 'Current tier usage limit exceeded',
|
|
711
|
-
hint: 'Actions: (1) Upgrade to higher tier for increased limits, (2) Check current usage vs tier limits, (3) Wait for limit reset (typically monthly), (4) Review tier comparison chart',
|
|
712
|
-
suggested_action: 'Upgrade to higher tier or wait for limit reset',
|
|
713
|
-
severity: 'medium',
|
|
714
|
-
docs: `${DOC_BASE}#billing`,
|
|
715
|
-
aws: 'RequestLimitExceeded',
|
|
716
|
-
grpc: 8,
|
|
717
|
-
http: 403,
|
|
718
|
-
},
|
|
719
|
-
VERIFICATION_REQUIRED: {
|
|
720
|
-
message: 'Account verification required',
|
|
721
|
-
hint: 'Actions: (1) Complete email verification, (2) Verify payment method, (3) Complete identity verification if required, (4) Check account verification status in settings',
|
|
722
|
-
suggested_action: 'Complete account verification steps in settings',
|
|
723
|
-
severity: 'high',
|
|
724
|
-
docs: `${DOC_BASE}#billing`,
|
|
725
|
-
aws: 'AccessDenied',
|
|
726
|
-
grpc: 7,
|
|
727
|
-
http: 403,
|
|
728
|
-
},
|
|
729
|
-
};
|
|
730
|
-
/** Error messages keyed by code. Includes what happened and what to do next. */
|
|
731
|
-
const ERROR_MESSAGES = {
|
|
732
|
-
// Identity
|
|
733
|
-
KEYGEN_FAILED: [XBindIdentityError, 'Key generation failed. Actions: (1) Verify Web Crypto API is available in HTTPS or localhost, (2) Check runtime is Node.js 15+ or modern browser, (3) Retry initialization.'],
|
|
734
|
-
SIGN_FAILED: [XBindIdentityError, 'Signing failed. Actions: (1) Verify private key is valid and not corrupted, (2) Check key was properly imported, (3) Ensure key is extractable.'],
|
|
735
|
-
VERIFY_FAILED: [XBindIdentityError, 'Signature verification failed. Actions: (1) Confirm public key matches signer, (2) Check message integrity, (3) Verify signature format is valid base64.'],
|
|
736
|
-
INVALID_DID: [XBindIdentityError, 'The DID string is malformed. Actions: (1) Verify format: did:key:z6Mk..., (2) Check no extra whitespace, (3) Use validateDID() helper.'],
|
|
737
|
-
INVALID_KEY_LENGTH: [XBindKeyAgreementError, 'Key material is the wrong length. Actions: (1) Verify X25519 key is exactly 32 bytes, (2) Check base64 decoding, (3) Log key.length to confirm.'],
|
|
738
|
-
EXPORT_FAILED: [XBindIdentityError, 'PKCS8 export failed. Actions: (1) Create key with extractable:true, (2) Check Web Crypto support, (3) See: https://mdn.io/SubtleCrypto.exportKey.'],
|
|
739
|
-
IMPORT_FAILED: [XBindIdentityError, 'PKCS8 import failed. Actions: (1) Validate PKCS8 format (PEM or bytes), (2) Decode base64 if needed, (3) Check algorithm (Ed25519/X25519).'],
|
|
740
|
-
// Envelope
|
|
741
|
-
INVALID_VERSION: [XBindEnvelopeError, 'Unsupported envelope version. Actions: (1) Check envelope.version field, (2) Verify sender uses v1-v4, (3) Request sender SDK update.'],
|
|
742
|
-
INVALID_ALG: [XBindEnvelopeError, 'Unknown encryption algorithm. Actions: (1) Verify envelope.alg === "AES-256-GCM", (2) Log alg value to debug, (3) Check sender SDK version.'],
|
|
743
|
-
INVALID_NONCE: [XBindEnvelopeError, 'Nonce is missing or invalid. Actions: (1) Verify nonce exists and is 12 bytes, (2) Check base64 decoding, (3) Inspect replay buffer.'],
|
|
744
|
-
INVALID_FIELDS: [XBindEnvelopeError, 'Required envelope fields are missing. Actions: (1) Verify sender/recipient DIDs, (2) Check payload exists, (3) Validate: version, alg, nonce, ciphertext, tag.'],
|
|
745
|
-
ENCRYPT_FAILED: [XBindEnvelopeError, 'AES-256-GCM encryption failed. Actions: (1) Verify key is exactly 32 bytes, (2) Check plaintext is valid, (3) Ensure nonce is 12 bytes.'],
|
|
746
|
-
DECRYPT_FAILED: [XBindEnvelopeError, 'Decryption failed. Actions: (1) Verify correct key is being used, (2) Check ciphertext integrity, (3) Confirm auth tag is valid.'],
|
|
747
|
-
PARSE_FAILED: [XBindEnvelopeError, 'Envelope deserialization failed. Actions: (1) Validate JSON structure, (2) Check for truncation, (3) Verify base64 encoding of fields.'],
|
|
748
|
-
// Transport
|
|
749
|
-
SEND_FAILED: [XBindTransportError, 'Message send failed. Actions: (1) Check network connectivity (ping registry), (2) Verify recipient address, (3) Confirm recipient registered, (4) Retry with backoff.'],
|
|
750
|
-
NETWORK_ERROR: [XBindTransportError, 'Network request failed. Actions: (1) Verify internet connection, (2) Check DNS resolution, (3) Ping registry endpoint, (4) Implement exponential backoff (2s, 4s, 8s).'],
|
|
751
|
-
RECIPIENT_UNREACHABLE: [XBindTransportError, 'Recipient is unreachable. Actions: (1) Verify recipient email is correct, (2) Check if recipient is registered, (3) Confirm recipient is online, (4) Provide human follow-up.'],
|
|
752
|
-
TIMEOUT: [XBindTransportError, 'Transport operation timed out. Actions: (1) Increase timeout threshold, (2) Check network latency, (3) Verify registry responsiveness, (4) Retry operation.'],
|
|
753
|
-
// Registry
|
|
754
|
-
NOT_FOUND: [XBindRegistryError, 'Agent not found in trust registry. Actions: (1) Ask recipient to register with xBind, (2) Verify recipient email/DID, (3) Check registration status, (4) Retry after propagation.'],
|
|
755
|
-
ALREADY_REGISTERED: [XBindRegistryError, 'Agent is already registered. Actions: (1) Use updateAgent() instead, (2) Provide new keys or metadata, (3) Verify DID matches existing entry.'],
|
|
756
|
-
REVOKED: [XBindRegistryError, 'Agent has been revoked from the registry. Actions: (1) Contact registry admin, (2) Check revocation reason, (3) Request re-registration if accidental.'],
|
|
757
|
-
// Key agreement
|
|
758
|
-
DERIVE_FAILED: [XBindKeyAgreementError, 'ECDH key derivation failed. Actions: (1) Verify peer public key is valid X25519 (32 bytes), (2) Check key is not corrupted, (3) Confirm X25519 ECDH support.'],
|
|
759
|
-
KEM_ENCAPSULATE_FAILED: [XBindKeyAgreementError, 'ML-KEM-768 encapsulation failed. Actions: (1) Verify recipient key is valid ML-KEM-768, (2) Check key format, (3) Confirm post-quantum support enabled.'],
|
|
760
|
-
KEM_DECAPSULATE_FAILED: [XBindKeyAgreementError, 'ML-KEM-768 decapsulation failed. Actions: (1) Verify ciphertext integrity, (2) Check secret key is valid, (3) Confirm ciphertext matches key.'],
|
|
761
|
-
HKDF_FAILED: [XBindKeyAgreementError, 'HKDF key derivation failed. Actions: (1) Verify both shared secrets are valid, (2) Check HKDF input size, (3) Ensure SHA-256 support.'],
|
|
762
|
-
MLKEM_NOT_AVAILABLE: [XBindKeyAgreementError, 'ML-KEM-768 key not available. Actions: (1) Create agent with postQuantum: true, (2) Check runtime supports ML-KEM-768, (3) Regenerate identity with PQ enabled.'],
|
|
763
|
-
PQ_SIGN_FAILED: [XBindIdentityError, 'ML-DSA-65 signing failed. Actions: (1) Verify secret key is valid, (2) Check post-quantum support enabled, (3) Ensure message is not empty.'],
|
|
764
|
-
PQ_VERIFY_FAILED: [XBindIdentityError, 'ML-DSA-65 verification failed. Actions: (1) Verify public key matches signer, (2) Check signature format, (3) Confirm message integrity.'],
|
|
765
|
-
// Split-channel
|
|
766
|
-
SPLIT_FAILED: [XBindSplitChannelError, 'XorIDA split failed. Actions: (1) Verify threshold <= shareCount, (2) Check threshold >= 2, (3) Validate payload < 1MB.'],
|
|
767
|
-
INSUFFICIENT_SHARES: [XBindSplitChannelError, 'Not enough shares to reconstruct. Actions: (1) Log number of shares collected, (2) Check threshold requirement, (3) Collect more shares.'],
|
|
768
|
-
INCONSISTENT_SHARES: [XBindSplitChannelError, 'Shares have mismatched group IDs or lengths. Actions: (1) Verify all from same split, (2) Check group IDs match, (3) Discard mismatched shares.'],
|
|
769
|
-
HMAC_VERIFICATION_FAILED: [XBindSplitChannelError, 'Share HMAC check failed. Actions: (1) Check share integrity in transit, (2) Verify not tampered with, (3) Request fresh share.'],
|
|
770
|
-
UNPAD_FAILED: [XBindSplitChannelError, 'Padding removal failed after reconstruction. Actions: (1) Verify reconstruction succeeded, (2) Check data is valid UTF-8, (3) Inspect raw bytes.'],
|
|
771
|
-
INVALID_SHARE_DATA: [XBindSplitChannelError, 'Share data is malformed. Actions: (1) Verify share is valid base64, (2) Check TLV structure, (3) Log raw bytes to inspect.'],
|
|
772
|
-
// Xchange (XorIDA key transport)
|
|
773
|
-
XCHANGE_KEYGEN_FAILED: [XBindKeyAgreementError, 'Xchange key generation failed. Actions: (1) Verify Web Crypto available (HTTPS/localhost), (2) Check runtime support, (3) Ensure entropy.'],
|
|
774
|
-
XCHANGE_ENCRYPT_FAILED: [XBindEnvelopeError, 'Xchange bundle encryption failed. Actions: (1) Check payload < 64KB, (2) Verify key is 32 bytes, (3) Validate bundle structure.'],
|
|
775
|
-
XCHANGE_DECRYPT_FAILED: [XBindEnvelopeError, 'Xchange bundle decryption failed. Actions: (1) Verify reconstruction succeeded, (2) Check key matches encryption key, (3) Confirm bundle integrity.'],
|
|
776
|
-
INVALID_BUNDLE: [XBindSplitChannelError, 'Xchange bundle is malformed. Actions: (1) Verify size >= 60 bytes (32B + 12B + 16B), (2) Check structure, (3) Decode to inspect.'],
|
|
777
|
-
// Agent (high-level)
|
|
778
|
-
IDENTITY_FAILED: [XBindAgentError, 'Agent identity creation failed. Actions: (1) Verify Web Crypto available, (2) Check HTTPS/localhost, (3) Ensure Node.js 15+ or modern browser.'],
|
|
779
|
-
REGISTRATION_FAILED: [XBindAgentError, 'Agent registration with trust registry failed. Actions: (1) Verify registry URL is correct, (2) Check auth token valid/not expired, (3) Confirm registry online.'],
|
|
780
|
-
RECIPIENT_NOT_FOUND: [XBindAgentError, 'Recipient agent not found in registry. Actions: (1) Verify recipient email/DID, (2) Ask recipient to register first, (3) Wait for propagation.'],
|
|
781
|
-
RECIPIENT_REVOKED: [XBindAgentError, 'Recipient agent has been revoked. Actions: (1) Inform recipient to contact admin, (2) Verify revocation reason, (3) Request re-registration.'],
|
|
782
|
-
KEY_AGREEMENT_FAILED: [XBindAgentError, 'ECDH key agreement with recipient failed. Actions: (1) Verify recipient key valid, (2) Check key format (X25519, 32B), (3) Request fresh key.'],
|
|
783
|
-
ENVELOPE_FAILED: [XBindAgentError, 'Envelope creation failed. Actions: (1) Check payload < 10MB, (2) Verify recipient DID valid, (3) Confirm sender identity set.'],
|
|
784
|
-
VERIFICATION_FAILED: [XBindAgentError, 'Incoming envelope verification failed. Actions: (1) Check sender in registry, (2) Verify signature valid, (3) Confirm sender not revoked.'],
|
|
785
|
-
REPLAY_DETECTED: [XBindAgentError, 'Duplicate nonce detected — possible replay attack. Actions: (1) DISCARD message, (2) Log nonce/sender, (3) Alert user to potential attack.'],
|
|
786
|
-
SCOPE_DENIED: [XBindAgentError, 'Sender does not have permission for the requested scope. Actions: (1) Check sender scope in registry, (2) Contact admin to grant, (3) Verify scope value.'],
|
|
787
|
-
RECEIVER_SCOPE_DENIED: [XBindAgentError, 'Recipient does not accept messages with this scope. Actions: (1) Check recipient receive scope settings, (2) Ask to enable scope, (3) Verify registry entry.'],
|
|
788
|
-
TIMESTAMP_EXPIRED: [XBindAgentError, 'Envelope timestamp is outside the allowed window. Actions: (1) Synchronize system clocks (NTP), (2) Check time difference, (3) Verify no time drift.'],
|
|
789
|
-
INCOMPATIBLE_VERSION: [XBindAgentError, 'Client version is incompatible with server. Actions: (1) Update xBind SDK to latest version, (2) Check minimum supported version, (3) Contact support if upgrade not possible.'],
|
|
790
|
-
FEATURE_NOT_SUPPORTED: [XBindAgentError, 'Requested feature is not supported. Actions: (1) Check feature availability in plan, (2) Verify SDK version, (3) Consider upgrading plan.'],
|
|
791
|
-
QUOTA_EXCEEDED: [XBindAgentError, 'Operation quota exceeded. Actions: (1) Check usage against plan limits, (2) Implement rate limiting, (3) Upgrade plan, (4) Wait for quota reset.'],
|
|
792
|
-
ACCOUNT_SUSPENDED: [XBindAgentError, 'Account has been suspended. Actions: (1) Contact support for suspension reason, (2) Review terms compliance, (3) Resolve payment/policy issues.'],
|
|
793
|
-
ACCOUNT_NOT_FOUND: [XBindAgentError, 'Account does not exist. Actions: (1) Verify account identifier, (2) Check if account was deleted, (3) Create new account if needed.'],
|
|
794
|
-
// Billing & Payment
|
|
795
|
-
BILLING_FAILURE: [XBindBillingError, 'Billing operation failed. Actions: (1) Verify payment method is valid and not expired, (2) Check Stripe account status, (3) Review billing logs, (4) Contact support if issue persists.'],
|
|
796
|
-
PAYMENT_REQUIRED: [XBindBillingError, 'Payment required to access this resource. Actions: (1) Add payment method in account settings, (2) Subscribe to appropriate tier, (3) Verify billing information is current.'],
|
|
797
|
-
SUBSCRIPTION_REQUIRED: [XBindBillingError, 'Valid subscription required. Actions: (1) Subscribe to a paid tier in account settings, (2) Verify subscription is active and not expired, (3) Check billing status.'],
|
|
798
|
-
TIER_LIMIT_EXCEEDED: [XBindBillingError, 'Current tier usage limit exceeded. Actions: (1) Upgrade to higher tier for increased limits, (2) Check current usage vs tier limits, (3) Wait for limit reset (typically monthly).'],
|
|
799
|
-
VERIFICATION_REQUIRED: [XBindBillingError, 'Account verification required. Actions: (1) Complete email verification, (2) Verify payment method, (3) Complete identity verification if required, (4) Check account verification status in settings.'],
|
|
800
|
-
};
|
|
801
|
-
/**
|
|
802
|
-
* Convert a string error code to a typed XBindError instance.
|
|
803
|
-
* Handles colon-separated sub-codes (e.g. 'DECRYPT_FAILED:KEY_AGREEMENT').
|
|
804
|
-
* Falls back to base XBindError for unknown codes.
|
|
805
|
-
*
|
|
806
|
-
* @param code - Error code string from Result<T,E> (e.g. 'REPLAY_DETECTED')
|
|
807
|
-
* @returns Typed XBindError subclass instance
|
|
808
|
-
*/
|
|
809
|
-
function toXBindError(code) {
|
|
810
|
-
const baseCode = code.split(':')[0] ?? code;
|
|
811
|
-
const entry = ERROR_MESSAGES[baseCode];
|
|
812
|
-
if (entry) {
|
|
813
|
-
const [ErrorClass, message] = entry;
|
|
814
|
-
return new ErrorClass(code, message);
|
|
815
|
-
}
|
|
816
|
-
return new XBindError(code, `XBind error: ${code}`);
|
|
817
|
-
}
|
|
818
|
-
/**
|
|
819
|
-
* Type guard for XBindError instances.
|
|
820
|
-
*
|
|
821
|
-
* @param err - Unknown value to check
|
|
822
|
-
* @returns True if err is a XBindError instance
|
|
823
|
-
*/
|
|
824
|
-
function isXBindError(err) {
|
|
825
|
-
return err instanceof XBindError;
|
|
826
|
-
}
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.QuotaExceededError=exports.VaultStoreError=exports.XBindBillingError=exports.XBindAgentError=exports.XBindSplitChannelError=exports.XBindKeyAgreementError=exports.XBindRegistryError=exports.XBindTransportError=exports.XBindEnvelopeError=exports.XBindIdentityError=exports.XBindError=void 0,exports.createXBindErrorDetail=createXBindErrorDetail,exports.toXBindError=toXBindError,exports.isXBindError=isXBindError;const ux_helpers_1=require("../_deps/ux-helpers/index.js"),DOC_BASE="https://private.me/docs/xbind";class XBindError extends Error{code;subCode;docUrl;constructor(e,t,i){super(t),this.name="XBindError";const r=e.split(":");this.code=r[0]??e,this.subCode=r.length>1?r.slice(1).join(":"):void 0,this.docUrl=i}}exports.XBindError=XBindError;class XBindIdentityError extends XBindError{constructor(e,t){super(e,t,`${DOC_BASE}#identity`),this.name="XBindIdentityError"}}exports.XBindIdentityError=XBindIdentityError;class XBindEnvelopeError extends XBindError{constructor(e,t){super(e,t,`${DOC_BASE}#envelope`),this.name="XBindEnvelopeError"}}exports.XBindEnvelopeError=XBindEnvelopeError;class XBindTransportError extends XBindError{constructor(e,t){super(e,t,`${DOC_BASE}#transport`),this.name="XBindTransportError"}}exports.XBindTransportError=XBindTransportError;class XBindRegistryError extends XBindError{constructor(e,t){super(e,t,`${DOC_BASE}#registry`),this.name="XBindRegistryError"}}exports.XBindRegistryError=XBindRegistryError;class XBindKeyAgreementError extends XBindError{constructor(e,t){super(e,t,`${DOC_BASE}#key-agreement`),this.name="XBindKeyAgreementError"}}exports.XBindKeyAgreementError=XBindKeyAgreementError;class XBindSplitChannelError extends XBindError{constructor(e,t){super(e,t,`${DOC_BASE}#split-channel`),this.name="XBindSplitChannelError"}}exports.XBindSplitChannelError=XBindSplitChannelError;class XBindAgentError extends XBindError{constructor(e,t){super(e,t,`${DOC_BASE}#agent`),this.name="XBindAgentError"}}exports.XBindAgentError=XBindAgentError;class XBindBillingError extends XBindError{constructor(e,t){super(e,t,`${DOC_BASE}#billing`),this.name="XBindBillingError"}}exports.XBindBillingError=XBindBillingError;class VaultStoreError extends XBindError{constructor(e,t){super(e,t,`${DOC_BASE}#vault-store`),this.name="VaultStoreError"}}exports.VaultStoreError=VaultStoreError;class QuotaExceededError extends XBindBillingError{upgradeUrl;constructor(e,t){super("QUOTA_EXCEEDED",e),this.name="QuotaExceededError",this.upgradeUrl=t||"https://private.me/subscribe?product=xbind&tier=pro"}}function createXBindErrorDetail(e,t){const i=e.split(":")[0]??e,r=ERROR_DETAILS[i];return r?(0,ux_helpers_1.createDetailedError)(e,r.message,{hint:t?.hint??r.hint,field:t?.field??r.field,docs:r.docs}):(0,ux_helpers_1.createDetailedError)(e,`XBind error: ${e}`,{docs:DOC_BASE})}exports.QuotaExceededError=QuotaExceededError;const ERROR_DETAILS={KEYGEN_FAILED:{message:"Key generation failed",hint:"Verify Web Crypto API available: Run in HTTPS/localhost (browser) or Node.js 15+ (server). Check browser console for WebCryptoAPI warnings.",suggested_action:"Verify runtime environment supports Web Crypto API and retry key generation",severity:"critical",docs:`${DOC_BASE}#identity`,aws:"InternalFailure",grpc:13,http:500},SIGN_FAILED:{message:"Signing failed",hint:"Verify private key format is PKCS8 and was imported with extractable:true flag. Check key is not corrupted.",suggested_action:"Verify private key is valid and properly imported with extractable flag",severity:"high",docs:`${DOC_BASE}#identity`,aws:"InternalFailure",grpc:13,http:500},VERIFY_FAILED:{message:"Signature verification failed",hint:"Confirm sender public key matches signer identity. Verify message and signature were not truncated or modified in transit.",suggested_action:"Verify sender public key and message integrity before retrying",severity:"critical",docs:`${DOC_BASE}#identity`,aws:"InvalidParameterValue",grpc:3,http:400},INVALID_DID:{message:"DID format is invalid",hint:'DID must start with "did:" followed by method name (e.g., did:key:z6Mk...). Use validateDID() helper to check format.',field:"did",suggested_action:"Use validateDID() helper to verify format before processing",severity:"high",docs:`${DOC_BASE}#identity`,aws:"InvalidParameterValue",grpc:3,http:400},INVALID_KEY_LENGTH:{message:"Key material has incorrect length",hint:"X25519 keys must be exactly 32 bytes. Log key.length to verify. Check base64 decoding is correct.",suggested_action:"Verify key is exactly 32 bytes and properly base64-decoded",severity:"high",docs:`${DOC_BASE}#key-agreement`,aws:"InvalidParameterValue",grpc:3,http:400},EXPORT_FAILED:{message:"PKCS8 export failed",hint:"Key must be created with extractable:true flag. See https://mdn.io/SubtleCrypto.exportKey for details.",suggested_action:"Create key with extractable:true flag and verify Web Crypto API support",severity:"medium",docs:`${DOC_BASE}#identity`,aws:"InternalFailure",grpc:13,http:500},IMPORT_FAILED:{message:"PKCS8 import failed",hint:"Verify PKCS8 format (PEM or raw bytes), algorithm matches (Ed25519/X25519), and key data is not corrupted.",suggested_action:"Validate PKCS8 format and verify key data is not corrupted",severity:"high",docs:`${DOC_BASE}#identity`,aws:"InvalidParameterValue",grpc:3,http:400},INVALID_VERSION:{message:"Unsupported envelope version",hint:"This SDK supports versions v1-v4. Check envelope.version field and update SDK or request sender upgrade.",field:"version",suggested_action:"Update SDK or request sender to use compatible version (v1-v4)",severity:"high",docs:`${DOC_BASE}#envelope`,aws:"ValidationException",grpc:3,http:400},INVALID_ALG:{message:"Unknown encryption algorithm",hint:"Only AES-256-GCM is supported. Verify envelope.alg value and check sender SDK version.",field:"alg",suggested_action:"Verify sender uses AES-256-GCM algorithm",severity:"high",docs:`${DOC_BASE}#envelope`,aws:"ValidationException",grpc:3,http:400},INVALID_NONCE:{message:"Nonce is missing or invalid",hint:"Nonce must be exactly 12 bytes and properly base64-encoded. Ensure nonce is unique per envelope.",field:"nonce",suggested_action:"Verify nonce is 12 bytes and properly base64-encoded",severity:"critical",docs:`${DOC_BASE}#envelope`,aws:"ValidationException",grpc:3,http:400},INVALID_FIELDS:{message:"Required envelope fields are missing",hint:"Envelope must have: version, alg, nonce, ciphertext, tag, sender, recipient. Check none are null/undefined.",suggested_action:"Validate all required envelope fields are present",severity:"high",docs:`${DOC_BASE}#envelope`,aws:"ValidationException",grpc:3,http:400},ENCRYPT_FAILED:{message:"AES-256-GCM encryption failed",hint:"Verify shared key is exactly 32 bytes, nonce is 12 bytes, and plaintext is valid UTF-8.",suggested_action:"Verify key is 32 bytes and nonce is 12 bytes before encryption",severity:"high",docs:`${DOC_BASE}#envelope`,aws:"InternalFailure",grpc:13,http:500},DECRYPT_FAILED:{message:"Decryption failed",hint:"Verify you are using the correct decryption key. Check ciphertext and authentication tag are not corrupted in transit.",suggested_action:"Verify correct key and check ciphertext integrity",severity:"critical",docs:`${DOC_BASE}#envelope`,aws:"InternalFailure",grpc:13,http:500},PARSE_FAILED:{message:"Envelope deserialization failed",hint:"Validate JSON structure for syntax errors. Check for truncation or corruption. Verify base64 fields are properly encoded.",suggested_action:"Validate JSON structure and check for data corruption",severity:"high",docs:`${DOC_BASE}#envelope`,aws:"ValidationException",grpc:3,http:400},SEND_FAILED:{message:"Message send failed",hint:"Check network connectivity and recipient registration. Use exponential backoff retry (2s, 4s, 8s).",suggested_action:"Check network connectivity and retry with exponential backoff",severity:"high",docs:`${DOC_BASE}#transport`,aws:"ServiceUnavailable",grpc:14,http:503},NETWORK_ERROR:{message:"Network request failed",hint:"Verify internet connection and DNS resolution. Ping registry endpoint to check availability.",suggested_action:"Verify internet connection and implement exponential backoff retry",severity:"high",docs:`${DOC_BASE}#transport`,aws:"ServiceUnavailable",grpc:14,http:503},RECIPIENT_UNREACHABLE:{message:"Recipient is unreachable",hint:"Verify recipient email address is correct and recipient is registered with xBind. Ask recipient to verify registration.",field:"to",suggested_action:"Verify recipient is registered with xBind and online",severity:"medium",docs:`${DOC_BASE}#transport`,aws:"ServiceUnavailable",grpc:14,http:503},TIMEOUT:{message:"Transport operation timed out",hint:"Check network latency and registry responsiveness. Increase timeout threshold if needed (default: 30s).",suggested_action:"Increase timeout threshold and check network latency",severity:"medium",docs:`${DOC_BASE}#transport`,aws:"RequestTimeout",grpc:4,http:408},NOT_FOUND:{message:"Agent not found in trust registry",hint:"Recipient may not be registered with xBind yet. Ask recipient to register or verify email address is correct.",field:"to",suggested_action:"Ask recipient to register with xBind",severity:"medium",docs:`${DOC_BASE}#registry`,aws:"ResourceNotFoundException",grpc:5,http:404},ALREADY_REGISTERED:{message:"Agent is already registered",hint:"Use updateAgent() instead of registerAgent() to update existing registration with new keys or metadata.",suggested_action:"Use updateAgent() instead of registerAgent()",severity:"low",docs:`${DOC_BASE}#registry`,aws:"ResourceAlreadyExists",grpc:6,http:409},REVOKED:{message:"Agent has been revoked from the registry",hint:"Contact registry administrator to determine revocation reason and request re-registration if accidental.",suggested_action:"Contact registry administrator to resolve revocation",severity:"high",docs:`${DOC_BASE}#registry`,aws:"AccessDenied",grpc:7,http:403},DERIVE_FAILED:{message:"ECDH key derivation failed",hint:"Verify peer public key is valid X25519 (32 bytes) and not corrupted. Check algorithm is X25519 ECDH.",suggested_action:"Verify peer public key is valid X25519 and not corrupted",severity:"high",docs:`${DOC_BASE}#key-agreement`,aws:"InternalFailure",grpc:13,http:500},KEM_ENCAPSULATE_FAILED:{message:"ML-KEM-768 encapsulation failed",hint:"Verify recipient ML-KEM-768 public key is valid and properly formatted. Confirm post-quantum support is enabled.",suggested_action:"Verify recipient ML-KEM-768 public key and post-quantum support",severity:"high",docs:`${DOC_BASE}#key-agreement`,aws:"InternalFailure",grpc:13,http:500},KEM_DECAPSULATE_FAILED:{message:"ML-KEM-768 decapsulation failed",hint:"Verify ciphertext is not truncated and matches this secret key. Confirm ML-KEM library is initialized.",suggested_action:"Verify ciphertext integrity and ML-KEM secret key",severity:"high",docs:`${DOC_BASE}#key-agreement`,aws:"InternalFailure",grpc:13,http:500},HKDF_FAILED:{message:"HKDF key derivation failed",hint:"Verify ECDH and KEM shared secrets are valid. Ensure SHA-256 is available and HKDF input size is correct.",suggested_action:"Verify shared secrets are valid and SHA-256 is available",severity:"high",docs:`${DOC_BASE}#key-agreement`,aws:"InternalFailure",grpc:13,http:500},MLKEM_NOT_AVAILABLE:{message:"ML-KEM-768 key not available",hint:"Enable post-quantum support: Agent.create({postQuantum: true}). Regenerate identity with PQ keys enabled.",suggested_action:"Create agent with postQuantum: true",severity:"medium",docs:`${DOC_BASE}#key-agreement`},PQ_SIGN_FAILED:{message:"ML-DSA-65 signing failed",hint:"Actions: (1) Verify ML-DSA-65 secret key is valid and not corrupted, (2) Check post-quantum support is enabled, (3) Ensure message to sign is not empty, (4) Review ML-DSA library logs",suggested_action:"Verify ML-DSA-65 secret key and post-quantum support",severity:"high",docs:`${DOC_BASE}#identity`,aws:"InternalFailure",grpc:13,http:500},PQ_VERIFY_FAILED:{message:"ML-DSA-65 verification failed",hint:"Actions: (1) Verify public key matches signer, (2) Check signature format and encoding, (3) Confirm message matches what was signed, (4) Ensure post-quantum keys are synchronized",suggested_action:"Verify signer public key and signature format",severity:"high",docs:`${DOC_BASE}#identity`,aws:"InvalidParameterValue",grpc:3,http:400},SPLIT_FAILED:{message:"XorIDA split failed",hint:"Verify threshold >= 2 and <= shareCount. Ensure payload < 1MB. Check system has sufficient memory.",suggested_action:"Verify threshold parameters and payload size",severity:"high",docs:`${DOC_BASE}#split-channel`,aws:"InternalFailure",grpc:13,http:500},INSUFFICIENT_SHARES:{message:"Not enough shares to reconstruct",hint:"Log current share count and compare to threshold requirement. Collect more shares from recipients matching the split group ID.",suggested_action:"Collect more shares to meet threshold requirement",severity:"high",docs:`${DOC_BASE}#split-channel`,aws:"ValidationException",grpc:3,http:400},INCONSISTENT_SHARES:{message:"Shares have mismatched group IDs or lengths",hint:"Verify all shares have matching group IDs and identical lengths. Discard mismatched shares and request correct ones.",suggested_action:"Verify all shares are from the same split operation",severity:"high",docs:`${DOC_BASE}#split-channel`,aws:"ValidationException",grpc:3,http:400},HMAC_VERIFICATION_FAILED:{message:"Share HMAC check failed",hint:"Share may be corrupted in transit or tampered with. Request fresh share from sender using same HMAC key.",suggested_action:"Request fresh share from sender",severity:"critical",docs:`${DOC_BASE}#split-channel`,aws:"UnauthorizedOperation",grpc:16,http:401},UNPAD_FAILED:{message:"Padding removal failed after reconstruction",hint:"Verify reconstruction succeeded and data is valid UTF-8. Check padding algorithm is PKCS7.",suggested_action:"Verify reconstruction succeeded and data is valid UTF-8",severity:"high",docs:`${DOC_BASE}#split-channel`,aws:"InternalFailure",grpc:13,http:500},INVALID_SHARE_DATA:{message:"Share data is malformed",hint:"Verify share is valid base64 and has correct structure. Log raw bytes to inspect. Request correctly-formatted share.",suggested_action:"Verify share is valid base64 and request correctly-formatted share",severity:"high",docs:`${DOC_BASE}#split-channel`,aws:"ValidationException",grpc:3,http:400},XCHANGE_KEYGEN_FAILED:{message:"Xchange key generation failed",hint:"Verify Web Crypto API available (HTTPS/localhost). Check runtime supports key generation with sufficient entropy.",suggested_action:"Verify Web Crypto API available and retry",severity:"high",docs:`${DOC_BASE}#xchange`,aws:"InternalFailure",grpc:13,http:500},XCHANGE_ENCRYPT_FAILED:{message:"Xchange bundle encryption failed",hint:"Verify payload < 64KB, encryption key is 32 bytes, and bundle structure is valid.",suggested_action:"Verify payload size and encryption key length",severity:"high",docs:`${DOC_BASE}#xchange`,aws:"InternalFailure",grpc:13,http:500},XCHANGE_DECRYPT_FAILED:{message:"Xchange bundle decryption failed",hint:"Verify decryption key matches encryption key and bundle integrity is valid (auth tag correct).",suggested_action:"Verify reconstruction completed and decryption key is correct",severity:"high",docs:`${DOC_BASE}#xchange`,aws:"InternalFailure",grpc:13,http:500},INVALID_BUNDLE:{message:"Xchange bundle is malformed",hint:"Verify bundle size >= 60 bytes (32B key + 12B IV + 16B tag). Check structure and request correctly-formed bundle.",suggested_action:"Verify bundle size and request correctly-formed bundle",severity:"high",docs:`${DOC_BASE}#xchange`,aws:"ValidationException",grpc:3,http:400},IDENTITY_FAILED:{message:"Agent identity creation failed",hint:"Verify Web Crypto API is available (HTTPS/localhost context, Node.js 15+, or modern browser).",suggested_action:"Verify Web Crypto API available and retry agent initialization",severity:"critical",docs:`${DOC_BASE}#agent`,aws:"InternalFailure",grpc:13,http:500},REGISTRATION_FAILED:{message:"Agent registration with trust registry failed",hint:"Verify registry URL is reachable and auth token is valid and not expired. Check registry status page.",suggested_action:"Verify registry URL and auth token, then retry with exponential backoff",severity:"high",docs:`${DOC_BASE}#agent`,aws:"ServiceUnavailable",grpc:14,http:503},RECIPIENT_NOT_FOUND:{message:"Recipient agent not found in registry",hint:"Verify recipient email/DID is correct. Ask recipient to register with xBind first. Allow time for registration to propagate.",field:"to",suggested_action:"Ask recipient to register with xBind",severity:"medium",docs:`${DOC_BASE}#agent`,aws:"ResourceNotFoundException",grpc:5,http:404},RECIPIENT_REVOKED:{message:"Recipient agent has been revoked",hint:"Inform recipient to contact registry administrator to determine revocation reason and request re-registration if accidental.",field:"to",suggested_action:"Inform recipient to contact registry administrator",severity:"high",docs:`${DOC_BASE}#agent`,aws:"AccessDenied",grpc:7,http:403},KEY_AGREEMENT_FAILED:{message:"ECDH key agreement with recipient failed",hint:"Verify recipient public key is valid X25519 (32 bytes). Request fresh key from recipient.",suggested_action:"Request fresh key from recipient",severity:"high",docs:`${DOC_BASE}#agent`,aws:"InternalFailure",grpc:13,http:500},ENVELOPE_FAILED:{message:"Envelope creation failed",hint:"Verify payload < 10MB, recipient DID is valid, sender identity is set, and all required fields present.",suggested_action:"Verify payload size and recipient DID",severity:"high",docs:`${DOC_BASE}#agent`,aws:"InternalFailure",grpc:13,http:500},VERIFICATION_FAILED:{message:"Incoming envelope verification failed",hint:"Verify sender DID is in trust registry, sender signature is valid, and sender is not revoked. Review trust policy settings.",suggested_action:"Verify sender is in trust registry and not revoked",severity:"critical",docs:`${DOC_BASE}#agent`,aws:"UnauthorizedOperation",grpc:16,http:401},REPLAY_DETECTED:{message:"Duplicate nonce detected — possible replay attack",hint:"DISCARD MESSAGE immediately for security. Log nonce and sender DID. Alert user to potential attack.",suggested_action:"DISCARD MESSAGE and alert user to potential replay attack",severity:"critical",docs:`${DOC_BASE}#agent`,aws:"AccessDenied",grpc:7,http:403},SCOPE_DENIED:{message:"Sender does not have permission for the requested scope",hint:"Verify scope value is correct. Contact registry admin to grant sender permission for requested scope.",field:"scope",suggested_action:"Contact registry admin to grant permission",severity:"medium",docs:`${DOC_BASE}#agent`,aws:"AccessDenied",grpc:7,http:403},RECEIVER_SCOPE_DENIED:{message:"Recipient does not accept messages with this scope",hint:"Ask recipient to enable this scope in their settings. Verify scope matches recipient policy.",field:"scope",suggested_action:"Ask recipient to enable scope in settings",severity:"medium",docs:`${DOC_BASE}#agent`,aws:"AccessDenied",grpc:7,http:403},TIMESTAMP_EXPIRED:{message:"Envelope timestamp is outside the allowed window",hint:"Synchronize system clocks using NTP. Check time difference between sender and receiver.",suggested_action:"Synchronize system clocks using NTP",severity:"medium",docs:`${DOC_BASE}#agent`,aws:"RequestExpired",grpc:9,http:412},INCOMPATIBLE_VERSION:{message:"Client version is incompatible with server",hint:"Update xBind SDK to latest version. Check minimum supported version in documentation.",suggested_action:"Update xBind SDK to latest version",severity:"high",docs:`${DOC_BASE}#agent`,aws:"ValidationException",grpc:3,http:400},FEATURE_NOT_SUPPORTED:{message:"Requested feature is not supported",hint:"Verify SDK version supports this feature and it is available in current plan. Consider upgrading.",suggested_action:"Check feature availability in current plan or SDK version",severity:"medium",docs:`${DOC_BASE}#agent`,aws:"ValidationException",grpc:12,http:501},QUOTA_EXCEEDED:{message:"Operation quota exceeded",hint:"Check usage against plan limits. Implement rate limiting or upgrade to higher tier plan.",suggested_action:"Implement rate limiting or upgrade plan",severity:"medium",docs:`${DOC_BASE}#agent`,aws:"ThrottlingException",grpc:8,http:429},ACCOUNT_SUSPENDED:{message:"Account has been suspended",hint:"Contact support to determine suspension reason. Review terms of service and resolve any payment or policy issues.",suggested_action:"Contact support to resolve suspension",severity:"critical",docs:`${DOC_BASE}#agent`,aws:"AccessDeniedException",grpc:7,http:403},ACCOUNT_NOT_FOUND:{message:"Account does not exist",hint:"Verify account identifier is correct. Check if account was deleted. Create new account if needed.",suggested_action:"Verify account identifier or create new account",severity:"high",docs:`${DOC_BASE}#agent`,aws:"ResourceNotFoundException",grpc:5,http:404},BILLING_FAILURE:{message:"Billing operation failed",hint:"Verify payment method is valid and not expired. Check Stripe account status. Review billing logs.",suggested_action:"Verify payment method and check billing logs",severity:"high",docs:`${DOC_BASE}#billing`,aws:"RequestLimitExceeded",grpc:8,http:402},PAYMENT_REQUIRED:{message:"Payment required to access this resource",hint:"Add payment method in account settings and subscribe to appropriate tier.",suggested_action:"Add payment method and subscribe to access this resource",severity:"medium",docs:`${DOC_BASE}#billing`,aws:"AccessDenied",grpc:7,http:402},SUBSCRIPTION_REQUIRED:{message:"Valid subscription required",hint:"Subscribe to a paid tier in account settings. Verify subscription is active and not expired.",suggested_action:"Subscribe to a paid tier to access this feature",severity:"medium",docs:`${DOC_BASE}#billing`,aws:"AccessDenied",grpc:7,http:403},TIER_LIMIT_EXCEEDED:{message:"Current tier usage limit exceeded",hint:"Check current usage vs tier limits. Upgrade to higher tier for increased limits or wait for monthly reset.",suggested_action:"Upgrade to higher tier or wait for limit reset",severity:"medium",docs:`${DOC_BASE}#billing`,aws:"RequestLimitExceeded",grpc:8,http:403},VERIFICATION_REQUIRED:{message:"Account verification required",hint:"Complete email and payment method verification. Check account verification status in settings.",suggested_action:"Complete account verification steps in settings",severity:"high",docs:`${DOC_BASE}#billing`,aws:"AccessDenied",grpc:7,http:403},VAULT_FETCH_FAILED:{message:"Failed to fetch crypto package from Vault Store",hint:"Check network connectivity to private.me. Verify Vault Store endpoint is reachable. Try again in a few moments.",suggested_action:"Verify network connectivity and retry with exponential backoff",severity:"high",docs:`${DOC_BASE}#vault-store`,aws:"ServiceUnavailable",grpc:14,http:503},VAULT_AUTH_FAILED:{message:"Vault Store authentication failed",hint:"DID signature verification failed. Verify agent identity is valid and properly initialized. Check system clock is synchronized.",suggested_action:"Verify agent identity and synchronize system clock (NTP)",severity:"critical",docs:`${DOC_BASE}#vault-store`,aws:"UnauthorizedOperation",grpc:16,http:401},VAULT_QUOTA_EXCEEDED:{message:"Monthly usage quota exceeded",hint:"Free tier allows 100,000 operations per month (120,000 with grace buffer). Upgrade to Pro tier for unlimited access at $5 per 100K operations.",suggested_action:"Upgrade to Pro tier: https://private.me/subscribe?product=xbind&tier=pro",severity:"medium",docs:`${DOC_BASE}#vault-store`,aws:"RequestLimitExceeded",grpc:8,http:402},VAULT_PAYMENT_REQUIRED:{message:"Payment required to access Vault Store",hint:"Subscription expired or payment method failed. Update payment method and verify subscription is active.",suggested_action:"Update payment method and verify subscription status",severity:"high",docs:`${DOC_BASE}#vault-store`,aws:"AccessDenied",grpc:7,http:451},VAULT_LOAD_FAILED:{message:"Failed to load crypto package",hint:"Crypto bundle evaluation failed. This may indicate corrupted bundle or incompatible version. Contact support if issue persists.",suggested_action:"Clear cache and retry. Contact support if issue persists.",severity:"high",docs:`${DOC_BASE}#vault-store`,aws:"InternalFailure",grpc:13,http:500},VAULT_INVALID_RESPONSE:{message:"Invalid response from Vault Store",hint:"Server returned malformed data. This may indicate version mismatch or server issue. Try updating SDK or contact support.",suggested_action:"Update xBind SDK to latest version or contact support",severity:"high",docs:`${DOC_BASE}#vault-store`,aws:"InternalFailure",grpc:13,http:500}},ERROR_MESSAGES={KEYGEN_FAILED:[XBindIdentityError,"Key generation failed. Actions: (1) Verify Web Crypto API is available in HTTPS or localhost, (2) Check runtime is Node.js 15+ or modern browser, (3) Retry initialization."],SIGN_FAILED:[XBindIdentityError,"Signing failed. Actions: (1) Verify private key is valid and not corrupted, (2) Check key was properly imported, (3) Ensure key is extractable."],VERIFY_FAILED:[XBindIdentityError,"Signature verification failed. Actions: (1) Confirm public key matches signer, (2) Check message integrity, (3) Verify signature format is valid base64."],INVALID_DID:[XBindIdentityError,"The DID string is malformed. Actions: (1) Verify format: did:key:z6Mk..., (2) Check no extra whitespace, (3) Use validateDID() helper."],INVALID_KEY_LENGTH:[XBindKeyAgreementError,"Key material is the wrong length. Actions: (1) Verify X25519 key is exactly 32 bytes, (2) Check base64 decoding, (3) Log key.length to confirm."],EXPORT_FAILED:[XBindIdentityError,"PKCS8 export failed. Actions: (1) Create key with extractable:true, (2) Check Web Crypto support, (3) See: https://mdn.io/SubtleCrypto.exportKey."],IMPORT_FAILED:[XBindIdentityError,"PKCS8 import failed. Actions: (1) Validate PKCS8 format (PEM or bytes), (2) Decode base64 if needed, (3) Check algorithm (Ed25519/X25519)."],INVALID_VERSION:[XBindEnvelopeError,"Unsupported envelope version. Actions: (1) Check envelope.version field, (2) Verify sender uses v1-v4, (3) Request sender SDK update."],INVALID_ALG:[XBindEnvelopeError,'Unknown encryption algorithm. Actions: (1) Verify envelope.alg === "AES-256-GCM", (2) Log alg value to debug, (3) Check sender SDK version.'],INVALID_NONCE:[XBindEnvelopeError,"Nonce is missing or invalid. Actions: (1) Verify nonce exists and is 12 bytes, (2) Check base64 decoding, (3) Inspect replay buffer."],INVALID_FIELDS:[XBindEnvelopeError,"Required envelope fields are missing. Actions: (1) Verify sender/recipient DIDs, (2) Check payload exists, (3) Validate: version, alg, nonce, ciphertext, tag."],ENCRYPT_FAILED:[XBindEnvelopeError,"AES-256-GCM encryption failed. Actions: (1) Verify key is exactly 32 bytes, (2) Check plaintext is valid, (3) Ensure nonce is 12 bytes."],DECRYPT_FAILED:[XBindEnvelopeError,"Decryption failed. Actions: (1) Verify correct key is being used, (2) Check ciphertext integrity, (3) Confirm auth tag is valid."],PARSE_FAILED:[XBindEnvelopeError,"Envelope deserialization failed. Actions: (1) Validate JSON structure, (2) Check for truncation, (3) Verify base64 encoding of fields."],SEND_FAILED:[XBindTransportError,"Message send failed. Actions: (1) Check network connectivity (ping registry), (2) Verify recipient address, (3) Confirm recipient registered, (4) Retry with backoff."],NETWORK_ERROR:[XBindTransportError,"Network request failed. Actions: (1) Verify internet connection, (2) Check DNS resolution, (3) Ping registry endpoint, (4) Implement exponential backoff (2s, 4s, 8s)."],RECIPIENT_UNREACHABLE:[XBindTransportError,"Recipient is unreachable. Actions: (1) Verify recipient email is correct, (2) Check if recipient is registered, (3) Confirm recipient is online, (4) Provide human follow-up."],TIMEOUT:[XBindTransportError,"Transport operation timed out. Actions: (1) Increase timeout threshold, (2) Check network latency, (3) Verify registry responsiveness, (4) Retry operation."],NOT_FOUND:[XBindRegistryError,"Agent not found in trust registry. Actions: (1) Ask recipient to register with xBind, (2) Verify recipient email/DID, (3) Check registration status, (4) Retry after propagation."],ALREADY_REGISTERED:[XBindRegistryError,"Agent is already registered. Actions: (1) Use updateAgent() instead, (2) Provide new keys or metadata, (3) Verify DID matches existing entry."],REVOKED:[XBindRegistryError,"Agent has been revoked from the registry. Actions: (1) Contact registry admin, (2) Check revocation reason, (3) Request re-registration if accidental."],DERIVE_FAILED:[XBindKeyAgreementError,"ECDH key derivation failed. Actions: (1) Verify peer public key is valid X25519 (32 bytes), (2) Check key is not corrupted, (3) Confirm X25519 ECDH support."],KEM_ENCAPSULATE_FAILED:[XBindKeyAgreementError,"ML-KEM-768 encapsulation failed. Actions: (1) Verify recipient key is valid ML-KEM-768, (2) Check key format, (3) Confirm post-quantum support enabled."],KEM_DECAPSULATE_FAILED:[XBindKeyAgreementError,"ML-KEM-768 decapsulation failed. Actions: (1) Verify ciphertext integrity, (2) Check secret key is valid, (3) Confirm ciphertext matches key."],HKDF_FAILED:[XBindKeyAgreementError,"HKDF key derivation failed. Actions: (1) Verify both shared secrets are valid, (2) Check HKDF input size, (3) Ensure SHA-256 support."],MLKEM_NOT_AVAILABLE:[XBindKeyAgreementError,"ML-KEM-768 key not available. Actions: (1) Create agent with postQuantum: true, (2) Check runtime supports ML-KEM-768, (3) Regenerate identity with PQ enabled."],PQ_SIGN_FAILED:[XBindIdentityError,"ML-DSA-65 signing failed. Actions: (1) Verify secret key is valid, (2) Check post-quantum support enabled, (3) Ensure message is not empty."],PQ_VERIFY_FAILED:[XBindIdentityError,"ML-DSA-65 verification failed. Actions: (1) Verify public key matches signer, (2) Check signature format, (3) Confirm message integrity."],SPLIT_FAILED:[XBindSplitChannelError,"XorIDA split failed. Actions: (1) Verify threshold <= shareCount, (2) Check threshold >= 2, (3) Validate payload < 1MB."],INSUFFICIENT_SHARES:[XBindSplitChannelError,"Not enough shares to reconstruct. Actions: (1) Log number of shares collected, (2) Check threshold requirement, (3) Collect more shares."],INCONSISTENT_SHARES:[XBindSplitChannelError,"Shares have mismatched group IDs or lengths. Actions: (1) Verify all from same split, (2) Check group IDs match, (3) Discard mismatched shares."],HMAC_VERIFICATION_FAILED:[XBindSplitChannelError,"Share HMAC check failed. Actions: (1) Check share integrity in transit, (2) Verify not tampered with, (3) Request fresh share."],UNPAD_FAILED:[XBindSplitChannelError,"Padding removal failed after reconstruction. Actions: (1) Verify reconstruction succeeded, (2) Check data is valid UTF-8, (3) Inspect raw bytes."],INVALID_SHARE_DATA:[XBindSplitChannelError,"Share data is malformed. Actions: (1) Verify share is valid base64, (2) Check TLV structure, (3) Log raw bytes to inspect."],XCHANGE_KEYGEN_FAILED:[XBindKeyAgreementError,"Xchange key generation failed. Actions: (1) Verify Web Crypto available (HTTPS/localhost), (2) Check runtime support, (3) Ensure entropy."],XCHANGE_ENCRYPT_FAILED:[XBindEnvelopeError,"Xchange bundle encryption failed. Actions: (1) Check payload < 64KB, (2) Verify key is 32 bytes, (3) Validate bundle structure."],XCHANGE_DECRYPT_FAILED:[XBindEnvelopeError,"Xchange bundle decryption failed. Actions: (1) Verify reconstruction succeeded, (2) Check key matches encryption key, (3) Confirm bundle integrity."],INVALID_BUNDLE:[XBindSplitChannelError,"Xchange bundle is malformed. Actions: (1) Verify size >= 60 bytes (32B + 12B + 16B), (2) Check structure, (3) Decode to inspect."],IDENTITY_FAILED:[XBindAgentError,"Agent identity creation failed. Actions: (1) Verify Web Crypto available, (2) Check HTTPS/localhost, (3) Ensure Node.js 15+ or modern browser."],REGISTRATION_FAILED:[XBindAgentError,"Agent registration with trust registry failed. Actions: (1) Verify registry URL is correct, (2) Check auth token valid/not expired, (3) Confirm registry online."],RECIPIENT_NOT_FOUND:[XBindAgentError,"Recipient agent not found in registry. Actions: (1) Verify recipient email/DID, (2) Ask recipient to register first, (3) Wait for propagation."],RECIPIENT_REVOKED:[XBindAgentError,"Recipient agent has been revoked. Actions: (1) Inform recipient to contact admin, (2) Verify revocation reason, (3) Request re-registration."],KEY_AGREEMENT_FAILED:[XBindAgentError,"ECDH key agreement with recipient failed. Actions: (1) Verify recipient key valid, (2) Check key format (X25519, 32B), (3) Request fresh key."],ENVELOPE_FAILED:[XBindAgentError,"Envelope creation failed. Actions: (1) Check payload < 10MB, (2) Verify recipient DID valid, (3) Confirm sender identity set."],VERIFICATION_FAILED:[XBindAgentError,"Incoming envelope verification failed. Actions: (1) Check sender in registry, (2) Verify signature valid, (3) Confirm sender not revoked."],REPLAY_DETECTED:[XBindAgentError,"Duplicate nonce detected — possible replay attack. Actions: (1) DISCARD message, (2) Log nonce/sender, (3) Alert user to potential attack."],SCOPE_DENIED:[XBindAgentError,"Sender does not have permission for the requested scope. Actions: (1) Check sender scope in registry, (2) Contact admin to grant, (3) Verify scope value."],RECEIVER_SCOPE_DENIED:[XBindAgentError,"Recipient does not accept messages with this scope. Actions: (1) Check recipient receive scope settings, (2) Ask to enable scope, (3) Verify registry entry."],TIMESTAMP_EXPIRED:[XBindAgentError,"Envelope timestamp is outside the allowed window. Actions: (1) Synchronize system clocks (NTP), (2) Check time difference, (3) Verify no time drift."],INCOMPATIBLE_VERSION:[XBindAgentError,"Client version is incompatible with server. Actions: (1) Update xBind SDK to latest version, (2) Check minimum supported version, (3) Contact support if upgrade not possible."],FEATURE_NOT_SUPPORTED:[XBindAgentError,"Requested feature is not supported. Actions: (1) Check feature availability in plan, (2) Verify SDK version, (3) Consider upgrading plan."],QUOTA_EXCEEDED:[XBindAgentError,"Operation quota exceeded. Actions: (1) Check usage against plan limits, (2) Implement rate limiting, (3) Upgrade plan, (4) Wait for quota reset."],ACCOUNT_SUSPENDED:[XBindAgentError,"Account has been suspended. Actions: (1) Contact support for suspension reason, (2) Review terms compliance, (3) Resolve payment/policy issues."],ACCOUNT_NOT_FOUND:[XBindAgentError,"Account does not exist. Actions: (1) Verify account identifier, (2) Check if account was deleted, (3) Create new account if needed."],BILLING_FAILURE:[XBindBillingError,"Billing operation failed. Actions: (1) Verify payment method is valid and not expired, (2) Check Stripe account status, (3) Review billing logs, (4) Contact support if issue persists."],PAYMENT_REQUIRED:[XBindBillingError,"Payment required to access this resource. Actions: (1) Add payment method in account settings, (2) Subscribe to appropriate tier, (3) Verify billing information is current."],SUBSCRIPTION_REQUIRED:[XBindBillingError,"Valid subscription required. Actions: (1) Subscribe to a paid tier in account settings, (2) Verify subscription is active and not expired, (3) Check billing status."],TIER_LIMIT_EXCEEDED:[XBindBillingError,"Current tier usage limit exceeded. Actions: (1) Upgrade to higher tier for increased limits, (2) Check current usage vs tier limits, (3) Wait for limit reset (typically monthly)."],VERIFICATION_REQUIRED:[XBindBillingError,"Account verification required. Actions: (1) Complete email verification, (2) Verify payment method, (3) Complete identity verification if required, (4) Check account verification status in settings."],VAULT_FETCH_FAILED:[VaultStoreError,"Failed to fetch crypto package from Vault Store. Actions: (1) Check network connectivity to private.me, (2) Verify Vault Store endpoint is reachable, (3) Retry with exponential backoff, (4) Check server status page."],VAULT_AUTH_FAILED:[VaultStoreError,"Vault Store authentication failed. Actions: (1) Verify agent identity is valid, (2) Check DID signature is correct, (3) Synchronize system clock (NTP), (4) Regenerate identity if corrupted."],VAULT_QUOTA_EXCEEDED:[QuotaExceededError,"Monthly usage quota exceeded. Free tier: 100K operations/month (120K with grace). Actions: (1) Upgrade to Pro tier for unlimited access ($5/100K ops), (2) Visit https://private.me/subscribe?product=xbind&tier=pro, (3) Wait for monthly reset (1st of month, 00:00 UTC)."],VAULT_PAYMENT_REQUIRED:[VaultStoreError,"Payment required to access Vault Store. Actions: (1) Update payment method in account settings, (2) Verify subscription is active, (3) Check billing status, (4) Contact support if payment issue persists."],VAULT_LOAD_FAILED:[VaultStoreError,"Failed to load crypto package. Actions: (1) Clear crypto cache and retry, (2) Verify SDK version is compatible, (3) Check bundle integrity, (4) Contact support if issue persists."],VAULT_INVALID_RESPONSE:[VaultStoreError,"Invalid response from Vault Store. Actions: (1) Update xBind SDK to latest version, (2) Check API compatibility, (3) Retry request, (4) Contact support if issue persists."]};function toXBindError(e){const t=e.split(":")[0]??e,i=ERROR_MESSAGES[t];if(i){const[t,r]=i;return new t(e,r)}return new XBindError(e,`XBind error: ${e}`)}function isXBindError(e){return e instanceof XBindError}
|