@private.me/xbind 1.2.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/AGENTS.md +778 -0
- package/LICENSE.md +27 -0
- package/README.md +400 -0
- package/dist-standalone/_deps/crypto/base64.d.ts +29 -0
- package/dist-standalone/_deps/crypto/base64.js +97 -0
- package/dist-standalone/_deps/crypto/cjs/base64.js +103 -0
- package/dist-standalone/_deps/crypto/cjs/errors.js +119 -0
- package/dist-standalone/_deps/crypto/cjs/hmac.js +71 -0
- package/dist-standalone/_deps/crypto/cjs/index.js +86 -0
- package/dist-standalone/_deps/crypto/cjs/padding.js +57 -0
- package/dist-standalone/_deps/crypto/cjs/share-header.js +68 -0
- package/dist-standalone/_deps/crypto/cjs/shares.js +152 -0
- package/dist-standalone/_deps/crypto/cjs/tlv.js +199 -0
- package/dist-standalone/_deps/crypto/cjs/uuid.js +61 -0
- package/dist-standalone/_deps/crypto/cjs/verify.js +24 -0
- package/dist-standalone/_deps/crypto/cjs/xorida.js +221 -0
- package/dist-standalone/_deps/crypto/errors.d.ts +51 -0
- package/dist-standalone/_deps/crypto/errors.js +109 -0
- package/dist-standalone/_deps/crypto/hmac.d.ts +39 -0
- package/dist-standalone/_deps/crypto/hmac.js +66 -0
- package/dist-standalone/_deps/crypto/index.d.ts +20 -0
- package/dist-standalone/_deps/crypto/index.js +45 -0
- package/dist-standalone/_deps/crypto/padding.d.ts +19 -0
- package/dist-standalone/_deps/crypto/padding.js +53 -0
- package/dist-standalone/_deps/crypto/share-header.d.ts +44 -0
- package/dist-standalone/_deps/crypto/share-header.js +63 -0
- package/dist-standalone/_deps/crypto/shares.d.ts +27 -0
- package/dist-standalone/_deps/crypto/shares.js +148 -0
- package/dist-standalone/_deps/crypto/tlv.d.ts +26 -0
- package/dist-standalone/_deps/crypto/tlv.js +195 -0
- package/dist-standalone/_deps/crypto/uuid.d.ts +22 -0
- package/dist-standalone/_deps/crypto/uuid.js +56 -0
- package/dist-standalone/_deps/crypto/verify.d.ts +15 -0
- package/dist-standalone/_deps/crypto/verify.js +15 -0
- package/dist-standalone/_deps/crypto/xorida.d.ts +44 -0
- package/dist-standalone/_deps/crypto/xorida.js +215 -0
- package/dist-standalone/_deps/mldsa-wasm/LICENSE +24 -0
- package/dist-standalone/_deps/mldsa-wasm/dist/mldsa.js +1920 -0
- package/dist-standalone/_deps/mldsa-wasm/package.json +46 -0
- package/dist-standalone/_deps/mldsa-wasm/types/mldsa.d.ts +30 -0
- package/dist-standalone/_deps/shared/cjs/errors.js +582 -0
- package/dist-standalone/_deps/shared/cjs/index.js +492 -0
- package/dist-standalone/_deps/shared/cjs/package.json +1 -0
- package/dist-standalone/_deps/shared/cjs/types.js +403 -0
- package/dist-standalone/_deps/shared/errors.d.ts +48 -0
- package/dist-standalone/_deps/shared/errors.d.ts.map +1 -0
- package/dist-standalone/_deps/shared/errors.js +192 -0
- package/dist-standalone/_deps/shared/errors.js.map +1 -0
- package/dist-standalone/_deps/shared/index.d.ts +4 -0
- package/dist-standalone/_deps/shared/index.d.ts.map +1 -0
- package/dist-standalone/_deps/shared/index.js +78 -0
- package/dist-standalone/_deps/shared/index.js.map +1 -0
- package/dist-standalone/_deps/shared/types.d.ts +1097 -0
- package/dist-standalone/_deps/shared/types.d.ts.map +1 -0
- package/dist-standalone/_deps/shared/types.js +89 -0
- package/dist-standalone/_deps/shared/types.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/errors.d.ts +115 -0
- package/dist-standalone/_deps/ux-helpers/cjs/errors.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/errors.js +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/errors.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/index.d.ts +13 -0
- package/dist-standalone/_deps/ux-helpers/cjs/index.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/index.js +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/index.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/package.json +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/pagination.d.ts +39 -0
- package/dist-standalone/_deps/ux-helpers/cjs/pagination.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/pagination.js +83 -0
- package/dist-standalone/_deps/ux-helpers/cjs/pagination.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/progress.d.ts +99 -0
- package/dist-standalone/_deps/ux-helpers/cjs/progress.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/progress.js +143 -0
- package/dist-standalone/_deps/ux-helpers/cjs/progress.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/search.d.ts +32 -0
- package/dist-standalone/_deps/ux-helpers/cjs/search.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/search.js +119 -0
- package/dist-standalone/_deps/ux-helpers/cjs/search.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/types.d.ts +109 -0
- package/dist-standalone/_deps/ux-helpers/cjs/types.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/cjs/types.js +8 -0
- package/dist-standalone/_deps/ux-helpers/cjs/types.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/errors.d.ts +115 -0
- package/dist-standalone/_deps/ux-helpers/errors.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/errors.js +253 -0
- package/dist-standalone/_deps/ux-helpers/errors.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/index.d.ts +13 -0
- package/dist-standalone/_deps/ux-helpers/index.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/index.js +16 -0
- package/dist-standalone/_deps/ux-helpers/index.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/pagination.d.ts +39 -0
- package/dist-standalone/_deps/ux-helpers/pagination.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/pagination.js +79 -0
- package/dist-standalone/_deps/ux-helpers/pagination.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/progress.d.ts +99 -0
- package/dist-standalone/_deps/ux-helpers/progress.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/progress.js +138 -0
- package/dist-standalone/_deps/ux-helpers/progress.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/search.d.ts +32 -0
- package/dist-standalone/_deps/ux-helpers/search.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/search.js +116 -0
- package/dist-standalone/_deps/ux-helpers/search.js.map +1 -0
- package/dist-standalone/_deps/ux-helpers/types.d.ts +109 -0
- package/dist-standalone/_deps/ux-helpers/types.d.ts.map +1 -0
- package/dist-standalone/_deps/ux-helpers/types.js +7 -0
- package/dist-standalone/_deps/ux-helpers/types.js.map +1 -0
- package/dist-standalone/_deps/xchange/auto-accept.d.ts +127 -0
- package/dist-standalone/_deps/xchange/auto-accept.js +1 -0
- package/dist-standalone/_deps/xchange/cjs/auto-accept.js +1 -0
- package/dist-standalone/_deps/xchange/cjs/errors.js +1 -0
- package/dist-standalone/_deps/xchange/cjs/index.js +1 -0
- package/dist-standalone/_deps/xchange/cjs/invite-client.js +1 -0
- package/dist-standalone/_deps/xchange/cjs/lazy-init.js +1 -0
- package/dist-standalone/_deps/xchange/cjs/package.json +1 -0
- package/dist-standalone/_deps/xchange/cjs/trust-integration.js +1 -0
- package/dist-standalone/_deps/xchange/cjs/xchange.js +1 -0
- package/dist-standalone/_deps/xchange/errors.d.ts +69 -0
- package/dist-standalone/_deps/xchange/errors.js +1 -0
- package/dist-standalone/_deps/xchange/index.d.ts +15 -0
- package/dist-standalone/_deps/xchange/index.js +1 -0
- package/dist-standalone/_deps/xchange/invite-client.d.ts +178 -0
- package/dist-standalone/_deps/xchange/invite-client.js +1 -0
- package/dist-standalone/_deps/xchange/lazy-init.d.ts +176 -0
- package/dist-standalone/_deps/xchange/lazy-init.js +1 -0
- package/dist-standalone/_deps/xchange/trust-integration.d.ts +102 -0
- package/dist-standalone/_deps/xchange/trust-integration.js +1 -0
- package/dist-standalone/_deps/xchange/xchange.d.ts +60 -0
- package/dist-standalone/_deps/xchange/xchange.js +1 -0
- package/dist-standalone/_deps/xregistry/cjs/discovery.js +1 -0
- package/dist-standalone/_deps/xregistry/cjs/errors.js +1 -0
- package/dist-standalone/_deps/xregistry/cjs/index.js +1 -0
- package/dist-standalone/_deps/xregistry/cjs/package.json +1 -0
- package/dist-standalone/_deps/xregistry/cjs/registry.js +1 -0
- package/dist-standalone/_deps/xregistry/cjs/schema.js +1 -0
- package/dist-standalone/_deps/xregistry/cjs/types.js +1 -0
- package/dist-standalone/_deps/xregistry/discovery.d.ts +126 -0
- package/dist-standalone/_deps/xregistry/discovery.d.ts.map +1 -0
- package/dist-standalone/_deps/xregistry/discovery.js +1 -0
- package/dist-standalone/_deps/xregistry/discovery.js.map +1 -0
- package/dist-standalone/_deps/xregistry/errors.d.ts +41 -0
- package/dist-standalone/_deps/xregistry/errors.d.ts.map +1 -0
- package/dist-standalone/_deps/xregistry/errors.js +1 -0
- package/dist-standalone/_deps/xregistry/errors.js.map +1 -0
- package/dist-standalone/_deps/xregistry/index.d.ts +8 -0
- package/dist-standalone/_deps/xregistry/index.d.ts.map +1 -0
- package/dist-standalone/_deps/xregistry/index.js +1 -0
- package/dist-standalone/_deps/xregistry/index.js.map +1 -0
- package/dist-standalone/_deps/xregistry/registry.d.ts +85 -0
- package/dist-standalone/_deps/xregistry/registry.d.ts.map +1 -0
- package/dist-standalone/_deps/xregistry/registry.js +1 -0
- package/dist-standalone/_deps/xregistry/registry.js.map +1 -0
- package/dist-standalone/_deps/xregistry/schema.d.ts +81 -0
- package/dist-standalone/_deps/xregistry/schema.d.ts.map +1 -0
- package/dist-standalone/_deps/xregistry/schema.js +1 -0
- package/dist-standalone/_deps/xregistry/schema.js.map +1 -0
- package/dist-standalone/_deps/xregistry/types.d.ts +95 -0
- package/dist-standalone/_deps/xregistry/types.d.ts.map +1 -0
- package/dist-standalone/_deps/xregistry/types.js +1 -0
- package/dist-standalone/_deps/xregistry/types.js.map +1 -0
- package/dist-standalone/agent-call.d.ts +286 -0
- package/dist-standalone/agent-call.js +642 -0
- package/dist-standalone/agent-sdk.d.ts +207 -0
- package/dist-standalone/agent-sdk.js +328 -0
- package/dist-standalone/agent.d.ts +670 -0
- package/dist-standalone/agent.js +1529 -0
- package/dist-standalone/approval.d.ts +145 -0
- package/dist-standalone/approval.js +193 -0
- package/dist-standalone/auth.d.ts +75 -0
- package/dist-standalone/auth.js +219 -0
- package/dist-standalone/auto-accept.d.ts +102 -0
- package/dist-standalone/auto-accept.js +229 -0
- package/dist-standalone/backup-config.d.ts +150 -0
- package/dist-standalone/backup-config.js +201 -0
- package/dist-standalone/checkpoint.d.ts +125 -0
- package/dist-standalone/checkpoint.js +186 -0
- package/dist-standalone/cjs/agent-call.js +651 -0
- package/dist-standalone/cjs/agent-sdk.js +332 -0
- package/dist-standalone/cjs/agent.js +1566 -0
- package/dist-standalone/cjs/approval.js +199 -0
- package/dist-standalone/cjs/auth.js +225 -0
- package/dist-standalone/cjs/auto-accept.js +233 -0
- package/dist-standalone/cjs/backup-config.js +207 -0
- package/dist-standalone/cjs/checkpoint.js +193 -0
- package/dist-standalone/cjs/cli/init.js +487 -0
- package/dist-standalone/cjs/connect.js +312 -0
- package/dist-standalone/cjs/did-document.js +101 -0
- package/dist-standalone/cjs/did-privateme.js +130 -0
- package/dist-standalone/cjs/did-web.js +201 -0
- package/dist-standalone/cjs/discovery.js +462 -0
- package/dist-standalone/cjs/dual-mode.js +251 -0
- package/dist-standalone/cjs/email-templates.js +313 -0
- package/dist-standalone/cjs/email-transport.js +239 -0
- package/dist-standalone/cjs/envelope.js +510 -0
- package/dist-standalone/cjs/errors.js +562 -0
- package/dist-standalone/cjs/gateway-state.js +55 -0
- package/dist-standalone/cjs/gateway-transport.js +120 -0
- package/dist-standalone/cjs/guardrails.js +223 -0
- package/dist-standalone/cjs/http-compat.js +272 -0
- package/dist-standalone/cjs/identity.js +541 -0
- package/dist-standalone/cjs/index.js +224 -0
- package/dist-standalone/cjs/invitation.js +421 -0
- package/dist-standalone/cjs/invite.js +328 -0
- package/dist-standalone/cjs/key-agreement.js +246 -0
- package/dist-standalone/cjs/lazy-init.js +300 -0
- package/dist-standalone/cjs/mdns-discovery.js +202 -0
- package/dist-standalone/cjs/nonce-store.js +66 -0
- package/dist-standalone/cjs/package.json +3 -0
- package/dist-standalone/cjs/pairing-manager.js +223 -0
- package/dist-standalone/cjs/policy.js +320 -0
- package/dist-standalone/cjs/redis-nonce-store.js +76 -0
- package/dist-standalone/cjs/registry-middleware.js +50 -0
- package/dist-standalone/cjs/retry-transport.js +102 -0
- package/dist-standalone/cjs/security-policy.js +204 -0
- package/dist-standalone/cjs/split-channel.js +177 -0
- package/dist-standalone/cjs/subscription-proof.js +230 -0
- package/dist-standalone/cjs/succession.js +148 -0
- package/dist-standalone/cjs/transport.js +63 -0
- package/dist-standalone/cjs/trust-registry.js +742 -0
- package/dist-standalone/cjs/verify.js +25 -0
- package/dist-standalone/cjs/xfetch.js +252 -0
- package/dist-standalone/cli/init.d.ts +63 -0
- package/dist-standalone/cli/init.js +450 -0
- package/dist-standalone/connect.d.ts +143 -0
- package/dist-standalone/connect.js +274 -0
- package/dist-standalone/did-document.d.ts +65 -0
- package/dist-standalone/did-document.js +96 -0
- package/dist-standalone/did-privateme.d.ts +70 -0
- package/dist-standalone/did-privateme.js +121 -0
- package/dist-standalone/did-web.d.ts +73 -0
- package/dist-standalone/did-web.js +196 -0
- package/dist-standalone/discovery.d.ts +176 -0
- package/dist-standalone/discovery.js +458 -0
- package/dist-standalone/dual-mode.d.ts +145 -0
- package/dist-standalone/dual-mode.js +247 -0
- package/dist-standalone/email-templates.d.ts +41 -0
- package/dist-standalone/email-templates.js +309 -0
- package/dist-standalone/email-transport.d.ts +139 -0
- package/dist-standalone/email-transport.js +232 -0
- package/dist-standalone/envelope.d.ts +288 -0
- package/dist-standalone/envelope.js +497 -0
- package/dist-standalone/errors.d.ts +74 -0
- package/dist-standalone/errors.js +548 -0
- package/dist-standalone/gateway-state.d.ts +32 -0
- package/dist-standalone/gateway-state.js +51 -0
- package/dist-standalone/gateway-transport.d.ts +59 -0
- package/dist-standalone/gateway-transport.js +116 -0
- package/dist-standalone/guardrails.d.ts +136 -0
- package/dist-standalone/guardrails.js +216 -0
- package/dist-standalone/http-compat.d.ts +150 -0
- package/dist-standalone/http-compat.js +267 -0
- package/dist-standalone/identity.d.ts +176 -0
- package/dist-standalone/identity.js +516 -0
- package/dist-standalone/index.d.ts +83 -0
- package/dist-standalone/index.js +51 -0
- package/dist-standalone/invitation.d.ts +211 -0
- package/dist-standalone/invitation.js +415 -0
- package/dist-standalone/invite.d.ts +192 -0
- package/dist-standalone/invite.js +324 -0
- package/dist-standalone/key-agreement.d.ts +122 -0
- package/dist-standalone/key-agreement.js +236 -0
- package/dist-standalone/lazy-init.d.ts +167 -0
- package/dist-standalone/lazy-init.js +295 -0
- package/dist-standalone/mdns-discovery.d.ts +117 -0
- package/dist-standalone/mdns-discovery.js +195 -0
- package/dist-standalone/nonce-store.d.ts +39 -0
- package/dist-standalone/nonce-store.js +62 -0
- package/dist-standalone/package.json +11 -0
- package/dist-standalone/pairing-manager.d.ts +147 -0
- package/dist-standalone/pairing-manager.js +219 -0
- package/dist-standalone/policy.d.ts +150 -0
- package/dist-standalone/policy.js +315 -0
- package/dist-standalone/redis-nonce-store.d.ts +93 -0
- package/dist-standalone/redis-nonce-store.js +72 -0
- package/dist-standalone/registry-middleware.d.ts +38 -0
- package/dist-standalone/registry-middleware.js +47 -0
- package/dist-standalone/retry-transport.d.ts +76 -0
- package/dist-standalone/retry-transport.js +98 -0
- package/dist-standalone/security-policy.d.ts +146 -0
- package/dist-standalone/security-policy.js +198 -0
- package/dist-standalone/split-channel.d.ts +69 -0
- package/dist-standalone/split-channel.js +171 -0
- package/dist-standalone/subscription-proof.d.ts +103 -0
- package/dist-standalone/subscription-proof.js +224 -0
- package/dist-standalone/succession.d.ts +57 -0
- package/dist-standalone/succession.js +142 -0
- package/dist-standalone/transport.d.ts +50 -0
- package/dist-standalone/transport.js +59 -0
- package/dist-standalone/trust-registry.d.ts +286 -0
- package/dist-standalone/trust-registry.js +702 -0
- package/dist-standalone/verify.d.ts +16 -0
- package/dist-standalone/verify.js +16 -0
- package/dist-standalone/xfetch.d.ts +129 -0
- package/dist-standalone/xfetch.js +247 -0
- package/llms.txt +800 -0
- package/package.json +79 -0
- package/share1.dat +0 -0
|
@@ -0,0 +1,1097 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discriminated union for fallible operations.
|
|
3
|
+
* Library code returns Result instead of throwing exceptions.
|
|
4
|
+
*/
|
|
5
|
+
export type Result<T, E> = {
|
|
6
|
+
readonly ok: true;
|
|
7
|
+
readonly value: T;
|
|
8
|
+
} | {
|
|
9
|
+
readonly ok: false;
|
|
10
|
+
readonly error: E;
|
|
11
|
+
};
|
|
12
|
+
/** Create a successful Result. */
|
|
13
|
+
export declare function ok<T>(value: T): Result<T, never>;
|
|
14
|
+
/** Create a failed Result. */
|
|
15
|
+
export declare function err<E>(error: E): Result<never, E>;
|
|
16
|
+
/** Supported email providers for channel transport. */
|
|
17
|
+
export type Provider = 'gmail' | 'outlook' | 'yahoo';
|
|
18
|
+
/** Extended provider type including generic IMAP. */
|
|
19
|
+
export type ProviderExtended = Provider | 'imap';
|
|
20
|
+
/** A single email channel address used for transport. */
|
|
21
|
+
export interface ChannelAddress {
|
|
22
|
+
readonly provider: ProviderExtended;
|
|
23
|
+
readonly email: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Visual security border level based on channel count.
|
|
27
|
+
* - blue: 2 addresses, 2-of-2 secured
|
|
28
|
+
* - green: 3+ addresses, 2-of-3 secured + fault tolerant
|
|
29
|
+
* Use null for regular email (no security tier).
|
|
30
|
+
*/
|
|
31
|
+
export type SecurityTier = 'blue' | 'green';
|
|
32
|
+
/** Origin of a contact: native Xail user, imported from provider, or auto-extracted from email headers. */
|
|
33
|
+
export type ContactSource = 'xail' | 'imported' | 'suggested';
|
|
34
|
+
/** Contact information for a Xail user. */
|
|
35
|
+
export interface ContactInfo {
|
|
36
|
+
readonly name: string;
|
|
37
|
+
readonly channels: readonly ChannelAddress[];
|
|
38
|
+
readonly securityTier: SecurityTier | null;
|
|
39
|
+
readonly isEnterprise: boolean;
|
|
40
|
+
readonly enterpriseNotice?: string;
|
|
41
|
+
/** Profile photo URL from provider (HTTPS only). */
|
|
42
|
+
readonly photoUrl?: string;
|
|
43
|
+
/** Origin of the contact. Defaults to 'xail' for backward compat. */
|
|
44
|
+
readonly source?: ContactSource;
|
|
45
|
+
}
|
|
46
|
+
/** File attachment included with a message. */
|
|
47
|
+
export interface Attachment {
|
|
48
|
+
readonly filename: string;
|
|
49
|
+
readonly mimeType: string;
|
|
50
|
+
readonly data: Uint8Array;
|
|
51
|
+
}
|
|
52
|
+
/** Content type for message bodies. */
|
|
53
|
+
export type ContentType = 'text/plain' | 'text/html';
|
|
54
|
+
/** Type of message: regular email or secure Xail split-channel message. */
|
|
55
|
+
export type MessageType = 'regular' | 'secure';
|
|
56
|
+
/** A Xail message (either regular or secure). */
|
|
57
|
+
export interface XailMessage {
|
|
58
|
+
readonly uuid: string;
|
|
59
|
+
readonly sender: ContactInfo;
|
|
60
|
+
readonly recipients: readonly ContactInfo[];
|
|
61
|
+
readonly subject?: string;
|
|
62
|
+
readonly body: string;
|
|
63
|
+
readonly contentType: ContentType;
|
|
64
|
+
readonly attachments: readonly Attachment[];
|
|
65
|
+
readonly timestamp: number;
|
|
66
|
+
readonly messageType: MessageType;
|
|
67
|
+
}
|
|
68
|
+
/** A regular email fetched from a provider. */
|
|
69
|
+
export interface RegularEmail {
|
|
70
|
+
readonly id: string;
|
|
71
|
+
readonly provider: Provider;
|
|
72
|
+
readonly from: string;
|
|
73
|
+
readonly to: readonly string[];
|
|
74
|
+
readonly cc?: readonly string[];
|
|
75
|
+
readonly subject: string;
|
|
76
|
+
readonly body: string;
|
|
77
|
+
readonly contentType: ContentType;
|
|
78
|
+
readonly attachments: readonly Attachment[];
|
|
79
|
+
readonly timestamp: number;
|
|
80
|
+
readonly labels: readonly string[];
|
|
81
|
+
readonly isRead: boolean;
|
|
82
|
+
readonly threadId?: string;
|
|
83
|
+
readonly unsubscribeUrl?: string;
|
|
84
|
+
}
|
|
85
|
+
/** A single share produced by threshold splitting. */
|
|
86
|
+
export interface XailShare {
|
|
87
|
+
readonly uuid: string;
|
|
88
|
+
readonly index: number;
|
|
89
|
+
readonly totalShares: number;
|
|
90
|
+
readonly threshold: number;
|
|
91
|
+
readonly data: Uint8Array;
|
|
92
|
+
readonly hmacKey: Uint8Array;
|
|
93
|
+
readonly hmacSignature: Uint8Array;
|
|
94
|
+
/** Provider-specific message ID for the email carrying this share. */
|
|
95
|
+
readonly providerMessageId?: string;
|
|
96
|
+
/** Provider that delivered this share ('gmail' | 'outlook' | 'yahoo'). */
|
|
97
|
+
readonly sourceProvider?: string;
|
|
98
|
+
}
|
|
99
|
+
/** TLV type codes for message serialization. */
|
|
100
|
+
export declare const TLV_TYPE: {
|
|
101
|
+
readonly MESSAGE_BODY: 1;
|
|
102
|
+
readonly ATTACHMENT: 2;
|
|
103
|
+
readonly SENDER_ID: 3;
|
|
104
|
+
readonly TIMESTAMP: 4;
|
|
105
|
+
readonly MESSAGE_UUID: 5;
|
|
106
|
+
readonly SHARE_INDEX: 6;
|
|
107
|
+
readonly TOTAL_SHARES: 7;
|
|
108
|
+
readonly THRESHOLD: 8;
|
|
109
|
+
readonly HMAC_KEY: 9;
|
|
110
|
+
readonly HMAC_SIGNATURE: 10;
|
|
111
|
+
readonly CONTENT_TYPE: 11;
|
|
112
|
+
readonly MESSAGE_SUBJECT: 12;
|
|
113
|
+
readonly SENDER_EMAIL: 13;
|
|
114
|
+
};
|
|
115
|
+
export type TlvType = (typeof TLV_TYPE)[keyof typeof TLV_TYPE];
|
|
116
|
+
/** Enterprise server configuration. */
|
|
117
|
+
export interface EnterpriseConfig {
|
|
118
|
+
readonly serverUrl: string;
|
|
119
|
+
readonly compliancePublicKey: CryptoKey;
|
|
120
|
+
readonly dlpEnabled: boolean;
|
|
121
|
+
readonly retentionDays: number;
|
|
122
|
+
}
|
|
123
|
+
/** Error during PKCS#7 padding/unpadding. */
|
|
124
|
+
export interface PaddingError {
|
|
125
|
+
readonly code: 'INVALID_PADDING';
|
|
126
|
+
readonly message: string;
|
|
127
|
+
}
|
|
128
|
+
/** Error during share reconstruction. */
|
|
129
|
+
export interface ReconstructionError {
|
|
130
|
+
readonly code: 'HMAC_FAILURE' | 'INVALID_SHARES' | 'INSUFFICIENT_SHARES' | 'INVALID_INDEX' | 'UUID_MISMATCH';
|
|
131
|
+
readonly message: string;
|
|
132
|
+
}
|
|
133
|
+
/** Error during TLV serialization/deserialization. */
|
|
134
|
+
export interface SerializationError {
|
|
135
|
+
readonly code: 'INVALID_TLV' | 'BUFFER_OVERFLOW' | 'MISSING_FIELD' | 'INVALID_TYPE';
|
|
136
|
+
readonly message: string;
|
|
137
|
+
}
|
|
138
|
+
/** Error during HMAC integrity verification. */
|
|
139
|
+
export interface IntegrityError {
|
|
140
|
+
readonly code: 'HMAC_MISMATCH' | 'KEY_ERROR';
|
|
141
|
+
readonly message: string;
|
|
142
|
+
}
|
|
143
|
+
/** Error during transport operations (send, receive, polling). */
|
|
144
|
+
export interface TransportError {
|
|
145
|
+
readonly code: 'NETWORK_ERROR' | 'AUTH_ERROR' | 'TOKEN_REVOKED' | 'RATE_LIMITED' | 'PROVIDER_ERROR' | 'INVALID_RESPONSE' | 'TIMEOUT';
|
|
146
|
+
readonly message: string;
|
|
147
|
+
readonly provider?: Provider;
|
|
148
|
+
readonly retryable: boolean;
|
|
149
|
+
}
|
|
150
|
+
/** Extracted metadata from a message (never contains plaintext body). */
|
|
151
|
+
export interface MessageMetadata {
|
|
152
|
+
readonly id: string;
|
|
153
|
+
readonly messageType: MessageType;
|
|
154
|
+
readonly senderName: string;
|
|
155
|
+
readonly senderEmail: string;
|
|
156
|
+
readonly recipientEmails: readonly string[];
|
|
157
|
+
readonly subject: string;
|
|
158
|
+
readonly keywords: readonly string[];
|
|
159
|
+
readonly entities: readonly ExtractedEntity[];
|
|
160
|
+
readonly timestamp: number;
|
|
161
|
+
readonly threadId: string;
|
|
162
|
+
readonly isRead: boolean;
|
|
163
|
+
readonly securityTier: SecurityTier | null;
|
|
164
|
+
readonly snippet: string;
|
|
165
|
+
readonly hasAttachments: boolean;
|
|
166
|
+
readonly attachmentNames: readonly string[];
|
|
167
|
+
/** Provider label IDs (e.g. Gmail labels). */
|
|
168
|
+
readonly labels: readonly string[];
|
|
169
|
+
/** Whether this message was sent by the user. */
|
|
170
|
+
readonly isSent: boolean;
|
|
171
|
+
/** Whether this message is a draft. */
|
|
172
|
+
readonly isDraft: boolean;
|
|
173
|
+
/** Whether this message is starred. */
|
|
174
|
+
readonly isStarred: boolean;
|
|
175
|
+
}
|
|
176
|
+
/** Type of entity extracted from message content. */
|
|
177
|
+
export type EntityType = 'person' | 'organization' | 'amount' | 'date' | 'email' | 'url';
|
|
178
|
+
/** An entity extracted from message text. */
|
|
179
|
+
export interface ExtractedEntity {
|
|
180
|
+
readonly type: EntityType;
|
|
181
|
+
readonly value: string;
|
|
182
|
+
readonly position: number;
|
|
183
|
+
}
|
|
184
|
+
/** Search query options for filtering messages. */
|
|
185
|
+
export interface SearchQuery {
|
|
186
|
+
readonly text?: string;
|
|
187
|
+
readonly from?: string;
|
|
188
|
+
readonly to?: string;
|
|
189
|
+
readonly dateFrom?: number;
|
|
190
|
+
readonly dateTo?: number;
|
|
191
|
+
readonly messageType?: MessageType;
|
|
192
|
+
readonly subject?: string;
|
|
193
|
+
readonly hasAttachments?: boolean;
|
|
194
|
+
/** Filter by attachment filename (partial, case-insensitive). */
|
|
195
|
+
readonly attachmentName?: string;
|
|
196
|
+
readonly isUnread?: boolean;
|
|
197
|
+
readonly isRead?: boolean;
|
|
198
|
+
readonly isStarred?: boolean;
|
|
199
|
+
readonly isSent?: boolean;
|
|
200
|
+
readonly isDraft?: boolean;
|
|
201
|
+
/** Filter to secure messages only (securityTier is blue or green). */
|
|
202
|
+
readonly isSecure?: boolean;
|
|
203
|
+
readonly label?: string;
|
|
204
|
+
readonly excludeText?: string;
|
|
205
|
+
readonly entityType?: EntityType;
|
|
206
|
+
readonly entityValue?: string;
|
|
207
|
+
readonly threadId?: string;
|
|
208
|
+
readonly limit?: number;
|
|
209
|
+
readonly offset?: number;
|
|
210
|
+
}
|
|
211
|
+
/** A result page from a search query. */
|
|
212
|
+
export interface SearchResult {
|
|
213
|
+
readonly items: readonly MessageMetadata[];
|
|
214
|
+
readonly total: number;
|
|
215
|
+
readonly hasMore: boolean;
|
|
216
|
+
}
|
|
217
|
+
/** A thread of related messages. */
|
|
218
|
+
export interface MessageThread {
|
|
219
|
+
readonly threadId: string;
|
|
220
|
+
readonly subject: string;
|
|
221
|
+
readonly participants: readonly string[];
|
|
222
|
+
readonly messageCount: number;
|
|
223
|
+
readonly latestTimestamp: number;
|
|
224
|
+
readonly securityTier: SecurityTier | null;
|
|
225
|
+
readonly messageIds: readonly string[];
|
|
226
|
+
}
|
|
227
|
+
/** Error during search/index operations. */
|
|
228
|
+
export interface SearchError {
|
|
229
|
+
readonly code: 'STORAGE_ERROR' | 'ENCRYPTION_ERROR' | 'DECRYPTION_ERROR' | 'INVALID_QUERY' | 'INDEX_CORRUPTED' | 'KEY_DERIVATION_ERROR';
|
|
230
|
+
readonly message: string;
|
|
231
|
+
}
|
|
232
|
+
/** OAuth token pair for a connected provider account. */
|
|
233
|
+
export interface OAuthTokens {
|
|
234
|
+
readonly accessToken: string;
|
|
235
|
+
readonly refreshToken: string;
|
|
236
|
+
readonly expiresAt: number;
|
|
237
|
+
readonly provider: Provider;
|
|
238
|
+
readonly email: string;
|
|
239
|
+
readonly displayName?: string;
|
|
240
|
+
}
|
|
241
|
+
/** PKCE challenge pair for OAuth flow. */
|
|
242
|
+
export interface PkceChallenge {
|
|
243
|
+
readonly codeVerifier: string;
|
|
244
|
+
readonly codeChallenge: string;
|
|
245
|
+
}
|
|
246
|
+
/** Types of security events logged client-side. */
|
|
247
|
+
export type SecurityEventType = 'hmac_failure' | 'oauth_failure' | 'reconstruction_anomaly' | 'auth_error' | 'share_rejected';
|
|
248
|
+
/** A logged security event. */
|
|
249
|
+
export interface SecurityEvent {
|
|
250
|
+
readonly type: SecurityEventType;
|
|
251
|
+
readonly timestamp: number;
|
|
252
|
+
readonly uuid?: string;
|
|
253
|
+
readonly details: string;
|
|
254
|
+
}
|
|
255
|
+
/** Supported inference runtimes for on-device AI. */
|
|
256
|
+
export type InferenceRuntime = 'ollama' | 'apple-foundation' | 'gemini-nano' | 'webllm';
|
|
257
|
+
/** Configuration for an embedding model. */
|
|
258
|
+
export interface EmbeddingModelConfig {
|
|
259
|
+
readonly runtime: InferenceRuntime;
|
|
260
|
+
readonly modelName: string;
|
|
261
|
+
readonly dimensions: number;
|
|
262
|
+
readonly maxInputLength: number;
|
|
263
|
+
}
|
|
264
|
+
/** A stored embedding vector for a message. */
|
|
265
|
+
export interface MessageEmbedding {
|
|
266
|
+
readonly messageId: string;
|
|
267
|
+
readonly vector: readonly number[];
|
|
268
|
+
readonly dimensions: number;
|
|
269
|
+
readonly modelUsed: string;
|
|
270
|
+
readonly createdAt: number;
|
|
271
|
+
}
|
|
272
|
+
/** A search result scored by relevance with source attribution. */
|
|
273
|
+
export interface ScoredSearchResult {
|
|
274
|
+
readonly metadata: MessageMetadata;
|
|
275
|
+
readonly score: number;
|
|
276
|
+
readonly source: 'keyword' | 'semantic' | 'hybrid';
|
|
277
|
+
}
|
|
278
|
+
/** Combined search results from hybrid keyword + semantic search. */
|
|
279
|
+
export interface HybridSearchResult {
|
|
280
|
+
readonly items: readonly ScoredSearchResult[];
|
|
281
|
+
readonly total: number;
|
|
282
|
+
readonly hasMore: boolean;
|
|
283
|
+
readonly semanticAvailable: boolean;
|
|
284
|
+
}
|
|
285
|
+
/** Error during embedding operations. */
|
|
286
|
+
export interface EmbeddingError {
|
|
287
|
+
readonly code: 'EMBEDDING_FAILED' | 'MODEL_NOT_LOADED' | 'DIMENSIONS_MISMATCH' | 'INPUT_TOO_LONG' | 'RUNTIME_UNAVAILABLE' | 'STORAGE_ERROR';
|
|
288
|
+
readonly message: string;
|
|
289
|
+
}
|
|
290
|
+
/** Runtime status snapshot for an inference adapter. */
|
|
291
|
+
export interface RuntimeStatus {
|
|
292
|
+
readonly runtime: InferenceRuntime;
|
|
293
|
+
readonly available: boolean;
|
|
294
|
+
readonly modelLoaded: boolean;
|
|
295
|
+
readonly modelName: string | null;
|
|
296
|
+
readonly dimensions: number | null;
|
|
297
|
+
}
|
|
298
|
+
/** Capabilities reported by an inference runtime. */
|
|
299
|
+
export interface InferenceCapabilities {
|
|
300
|
+
readonly canEmbed: boolean;
|
|
301
|
+
readonly canSummarize: boolean;
|
|
302
|
+
readonly canExtractEntities: boolean;
|
|
303
|
+
readonly maxInputTokens: number;
|
|
304
|
+
readonly embeddingDimensions: number | null;
|
|
305
|
+
}
|
|
306
|
+
/** Connection status for a local AI model server. */
|
|
307
|
+
export type OllamaConnectionStatus = 'connected' | 'disconnected' | 'checking';
|
|
308
|
+
/** Model info returned by Ollama /api/tags endpoint. */
|
|
309
|
+
export interface OllamaModel {
|
|
310
|
+
readonly name: string;
|
|
311
|
+
readonly size: number;
|
|
312
|
+
readonly digest: string;
|
|
313
|
+
readonly modifiedAt: string;
|
|
314
|
+
}
|
|
315
|
+
/** Status snapshot of the local AI server. */
|
|
316
|
+
export interface OllamaStatus {
|
|
317
|
+
readonly status: OllamaConnectionStatus;
|
|
318
|
+
readonly models: readonly OllamaModel[];
|
|
319
|
+
readonly selectedModel: string | null;
|
|
320
|
+
readonly endpoint: string;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* User-facing AI search settings. Opt-in only, disabled by default.
|
|
324
|
+
* AI features require explicit user acknowledgement of the disclosure.
|
|
325
|
+
*/
|
|
326
|
+
export interface AiSettings {
|
|
327
|
+
readonly enabled: boolean;
|
|
328
|
+
readonly disclosureAcknowledged: boolean;
|
|
329
|
+
readonly selectedModel: string | null;
|
|
330
|
+
readonly autoSummarize: boolean;
|
|
331
|
+
readonly enhancedEntityExtraction: boolean;
|
|
332
|
+
readonly semanticSearchEnabled: boolean;
|
|
333
|
+
readonly selectedEmbeddingModel: string | null;
|
|
334
|
+
readonly selectedRuntime: InferenceRuntime | null;
|
|
335
|
+
}
|
|
336
|
+
/** AI-generated metadata for a message, stored encrypted. */
|
|
337
|
+
export interface AiMetadata {
|
|
338
|
+
readonly messageId: string;
|
|
339
|
+
readonly summary: string | null;
|
|
340
|
+
readonly enhancedEntities: readonly ExtractedEntity[];
|
|
341
|
+
readonly tags: readonly string[];
|
|
342
|
+
readonly processedAt: number;
|
|
343
|
+
readonly modelUsed: string;
|
|
344
|
+
}
|
|
345
|
+
/** Error during AI operations. */
|
|
346
|
+
export interface AiSearchError {
|
|
347
|
+
readonly code: 'AI_DISABLED' | 'NO_MODEL_AVAILABLE' | 'LOCALHOST_ONLY' | 'CONNECTION_FAILED' | 'GENERATION_FAILED' | 'INVALID_RESPONSE' | 'STORAGE_ERROR' | 'EMBEDDING_FAILED';
|
|
348
|
+
readonly message: string;
|
|
349
|
+
}
|
|
350
|
+
/** Encrypted compliance copy stored on Corporate Xail Server. */
|
|
351
|
+
export interface ComplianceCopy {
|
|
352
|
+
readonly messageUuid: string;
|
|
353
|
+
readonly senderEmail: string;
|
|
354
|
+
readonly recipientEmails: readonly string[];
|
|
355
|
+
readonly encryptedContent: Uint8Array;
|
|
356
|
+
readonly encryptedAesKey: Uint8Array;
|
|
357
|
+
readonly iv: Uint8Array;
|
|
358
|
+
readonly timestamp: number;
|
|
359
|
+
readonly contentType: ContentType;
|
|
360
|
+
readonly orgId: string;
|
|
361
|
+
}
|
|
362
|
+
/** DLP scan actions: allow, block, or quarantine the message. */
|
|
363
|
+
export type DlpAction = 'allow' | 'block' | 'quarantine';
|
|
364
|
+
/** Result of a DLP pre-split scan. */
|
|
365
|
+
export interface DlpScanResult {
|
|
366
|
+
readonly action: DlpAction;
|
|
367
|
+
readonly reason?: string;
|
|
368
|
+
readonly ruleId?: string;
|
|
369
|
+
readonly scannedAt: number;
|
|
370
|
+
}
|
|
371
|
+
/** Types of enterprise audit actions logged server-side. */
|
|
372
|
+
export type AuditAction = 'compliance_copy_created' | 'compliance_copy_stored' | 'compliance_copy_decrypted' | 'dlp_scan_requested' | 'dlp_scan_completed' | 'delegation_created' | 'delegation_revoked' | 'ediscovery_search' | 'ediscovery_export' | 'retention_enforced' | 'retention_deleted' | 'tenant_provisioned' | 'tenant_activated' | 'tenant_suspended' | 'tenant_deactivated';
|
|
373
|
+
/** A server-side audit log entry. */
|
|
374
|
+
export interface AuditEntry {
|
|
375
|
+
readonly id: string;
|
|
376
|
+
readonly action: AuditAction;
|
|
377
|
+
readonly actor: string;
|
|
378
|
+
readonly target: string;
|
|
379
|
+
readonly timestamp: number;
|
|
380
|
+
readonly metadata: Readonly<Record<string, string>>;
|
|
381
|
+
}
|
|
382
|
+
/** Permission levels for delegated access. */
|
|
383
|
+
export type DelegatePermission = 'read' | 'reconstruct' | 'export';
|
|
384
|
+
/** A delegation granting one user access to another's messages. */
|
|
385
|
+
export interface Delegation {
|
|
386
|
+
readonly id: string;
|
|
387
|
+
readonly delegatorEmail: string;
|
|
388
|
+
readonly delegateEmail: string;
|
|
389
|
+
readonly permissions: readonly DelegatePermission[];
|
|
390
|
+
readonly createdAt: number;
|
|
391
|
+
readonly expiresAt: number;
|
|
392
|
+
readonly isActive: boolean;
|
|
393
|
+
}
|
|
394
|
+
/** Retention policy for compliance copies. */
|
|
395
|
+
export interface RetentionPolicy {
|
|
396
|
+
readonly minDays: number;
|
|
397
|
+
readonly maxDays: number;
|
|
398
|
+
readonly autoDelete: boolean;
|
|
399
|
+
readonly legalHoldOverride: boolean;
|
|
400
|
+
}
|
|
401
|
+
/** Error during enterprise operations. */
|
|
402
|
+
export interface EnterpriseError {
|
|
403
|
+
readonly code: 'ENCRYPTION_FAILED' | 'DECRYPTION_FAILED' | 'SERVER_UNREACHABLE' | 'DLP_BLOCKED' | 'UNAUTHORIZED' | 'INVALID_CONFIG' | 'DELEGATION_EXPIRED' | 'DELEGATION_NOT_FOUND' | 'RETENTION_VIOLATION' | 'EDISCOVERY_ERROR' | 'COPY_NOT_FOUND' | 'ALREADY_EXISTS';
|
|
404
|
+
readonly message: string;
|
|
405
|
+
}
|
|
406
|
+
/** Query parameters for eDiscovery search. */
|
|
407
|
+
export interface EDiscoveryQuery {
|
|
408
|
+
readonly senderEmail?: string;
|
|
409
|
+
readonly recipientEmail?: string;
|
|
410
|
+
readonly dateFrom?: number;
|
|
411
|
+
readonly dateTo?: number;
|
|
412
|
+
readonly orgId: string;
|
|
413
|
+
readonly limit?: number;
|
|
414
|
+
readonly offset?: number;
|
|
415
|
+
}
|
|
416
|
+
/** A single eDiscovery search result (metadata only, not decrypted). */
|
|
417
|
+
export interface EDiscoveryResult {
|
|
418
|
+
readonly messageUuid: string;
|
|
419
|
+
readonly senderEmail: string;
|
|
420
|
+
readonly recipientEmails: readonly string[];
|
|
421
|
+
readonly timestamp: number;
|
|
422
|
+
readonly hasComplianceCopy: boolean;
|
|
423
|
+
}
|
|
424
|
+
/** Trust level for a contact's public key. */
|
|
425
|
+
export type TrustLevel = 'unknown' | 'tofu' | 'verified';
|
|
426
|
+
/** Action recorded in the key transparency log. */
|
|
427
|
+
export type KeyTransparencyAction = 'key_registered' | 'key_rotated' | 'key_verified' | 'key_revoked';
|
|
428
|
+
/** An entry in the append-only key transparency log. */
|
|
429
|
+
export interface KeyTransparencyEntry {
|
|
430
|
+
readonly id: string;
|
|
431
|
+
readonly contactEmail: string;
|
|
432
|
+
readonly publicKeyFingerprint: string;
|
|
433
|
+
readonly previousEntryHash: string | null;
|
|
434
|
+
readonly action: KeyTransparencyAction;
|
|
435
|
+
readonly timestamp: number;
|
|
436
|
+
readonly metadata: Readonly<Record<string, string>>;
|
|
437
|
+
}
|
|
438
|
+
/** A verification challenge for mutual key verification ceremony. */
|
|
439
|
+
export interface VerificationChallenge {
|
|
440
|
+
readonly id: string;
|
|
441
|
+
readonly shortAuthString: string;
|
|
442
|
+
readonly qrData: string;
|
|
443
|
+
readonly initiatorEmail: string;
|
|
444
|
+
readonly responderEmail: string;
|
|
445
|
+
readonly initiatorFingerprint: string;
|
|
446
|
+
readonly responderFingerprint: string;
|
|
447
|
+
readonly createdAt: number;
|
|
448
|
+
readonly expiresAt: number;
|
|
449
|
+
}
|
|
450
|
+
/** Record of a key rotation event. */
|
|
451
|
+
export interface KeyRotationRecord {
|
|
452
|
+
readonly contactEmail: string;
|
|
453
|
+
readonly oldFingerprint: string;
|
|
454
|
+
readonly newFingerprint: string;
|
|
455
|
+
readonly continuitySignature: Uint8Array;
|
|
456
|
+
readonly rotatedAt: number;
|
|
457
|
+
readonly gracePeriodEndsAt: number;
|
|
458
|
+
}
|
|
459
|
+
/** Error during trust establishment operations. */
|
|
460
|
+
export interface TrustError {
|
|
461
|
+
readonly code: 'VERIFICATION_FAILED' | 'VERIFICATION_EXPIRED' | 'KEY_MISMATCH' | 'FINGERPRINT_CONFLICT' | 'ROTATION_INVALID' | 'CONTINUITY_BROKEN' | 'LOG_CORRUPTED' | 'CONTACT_NOT_FOUND';
|
|
462
|
+
readonly message: string;
|
|
463
|
+
}
|
|
464
|
+
/** Permission scopes for API keys. */
|
|
465
|
+
export type ApiKeyPermission = 'share:create' | 'share:retrieve' | 'share:list' | 'key:manage';
|
|
466
|
+
/** An API key for third-party integration. */
|
|
467
|
+
export interface ApiKey {
|
|
468
|
+
readonly id: string;
|
|
469
|
+
readonly keyHash: string;
|
|
470
|
+
readonly orgId: string;
|
|
471
|
+
readonly name: string;
|
|
472
|
+
readonly permissions: readonly ApiKeyPermission[];
|
|
473
|
+
readonly rateLimit: ApiRateLimit;
|
|
474
|
+
readonly createdAt: number;
|
|
475
|
+
readonly expiresAt: number;
|
|
476
|
+
readonly isActive: boolean;
|
|
477
|
+
}
|
|
478
|
+
/** Rate limit configuration for an API key. */
|
|
479
|
+
export interface ApiRateLimit {
|
|
480
|
+
readonly requestsPerMinute: number;
|
|
481
|
+
readonly requestsPerHour: number;
|
|
482
|
+
readonly requestsPerDay: number;
|
|
483
|
+
}
|
|
484
|
+
/** Request to split content into shares via the API. */
|
|
485
|
+
export interface SplitRequest {
|
|
486
|
+
readonly content: Uint8Array;
|
|
487
|
+
readonly contentType: ContentType;
|
|
488
|
+
readonly threshold: number;
|
|
489
|
+
readonly totalShares: number;
|
|
490
|
+
}
|
|
491
|
+
/** Response from a split operation. */
|
|
492
|
+
export interface SplitResponse {
|
|
493
|
+
readonly uuid: string;
|
|
494
|
+
readonly shareIds: readonly string[];
|
|
495
|
+
readonly threshold: number;
|
|
496
|
+
readonly totalShares: number;
|
|
497
|
+
readonly createdAt: number;
|
|
498
|
+
}
|
|
499
|
+
/** Request to retrieve and reconstruct from shares via the API. */
|
|
500
|
+
export interface RetrieveRequest {
|
|
501
|
+
readonly uuid: string;
|
|
502
|
+
readonly shareIndices: readonly number[];
|
|
503
|
+
}
|
|
504
|
+
/** Response from a retrieve/reconstruct operation. */
|
|
505
|
+
export interface RetrieveResponse {
|
|
506
|
+
readonly uuid: string;
|
|
507
|
+
readonly content: Uint8Array;
|
|
508
|
+
readonly contentType: ContentType;
|
|
509
|
+
readonly reconstructedAt: number;
|
|
510
|
+
}
|
|
511
|
+
/** Error during API operations. */
|
|
512
|
+
export interface ApiError {
|
|
513
|
+
readonly code: 'INVALID_API_KEY' | 'RATE_LIMITED' | 'INSUFFICIENT_PERMISSIONS' | 'INVALID_REQUEST' | 'SPLIT_FAILED' | 'RETRIEVE_FAILED' | 'KEY_EXPIRED' | 'INTERNAL_ERROR';
|
|
514
|
+
readonly message: string;
|
|
515
|
+
}
|
|
516
|
+
/** SSO provider type. */
|
|
517
|
+
export type SsoProvider = 'saml' | 'oidc';
|
|
518
|
+
/** SSO configuration for an organization. */
|
|
519
|
+
export interface SsoConfig {
|
|
520
|
+
readonly provider: SsoProvider;
|
|
521
|
+
readonly entityId: string;
|
|
522
|
+
readonly ssoUrl: string;
|
|
523
|
+
readonly certificate: string;
|
|
524
|
+
readonly issuer: string;
|
|
525
|
+
readonly callbackUrl: string;
|
|
526
|
+
readonly isEnabled: boolean;
|
|
527
|
+
}
|
|
528
|
+
/** Validated SSO assertion/claims. */
|
|
529
|
+
export interface SsoAssertion {
|
|
530
|
+
readonly email: string;
|
|
531
|
+
readonly name: string;
|
|
532
|
+
readonly groups: readonly string[];
|
|
533
|
+
readonly provider: SsoProvider;
|
|
534
|
+
readonly issuedAt: number;
|
|
535
|
+
readonly expiresAt: number;
|
|
536
|
+
readonly sessionId: string;
|
|
537
|
+
}
|
|
538
|
+
/** Role of an organization user. */
|
|
539
|
+
export type UserRole = 'admin' | 'compliance_officer' | 'user';
|
|
540
|
+
/** Status of an organization user account. */
|
|
541
|
+
export type UserStatus = 'active' | 'suspended' | 'invited';
|
|
542
|
+
/** An organization user record. */
|
|
543
|
+
export interface OrgUser {
|
|
544
|
+
readonly id: string;
|
|
545
|
+
readonly email: string;
|
|
546
|
+
readonly name: string;
|
|
547
|
+
readonly role: UserRole;
|
|
548
|
+
readonly status: UserStatus;
|
|
549
|
+
readonly orgId: string;
|
|
550
|
+
readonly createdAt: number;
|
|
551
|
+
readonly lastLoginAt: number | null;
|
|
552
|
+
readonly ssoLinked: boolean;
|
|
553
|
+
}
|
|
554
|
+
/** Organization-level policy bundle. */
|
|
555
|
+
export interface OrgPolicy {
|
|
556
|
+
readonly id: string;
|
|
557
|
+
readonly orgId: string;
|
|
558
|
+
readonly retention: RetentionPolicy;
|
|
559
|
+
readonly dlpEnabled: boolean;
|
|
560
|
+
readonly ssoRequired: boolean;
|
|
561
|
+
readonly maxDelegationDays: number;
|
|
562
|
+
readonly allowedDelegatePermissions: readonly DelegatePermission[];
|
|
563
|
+
readonly createdAt: number;
|
|
564
|
+
readonly updatedAt: number;
|
|
565
|
+
}
|
|
566
|
+
/** Error during admin operations. */
|
|
567
|
+
export interface AdminError {
|
|
568
|
+
readonly code: 'USER_NOT_FOUND' | 'USER_ALREADY_EXISTS' | 'INVALID_ROLE' | 'SSO_CONFIG_INVALID' | 'SSO_ASSERTION_EXPIRED' | 'SSO_ASSERTION_INVALID' | 'POLICY_NOT_FOUND' | 'POLICY_INVALID' | 'ORG_NOT_FOUND';
|
|
569
|
+
readonly message: string;
|
|
570
|
+
}
|
|
571
|
+
/** Visual branding configuration for a white-label deployment. */
|
|
572
|
+
export interface BrandConfig {
|
|
573
|
+
readonly appName: string;
|
|
574
|
+
readonly logoUrl: string;
|
|
575
|
+
readonly faviconUrl: string;
|
|
576
|
+
readonly primaryColor: string;
|
|
577
|
+
readonly secondaryColor: string;
|
|
578
|
+
readonly fontFamily: string;
|
|
579
|
+
readonly customCss: string;
|
|
580
|
+
}
|
|
581
|
+
/** Custom domain configuration for a white-label deployment. */
|
|
582
|
+
export interface DomainConfig {
|
|
583
|
+
readonly customDomain: string;
|
|
584
|
+
readonly verified: boolean;
|
|
585
|
+
readonly txtRecord: string;
|
|
586
|
+
readonly cnameTarget: string;
|
|
587
|
+
readonly sslStatus: 'pending' | 'active' | 'failed';
|
|
588
|
+
readonly verifiedAt: number | null;
|
|
589
|
+
}
|
|
590
|
+
/** Email template configuration for branded emails. */
|
|
591
|
+
export interface EmailTemplateConfig {
|
|
592
|
+
readonly fromName: string;
|
|
593
|
+
readonly fromEmail: string;
|
|
594
|
+
readonly replyTo: string;
|
|
595
|
+
readonly headerHtml: string;
|
|
596
|
+
readonly footerHtml: string;
|
|
597
|
+
readonly invitationSubject: string;
|
|
598
|
+
readonly invitationBody: string;
|
|
599
|
+
}
|
|
600
|
+
/** Combined white-label configuration. */
|
|
601
|
+
export interface WhiteLabelConfig {
|
|
602
|
+
readonly orgId: string;
|
|
603
|
+
readonly brand: BrandConfig;
|
|
604
|
+
readonly domain: DomainConfig;
|
|
605
|
+
readonly emailTemplate: EmailTemplateConfig;
|
|
606
|
+
readonly termsUrl: string;
|
|
607
|
+
readonly privacyUrl: string;
|
|
608
|
+
readonly isActive: boolean;
|
|
609
|
+
}
|
|
610
|
+
/** Error during white-label operations. */
|
|
611
|
+
export interface WhiteLabelError {
|
|
612
|
+
readonly code: 'INVALID_BRAND_CONFIG' | 'INVALID_DOMAIN' | 'DOMAIN_NOT_VERIFIED' | 'DNS_CHECK_FAILED' | 'TEMPLATE_INVALID' | 'CONFIG_NOT_FOUND';
|
|
613
|
+
readonly message: string;
|
|
614
|
+
}
|
|
615
|
+
/** User identity from SSO login. */
|
|
616
|
+
export interface SsoUserIdentity {
|
|
617
|
+
readonly email: string;
|
|
618
|
+
readonly name: string;
|
|
619
|
+
readonly picture: string;
|
|
620
|
+
readonly isAdmin: boolean;
|
|
621
|
+
}
|
|
622
|
+
/** Response from SSO callback after successful login. */
|
|
623
|
+
export interface SsoCallbackResponse {
|
|
624
|
+
readonly user: SsoUserIdentity;
|
|
625
|
+
readonly expiresAt: number;
|
|
626
|
+
}
|
|
627
|
+
/** Response from SSO session check. */
|
|
628
|
+
export interface SsoSessionResponse {
|
|
629
|
+
readonly authenticated: boolean;
|
|
630
|
+
readonly user: SsoUserIdentity | null;
|
|
631
|
+
readonly expiresAt: number | null;
|
|
632
|
+
}
|
|
633
|
+
/** Error during SSO operations. */
|
|
634
|
+
export interface SsoError {
|
|
635
|
+
readonly code: 'SSO_TOKEN_INVALID' | 'SSO_TOKEN_EXPIRED' | 'SSO_SESSION_INVALID' | 'SSO_SESSION_EXPIRED' | 'SSO_NOT_CONFIGURED' | 'SSO_EXCHANGE_FAILED' | 'SSO_COOKIE_INVALID';
|
|
636
|
+
readonly message: string;
|
|
637
|
+
}
|
|
638
|
+
/** SSO server configuration. */
|
|
639
|
+
export interface SsoServerConfig {
|
|
640
|
+
readonly googleClientId: string;
|
|
641
|
+
readonly googleClientSecret: string;
|
|
642
|
+
readonly sessionSecret: string;
|
|
643
|
+
readonly adminEmailHash: string | null;
|
|
644
|
+
readonly sessionTtlMs: number;
|
|
645
|
+
readonly entitlementJwtSecret?: string;
|
|
646
|
+
}
|
|
647
|
+
/** Request body for POST /oauth/:provider/token. */
|
|
648
|
+
export interface TokenExchangeRequest {
|
|
649
|
+
readonly code: string;
|
|
650
|
+
readonly code_verifier: string;
|
|
651
|
+
readonly redirect_uri: string;
|
|
652
|
+
readonly scope?: string;
|
|
653
|
+
}
|
|
654
|
+
/** Request body for POST /oauth/:provider/refresh. */
|
|
655
|
+
export interface TokenRefreshRequest {
|
|
656
|
+
readonly refresh_token: string;
|
|
657
|
+
}
|
|
658
|
+
/** Successful response from token exchange. */
|
|
659
|
+
export interface TokenExchangeResponse {
|
|
660
|
+
readonly access_token: string;
|
|
661
|
+
readonly refresh_token: string;
|
|
662
|
+
readonly expires_in: number;
|
|
663
|
+
readonly email: string;
|
|
664
|
+
readonly display_name?: string;
|
|
665
|
+
/** Space-separated list of scopes actually granted by the provider. */
|
|
666
|
+
readonly scope?: string;
|
|
667
|
+
}
|
|
668
|
+
/** Successful response from token refresh. */
|
|
669
|
+
export interface TokenRefreshResponse {
|
|
670
|
+
readonly access_token: string;
|
|
671
|
+
readonly refresh_token?: string;
|
|
672
|
+
readonly expires_in: number;
|
|
673
|
+
}
|
|
674
|
+
/** Invitation information for landing page. */
|
|
675
|
+
export interface InvitationInfo {
|
|
676
|
+
readonly token: string;
|
|
677
|
+
readonly senderName: string;
|
|
678
|
+
readonly senderEmail: string;
|
|
679
|
+
readonly createdAt: number;
|
|
680
|
+
readonly expiresAt: number;
|
|
681
|
+
}
|
|
682
|
+
/** Request body for POST /invite — create an invitation for a non-Xail recipient. */
|
|
683
|
+
export interface CreateInvitationRequest {
|
|
684
|
+
readonly senderName: string;
|
|
685
|
+
readonly senderEmail: string;
|
|
686
|
+
readonly recipientEmail: string;
|
|
687
|
+
}
|
|
688
|
+
/** Response from POST /invite. */
|
|
689
|
+
export interface CreateInvitationResponse {
|
|
690
|
+
readonly token: string;
|
|
691
|
+
readonly inviteUrl: string;
|
|
692
|
+
readonly expiresAt: number;
|
|
693
|
+
}
|
|
694
|
+
/** OAuth provider credentials (server-side only). */
|
|
695
|
+
export interface OAuthProviderCredentials {
|
|
696
|
+
readonly clientId: string;
|
|
697
|
+
readonly clientSecret: string;
|
|
698
|
+
readonly tokenUrl: string;
|
|
699
|
+
}
|
|
700
|
+
/** Stripe billing configuration (optional — billing disabled without it). */
|
|
701
|
+
export interface StripeConfig {
|
|
702
|
+
/** Stripe secret key (sk_live_... or sk_test_...). */
|
|
703
|
+
readonly secretKey: string;
|
|
704
|
+
/** Stripe webhook signing secret (whsec_...). */
|
|
705
|
+
readonly webhookSecret: string;
|
|
706
|
+
/** Stripe publishable key (pk_live_... or pk_test_...). */
|
|
707
|
+
readonly publishableKey: string;
|
|
708
|
+
}
|
|
709
|
+
/** Server configuration. */
|
|
710
|
+
export interface ServerConfig {
|
|
711
|
+
readonly port: number;
|
|
712
|
+
readonly allowedOrigins: readonly string[];
|
|
713
|
+
readonly providers: Readonly<Record<Provider, OAuthProviderCredentials>>;
|
|
714
|
+
readonly invitationBaseUrl: string;
|
|
715
|
+
readonly analyticsDir: string;
|
|
716
|
+
readonly sso: SsoServerConfig | null;
|
|
717
|
+
readonly aiTextApiKey: string | null;
|
|
718
|
+
readonly openaiApiKey: string | null;
|
|
719
|
+
readonly elevenlabsApiKey: string | null;
|
|
720
|
+
/** 64-char hex seed for VPS xBind agent identity (optional). */
|
|
721
|
+
readonly xbindVpsSeed: string | null;
|
|
722
|
+
/** DIDs granted admin access via xBind envelope auth (optional). */
|
|
723
|
+
readonly adminDids: readonly string[];
|
|
724
|
+
/** Stripe billing configuration (null if not configured). */
|
|
725
|
+
readonly stripe: StripeConfig | null;
|
|
726
|
+
}
|
|
727
|
+
/** Error during server operations. */
|
|
728
|
+
export interface ServerError {
|
|
729
|
+
readonly code: 'INVALID_PROVIDER' | 'INVALID_REQUEST' | 'TOKEN_EXCHANGE_FAILED' | 'TOKEN_REFRESH_FAILED' | 'INVITATION_NOT_FOUND' | 'INVITATION_EXPIRED' | 'INVITATION_CREATE_FAILED' | 'TOKEN_REVOCATION_FAILED' | 'RATE_LIMITED' | 'ANALYTICS_WRITE_FAILED' | 'SSO_NOT_CONFIGURED' | 'INTERNAL_ERROR';
|
|
730
|
+
readonly message: string;
|
|
731
|
+
}
|
|
732
|
+
/** Event types for anonymous usage analytics. */
|
|
733
|
+
export type AnalyticsEventType = 'account_created' | 'account_deleted' | 'channel_added' | 'channel_removed' | 'spam_blocked';
|
|
734
|
+
/** A recorded analytics event (no PII). */
|
|
735
|
+
export interface AnalyticsEvent {
|
|
736
|
+
readonly id: string;
|
|
737
|
+
readonly type: AnalyticsEventType;
|
|
738
|
+
readonly timestamp: number;
|
|
739
|
+
readonly provider: Provider | null;
|
|
740
|
+
readonly country: string;
|
|
741
|
+
readonly securityLevel: number;
|
|
742
|
+
}
|
|
743
|
+
/** Request body for POST /analytics/event. */
|
|
744
|
+
export interface AnalyticsEventRequest {
|
|
745
|
+
readonly type: AnalyticsEventType;
|
|
746
|
+
readonly provider?: string;
|
|
747
|
+
readonly securityLevel: number;
|
|
748
|
+
}
|
|
749
|
+
/** Filter criteria for querying analytics events. */
|
|
750
|
+
export interface AnalyticsEventFilter {
|
|
751
|
+
readonly type?: AnalyticsEventType;
|
|
752
|
+
readonly provider?: string;
|
|
753
|
+
readonly country?: string;
|
|
754
|
+
readonly securityLevel?: number;
|
|
755
|
+
readonly dateFrom?: number;
|
|
756
|
+
readonly dateTo?: number;
|
|
757
|
+
readonly limit?: number;
|
|
758
|
+
readonly offset?: number;
|
|
759
|
+
}
|
|
760
|
+
/** Paginated response from GET /analytics/events. */
|
|
761
|
+
export interface AnalyticsQueryResponse {
|
|
762
|
+
readonly events: readonly AnalyticsEvent[];
|
|
763
|
+
readonly total: number;
|
|
764
|
+
}
|
|
765
|
+
/** Request body for POST /oauth/:provider/revoke. */
|
|
766
|
+
export interface TokenRevocationRequest {
|
|
767
|
+
readonly token: string;
|
|
768
|
+
}
|
|
769
|
+
/** Thin account record stored on the server (hashed email, no PII). */
|
|
770
|
+
export interface AccountRecord {
|
|
771
|
+
readonly emailHash: string;
|
|
772
|
+
readonly channelCount: number;
|
|
773
|
+
readonly createdAt: number;
|
|
774
|
+
readonly lastLoginAt: number;
|
|
775
|
+
readonly preferencesHash: string;
|
|
776
|
+
readonly updatedAt: number;
|
|
777
|
+
/**
|
|
778
|
+
* Self-certification that the user's use of private.me is for internal
|
|
779
|
+
* operations only (not providing customer-facing functionality).
|
|
780
|
+
* Required for Commercial Use Boundary enforcement (ToS § 7).
|
|
781
|
+
*/
|
|
782
|
+
readonly commercialUseCertified: boolean;
|
|
783
|
+
}
|
|
784
|
+
/** Request body for POST /accounts. */
|
|
785
|
+
export interface CreateAccountRequest {
|
|
786
|
+
readonly emailHash: string;
|
|
787
|
+
readonly channelCount: number;
|
|
788
|
+
readonly preferencesHash: string;
|
|
789
|
+
/**
|
|
790
|
+
* Self-certification that the user's use of private.me is for internal
|
|
791
|
+
* operations only (not providing customer-facing functionality).
|
|
792
|
+
* Required for Commercial Use Boundary enforcement (ToS § 7).
|
|
793
|
+
*/
|
|
794
|
+
readonly commercialUseCertified: boolean;
|
|
795
|
+
}
|
|
796
|
+
/** Request body for PATCH /accounts/:hash. */
|
|
797
|
+
export interface UpdateAccountRequest {
|
|
798
|
+
readonly channelCount?: number;
|
|
799
|
+
readonly lastLoginAt?: number;
|
|
800
|
+
readonly preferencesHash?: string;
|
|
801
|
+
}
|
|
802
|
+
/** Error during account record operations. */
|
|
803
|
+
export interface AccountError {
|
|
804
|
+
readonly code: 'ACCOUNT_NOT_FOUND' | 'ACCOUNT_ALREADY_EXISTS' | 'INVALID_HASH' | 'ACCOUNT_WRITE_FAILED' | 'INVALID_REQUEST';
|
|
805
|
+
readonly message: string;
|
|
806
|
+
}
|
|
807
|
+
/** Encrypted sync profile for multi-device state restoration. */
|
|
808
|
+
export interface SyncProfile {
|
|
809
|
+
readonly emailHash: string;
|
|
810
|
+
readonly encryptedBlob: string;
|
|
811
|
+
readonly version: number;
|
|
812
|
+
readonly updatedAt: number;
|
|
813
|
+
readonly blobSizeBytes: number;
|
|
814
|
+
}
|
|
815
|
+
/** Request body for PUT /sync/profile. */
|
|
816
|
+
export interface SyncProfileUploadRequest {
|
|
817
|
+
readonly encryptedBlob: string;
|
|
818
|
+
readonly version: number;
|
|
819
|
+
}
|
|
820
|
+
/** Response from GET /sync/profile. */
|
|
821
|
+
export interface SyncProfileResponse {
|
|
822
|
+
readonly encryptedBlob: string;
|
|
823
|
+
readonly version: number;
|
|
824
|
+
readonly updatedAt: number;
|
|
825
|
+
readonly blobSizeBytes: number;
|
|
826
|
+
}
|
|
827
|
+
/** Request body for PUT /sync/contacts. */
|
|
828
|
+
export interface SyncContactsUploadRequest {
|
|
829
|
+
readonly encryptedBlob: string;
|
|
830
|
+
readonly version: number;
|
|
831
|
+
}
|
|
832
|
+
/** Response from GET /sync/contacts. */
|
|
833
|
+
export interface SyncContactsResponse {
|
|
834
|
+
readonly encryptedBlob: string;
|
|
835
|
+
readonly version: number;
|
|
836
|
+
readonly updatedAt: number;
|
|
837
|
+
readonly blobSizeBytes: number;
|
|
838
|
+
}
|
|
839
|
+
/** Error during sync operations. */
|
|
840
|
+
export interface SyncError {
|
|
841
|
+
readonly code: 'PROFILE_NOT_FOUND' | 'VERSION_CONFLICT' | 'BLOB_TOO_LARGE' | 'SYNC_WRITE_FAILED' | 'INVALID_REQUEST';
|
|
842
|
+
readonly message: string;
|
|
843
|
+
}
|
|
844
|
+
/** Response from GET /recovery/check/:emailHash. */
|
|
845
|
+
export interface RecoveryCheckResponse {
|
|
846
|
+
readonly exists: boolean;
|
|
847
|
+
readonly lastUpdated: number | null;
|
|
848
|
+
readonly version: number | null;
|
|
849
|
+
}
|
|
850
|
+
/** Configuration for the Corporate Xail Server (Express). */
|
|
851
|
+
export interface CorporateServerConfig {
|
|
852
|
+
readonly port: number;
|
|
853
|
+
readonly allowedOrigins: readonly string[];
|
|
854
|
+
readonly orgId: string;
|
|
855
|
+
readonly sessionSecret: string;
|
|
856
|
+
readonly adminEmails: readonly string[];
|
|
857
|
+
readonly dataDir: string;
|
|
858
|
+
}
|
|
859
|
+
/** Hosting mode for the corporate server. */
|
|
860
|
+
export type HostingMode = 'single-tenant' | 'multi-tenant';
|
|
861
|
+
/** Status of a tenant organization in managed hosting. */
|
|
862
|
+
export type TenantStatus = 'provisioning' | 'active' | 'suspended' | 'deactivated';
|
|
863
|
+
/** A tenant organization registered in the managed hosting registry. */
|
|
864
|
+
export interface TenantOrg {
|
|
865
|
+
readonly orgId: string;
|
|
866
|
+
readonly name: string;
|
|
867
|
+
readonly domain: string;
|
|
868
|
+
readonly status: TenantStatus;
|
|
869
|
+
readonly createdAt: number;
|
|
870
|
+
readonly updatedAt: number;
|
|
871
|
+
readonly maxUsers: number;
|
|
872
|
+
readonly contactEmail: string;
|
|
873
|
+
}
|
|
874
|
+
/** Request to provision a new tenant organization. */
|
|
875
|
+
export interface ProvisionTenantRequest {
|
|
876
|
+
readonly orgId: string;
|
|
877
|
+
readonly name: string;
|
|
878
|
+
readonly domain: string;
|
|
879
|
+
readonly contactEmail: string;
|
|
880
|
+
readonly maxUsers?: number;
|
|
881
|
+
readonly adminEmail: string;
|
|
882
|
+
readonly adminName: string;
|
|
883
|
+
}
|
|
884
|
+
/** Health metrics for a tenant organization. */
|
|
885
|
+
export interface TenantHealthMetrics {
|
|
886
|
+
readonly orgId: string;
|
|
887
|
+
readonly status: TenantStatus;
|
|
888
|
+
readonly userCount: number;
|
|
889
|
+
readonly complianceCopyCount: number;
|
|
890
|
+
readonly auditEntryCount: number;
|
|
891
|
+
readonly lastActivityAt: number | null;
|
|
892
|
+
}
|
|
893
|
+
/** Error codes for tenant operations. */
|
|
894
|
+
export interface TenantError {
|
|
895
|
+
readonly code: 'TENANT_NOT_FOUND' | 'TENANT_ALREADY_EXISTS' | 'TENANT_SUSPENDED' | 'TENANT_DEACTIVATED' | 'TENANT_LIMIT_REACHED' | 'UNAUTHORIZED_TENANT';
|
|
896
|
+
readonly message: string;
|
|
897
|
+
}
|
|
898
|
+
/** Configuration for managed (multi-tenant) corporate server. */
|
|
899
|
+
export interface ManagedServerConfig extends CorporateServerConfig {
|
|
900
|
+
readonly hostingMode: HostingMode;
|
|
901
|
+
readonly superAdminEmails: readonly string[];
|
|
902
|
+
readonly maxTenants?: number;
|
|
903
|
+
}
|
|
904
|
+
/** Status of a deferred share delivery. */
|
|
905
|
+
export type DeferredDeliveryStatus = 'pending' | 'delivered' | 'cancelled';
|
|
906
|
+
/** A share held for deferred delivery to a non-Xail recipient. */
|
|
907
|
+
export interface DeferredShare {
|
|
908
|
+
readonly uuid: string;
|
|
909
|
+
readonly recipientEmail: string;
|
|
910
|
+
readonly senderEmail: string;
|
|
911
|
+
readonly shareIndex: number;
|
|
912
|
+
readonly totalShares: number;
|
|
913
|
+
readonly threshold: number;
|
|
914
|
+
readonly encryptedShareData: Uint8Array;
|
|
915
|
+
readonly createdAt: number;
|
|
916
|
+
readonly expiresAt?: number;
|
|
917
|
+
readonly status: DeferredDeliveryStatus;
|
|
918
|
+
readonly deliveredAt?: number;
|
|
919
|
+
}
|
|
920
|
+
/** Content for the wrapper invitation email sent to non-Xail recipients. */
|
|
921
|
+
export interface WrapperEmailContent {
|
|
922
|
+
readonly to: string;
|
|
923
|
+
readonly subject: string;
|
|
924
|
+
readonly body: string;
|
|
925
|
+
readonly contentType: 'text/plain' | 'text/html';
|
|
926
|
+
readonly senderName: string;
|
|
927
|
+
readonly messageUuid: string;
|
|
928
|
+
}
|
|
929
|
+
/** Error during deferred delivery operations. */
|
|
930
|
+
export interface DeferredDeliveryError {
|
|
931
|
+
readonly code: 'RECIPIENT_NOT_REGISTERED' | 'SHARES_EXPIRED' | 'DELIVERY_FAILED' | 'STORAGE_ERROR' | 'ALREADY_DELIVERED' | 'INVALID_STATE';
|
|
932
|
+
readonly message: string;
|
|
933
|
+
}
|
|
934
|
+
/** Supported native app platforms. */
|
|
935
|
+
export type DevicePlatform = 'windows' | 'macos' | 'ios' | 'android';
|
|
936
|
+
/** A registered device for a user account. */
|
|
937
|
+
export interface DeviceRecord {
|
|
938
|
+
readonly id: string;
|
|
939
|
+
readonly emailHash: string;
|
|
940
|
+
readonly name: string;
|
|
941
|
+
readonly platform: DevicePlatform;
|
|
942
|
+
readonly appVersion: string;
|
|
943
|
+
readonly registeredAt: number;
|
|
944
|
+
readonly lastSeenAt: number;
|
|
945
|
+
}
|
|
946
|
+
/** Request body for POST /devices/register. */
|
|
947
|
+
export interface RegisterDeviceRequest {
|
|
948
|
+
readonly name: string;
|
|
949
|
+
readonly platform: DevicePlatform;
|
|
950
|
+
readonly appVersion: string;
|
|
951
|
+
}
|
|
952
|
+
/** Error during device operations. */
|
|
953
|
+
export interface DeviceError {
|
|
954
|
+
readonly code: 'DEVICE_NOT_FOUND' | 'DEVICE_LIMIT_REACHED' | 'DEVICE_WRITE_FAILED' | 'INVALID_REQUEST';
|
|
955
|
+
readonly message: string;
|
|
956
|
+
}
|
|
957
|
+
/** Subscription tier levels (server-side config, not hardcoded). */
|
|
958
|
+
export type SubscriptionTier = 'free' | 'base' | 'pro' | 'personal' | 'professional' | 'enterprise';
|
|
959
|
+
/** Stripe subscription lifecycle status. */
|
|
960
|
+
export type SubscriptionStatus = 'active' | 'past_due' | 'canceled' | 'unpaid' | 'trialing';
|
|
961
|
+
/** A persisted subscription record tied to a user's emailHash. */
|
|
962
|
+
export interface SubscriptionRecord {
|
|
963
|
+
readonly emailHash: string;
|
|
964
|
+
readonly stripeCustomerId: string;
|
|
965
|
+
readonly stripeSubscriptionId: string;
|
|
966
|
+
readonly tier: SubscriptionTier;
|
|
967
|
+
readonly status: SubscriptionStatus;
|
|
968
|
+
readonly currentPeriodEnd: number;
|
|
969
|
+
readonly createdAt: number;
|
|
970
|
+
readonly updatedAt: number;
|
|
971
|
+
}
|
|
972
|
+
/** Error during subscription operations. */
|
|
973
|
+
export interface SubscriptionError {
|
|
974
|
+
readonly code: 'SUBSCRIPTION_NOT_FOUND' | 'SUBSCRIPTION_WRITE_FAILED' | 'SUBSCRIPTION_ALREADY_EXISTS' | 'INVALID_HASH' | 'STRIPE_NOT_CONFIGURED' | 'STRIPE_ERROR' | 'STRIPE_WEBHOOK_INVALID';
|
|
975
|
+
readonly message: string;
|
|
976
|
+
}
|
|
977
|
+
/** Entitlement payload returned as a signed JWT. */
|
|
978
|
+
export interface EntitlementPayload {
|
|
979
|
+
readonly tier: SubscriptionTier;
|
|
980
|
+
readonly vipTier: 'vip1' | 'vip2' | 'vip3' | 'custom' | null;
|
|
981
|
+
readonly operationLimit: number;
|
|
982
|
+
readonly operationsUsed: number;
|
|
983
|
+
readonly operationsResetAt: number;
|
|
984
|
+
readonly expiresAt: number;
|
|
985
|
+
readonly deviceCount: number;
|
|
986
|
+
readonly deviceLimit: number;
|
|
987
|
+
readonly features: EntitlementFeatures;
|
|
988
|
+
}
|
|
989
|
+
/** Feature flags within an entitlement JWT. */
|
|
990
|
+
export interface EntitlementFeatures {
|
|
991
|
+
readonly secureMessaging: boolean;
|
|
992
|
+
readonly aiSearch: boolean;
|
|
993
|
+
readonly prioritySupport: boolean;
|
|
994
|
+
}
|
|
995
|
+
/** Tauri v2 updater platform target (arch-specific). */
|
|
996
|
+
export type TauriPlatformTarget = 'windows-x86_64' | 'darwin-x86_64' | 'darwin-aarch64' | 'linux-x86_64';
|
|
997
|
+
/** Tauri v2 platform-specific download entry. */
|
|
998
|
+
export interface TauriPlatformEntry {
|
|
999
|
+
readonly url: string;
|
|
1000
|
+
readonly signature: string;
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Tauri v2 updater manifest.
|
|
1004
|
+
*
|
|
1005
|
+
* Matches the format expected by `tauri-plugin-updater`:
|
|
1006
|
+
* https://v2.tauri.app/plugin/updater/
|
|
1007
|
+
*/
|
|
1008
|
+
export interface TauriUpdateManifest {
|
|
1009
|
+
readonly version: string;
|
|
1010
|
+
readonly notes: string;
|
|
1011
|
+
readonly pub_date: string;
|
|
1012
|
+
readonly platforms: Partial<Record<TauriPlatformTarget, TauriPlatformEntry>>;
|
|
1013
|
+
}
|
|
1014
|
+
/** Lifecycle status of an authentication challenge. */
|
|
1015
|
+
export type AuthChallengeStatus = 'pending' | 'approved' | 'denied' | 'expired' | 'consumed';
|
|
1016
|
+
/** A stored authentication challenge record. */
|
|
1017
|
+
export interface AuthChallenge {
|
|
1018
|
+
readonly id: string;
|
|
1019
|
+
readonly senderDid: string;
|
|
1020
|
+
readonly recipientDid: string;
|
|
1021
|
+
readonly action: string;
|
|
1022
|
+
readonly metadata: Readonly<Record<string, string>>;
|
|
1023
|
+
readonly createdAt: number;
|
|
1024
|
+
readonly expiresAt: number;
|
|
1025
|
+
readonly status: AuthChallengeStatus;
|
|
1026
|
+
readonly responseEnvelope?: Readonly<Record<string, unknown>>;
|
|
1027
|
+
readonly respondedAt?: number;
|
|
1028
|
+
}
|
|
1029
|
+
/** An incoming auth challenge pushed to the user's device. */
|
|
1030
|
+
export interface IncomingAuthChallenge {
|
|
1031
|
+
readonly challengeId: string;
|
|
1032
|
+
readonly fromDid: string;
|
|
1033
|
+
readonly fromName?: string;
|
|
1034
|
+
readonly action: string;
|
|
1035
|
+
readonly appName?: string;
|
|
1036
|
+
readonly appIcon?: string;
|
|
1037
|
+
readonly ip?: string;
|
|
1038
|
+
readonly location?: string;
|
|
1039
|
+
readonly expiresAt: number;
|
|
1040
|
+
}
|
|
1041
|
+
/** Metadata attached to an auth request for context display. */
|
|
1042
|
+
export interface AuthRequestMetadata {
|
|
1043
|
+
readonly ip?: string;
|
|
1044
|
+
readonly location?: string;
|
|
1045
|
+
readonly userAgent?: string;
|
|
1046
|
+
readonly appName?: string;
|
|
1047
|
+
readonly appIcon?: string;
|
|
1048
|
+
}
|
|
1049
|
+
/** Request to create an auth challenge via the gateway. */
|
|
1050
|
+
export interface AuthRequest {
|
|
1051
|
+
readonly to: string;
|
|
1052
|
+
readonly action: string;
|
|
1053
|
+
readonly metadata?: AuthRequestMetadata;
|
|
1054
|
+
readonly ttlMs?: number;
|
|
1055
|
+
readonly pollIntervalMs?: number;
|
|
1056
|
+
}
|
|
1057
|
+
/** Result of a completed auth challenge. */
|
|
1058
|
+
export interface AuthResult {
|
|
1059
|
+
readonly challengeId: string;
|
|
1060
|
+
readonly approved: boolean;
|
|
1061
|
+
readonly signature?: string;
|
|
1062
|
+
readonly envelope?: Readonly<Record<string, unknown>>;
|
|
1063
|
+
readonly respondedAt?: number;
|
|
1064
|
+
}
|
|
1065
|
+
/** Error codes for auth challenge operations. */
|
|
1066
|
+
export type AuthChallengeErrorCode = 'INVALID_REQUEST' | 'INVALID_SIGNATURE' | 'SCOPE_DENIED' | 'RECIPIENT_NOT_FOUND' | 'RATE_LIMITED' | 'CHALLENGE_NOT_FOUND' | 'CHALLENGE_EXPIRED' | 'CHALLENGE_DENIED' | 'CHALLENGE_TIMEOUT' | 'ALREADY_RESPONDED' | 'WRONG_RECIPIENT' | 'STORE_ERROR';
|
|
1067
|
+
/** Error during auth challenge operations. */
|
|
1068
|
+
export interface AuthChallengeError {
|
|
1069
|
+
readonly code: AuthChallengeErrorCode;
|
|
1070
|
+
readonly message: string;
|
|
1071
|
+
}
|
|
1072
|
+
/** JSONL operation types for challenge store replay. */
|
|
1073
|
+
export type ChallengeStoreOp = 'create' | 'respond' | 'consume' | 'expire';
|
|
1074
|
+
/** A JSONL log entry for the challenge store. */
|
|
1075
|
+
export interface ChallengeStoreEntry {
|
|
1076
|
+
readonly op: ChallengeStoreOp;
|
|
1077
|
+
readonly record: AuthChallenge;
|
|
1078
|
+
}
|
|
1079
|
+
/** Response from POST /gateway/auth/challenge. */
|
|
1080
|
+
export interface CreateChallengeResponse {
|
|
1081
|
+
readonly challengeId: string;
|
|
1082
|
+
readonly expiresAt: number;
|
|
1083
|
+
readonly pushed: boolean;
|
|
1084
|
+
}
|
|
1085
|
+
/** Response from POST /gateway/auth/respond. */
|
|
1086
|
+
export interface RespondChallengeResponse {
|
|
1087
|
+
readonly recorded: true;
|
|
1088
|
+
}
|
|
1089
|
+
/** Response from GET /gateway/auth/status/:challengeId. */
|
|
1090
|
+
export interface ChallengeStatusResponse {
|
|
1091
|
+
readonly challengeId: string;
|
|
1092
|
+
readonly status: AuthChallengeStatus;
|
|
1093
|
+
readonly expiresAt: number;
|
|
1094
|
+
readonly respondedAt?: number;
|
|
1095
|
+
readonly envelope?: Readonly<Record<string, unknown>>;
|
|
1096
|
+
}
|
|
1097
|
+
//# sourceMappingURL=types.d.ts.map
|