@sparkvault/sdk-js 1.24.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +769 -0
- package/dist/api-base.d.ts +58 -0
- package/dist/auto-init.d.ts +32 -0
- package/dist/config.d.ts +41 -0
- package/dist/errors.d.ts +30 -0
- package/dist/health.d.ts +18 -0
- package/dist/http.d.ts +51 -0
- package/dist/identity/api.d.ts +110 -0
- package/dist/identity/container.d.ts +56 -0
- package/dist/identity/handlers/index.d.ts +9 -0
- package/dist/identity/handlers/passkey-handler.d.ts +69 -0
- package/dist/identity/handlers/sparklink-handler.d.ts +30 -0
- package/dist/identity/handlers/totp-handler.d.ts +52 -0
- package/dist/identity/index.d.ts +89 -0
- package/dist/identity/inline-container.d.ts +65 -0
- package/dist/identity/methods.d.ts +23 -0
- package/dist/identity/modal.d.ts +82 -0
- package/dist/identity/renderer.d.ts +146 -0
- package/dist/identity/state.d.ts +98 -0
- package/dist/identity/styles.d.ts +22 -0
- package/dist/identity/types.d.ts +221 -0
- package/dist/identity/utils/cooldown-timer.d.ts +73 -0
- package/dist/identity/utils/index.d.ts +5 -0
- package/dist/identity/utils.d.ts +39 -0
- package/dist/identity/views/app-not-activated.d.ts +21 -0
- package/dist/identity/views/base.d.ts +62 -0
- package/dist/identity/views/error.d.ts +25 -0
- package/dist/identity/views/icons.d.ts +38 -0
- package/dist/identity/views/identity-input.d.ts +48 -0
- package/dist/identity/views/index.d.ts +16 -0
- package/dist/identity/views/loading.d.ts +15 -0
- package/dist/identity/views/method-select.d.ts +29 -0
- package/dist/identity/views/passkey-prompt.d.ts +24 -0
- package/dist/identity/views/passkey.d.ts +38 -0
- package/dist/identity/views/service-unavailable.d.ts +21 -0
- package/dist/identity/views/sparklink-waiting.d.ts +40 -0
- package/dist/identity/views/totp-verify.d.ts +58 -0
- package/dist/index.d.ts +733 -0
- package/dist/logger.d.ts +45 -0
- package/dist/rng/index.d.ts +54 -0
- package/dist/rng/types.d.ts +26 -0
- package/dist/sparks/index.d.ts +37 -0
- package/dist/sparks/types.d.ts +56 -0
- package/dist/sparkvault.cjs.js +10167 -0
- package/dist/sparkvault.cjs.js.map +1 -0
- package/dist/sparkvault.esm.js +10152 -0
- package/dist/sparkvault.esm.js.map +1 -0
- package/dist/sparkvault.js +2 -0
- package/dist/sparkvault.js.map +1 -0
- package/dist/utils/base64url.d.ts +41 -0
- package/dist/utils/dom.d.ts +17 -0
- package/dist/utils/retry.d.ts +32 -0
- package/dist/vaults/index.d.ts +109 -0
- package/dist/vaults/types.d.ts +128 -0
- package/dist/vaults/upload/api.d.ts +36 -0
- package/dist/vaults/upload/container.d.ts +57 -0
- package/dist/vaults/upload/index.d.ts +75 -0
- package/dist/vaults/upload/inline-container.d.ts +75 -0
- package/dist/vaults/upload/modal.d.ts +79 -0
- package/dist/vaults/upload/renderer.d.ts +70 -0
- package/dist/vaults/upload/styles.d.ts +20 -0
- package/dist/vaults/upload/types.d.ts +182 -0
- package/package.json +63 -0
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vault Upload Module Types
|
|
3
|
+
*
|
|
4
|
+
* Types for the embedded vault upload widget.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Branding configuration from vault upload info.
|
|
8
|
+
*/
|
|
9
|
+
export interface UploadBranding {
|
|
10
|
+
/** Organization name */
|
|
11
|
+
organizationName: string;
|
|
12
|
+
/** Light theme logo URL */
|
|
13
|
+
logoLightUrl: string | null;
|
|
14
|
+
/** Dark theme logo URL */
|
|
15
|
+
logoDarkUrl: string | null;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Encryption information for the vault.
|
|
19
|
+
*/
|
|
20
|
+
export interface EncryptionInfo {
|
|
21
|
+
/** Encryption algorithm (e.g., 'AES-256-GCM') */
|
|
22
|
+
algorithm: string;
|
|
23
|
+
/** Key derivation method (e.g., 'Triple Zero-Trust') */
|
|
24
|
+
keyDerivation: string;
|
|
25
|
+
/** Post-quantum protection status */
|
|
26
|
+
postQuantum: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Vault upload configuration from API.
|
|
30
|
+
*/
|
|
31
|
+
export interface VaultUploadConfig {
|
|
32
|
+
/** Vault ID */
|
|
33
|
+
vaultId: string;
|
|
34
|
+
/** Vault name */
|
|
35
|
+
vaultName: string;
|
|
36
|
+
/** Maximum upload size in bytes */
|
|
37
|
+
maxSizeBytes: number;
|
|
38
|
+
/** Branding information */
|
|
39
|
+
branding: UploadBranding;
|
|
40
|
+
/** Encryption details */
|
|
41
|
+
encryption: EncryptionInfo;
|
|
42
|
+
/** Forge status */
|
|
43
|
+
forgeStatus: 'active' | 'inactive';
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Options for upload().
|
|
47
|
+
* - Without `target`: Opens a dialog (modal)
|
|
48
|
+
* - With `target`: Renders inline into the specified element
|
|
49
|
+
*/
|
|
50
|
+
export interface UploadOptions {
|
|
51
|
+
/** Vault ID to upload to */
|
|
52
|
+
vaultId: string;
|
|
53
|
+
/**
|
|
54
|
+
* Target element for inline rendering. Can be:
|
|
55
|
+
* - A CSS selector string (e.g., "#upload-container")
|
|
56
|
+
* - An HTMLElement reference
|
|
57
|
+
* - Omitted for dialog mode (default)
|
|
58
|
+
*/
|
|
59
|
+
target?: string | HTMLElement;
|
|
60
|
+
/** Override backdrop blur for this dialog (uses global config if omitted) */
|
|
61
|
+
backdropBlur?: boolean;
|
|
62
|
+
/** Hide "Upload Another File" button on success screen (for single-file flows) */
|
|
63
|
+
hideUploadAnother?: boolean;
|
|
64
|
+
/** Callback when upload completes successfully (if omitted, uses server-configured redirect) */
|
|
65
|
+
onSuccess?: (result: UploadResult) => void;
|
|
66
|
+
/** Callback when an error occurs (if omitted, uses server-configured redirect) */
|
|
67
|
+
onError?: (error: Error) => void;
|
|
68
|
+
/** Callback when user cancels (if omitted, uses server-configured redirect) */
|
|
69
|
+
onCancel?: () => void;
|
|
70
|
+
/** Callback for upload progress */
|
|
71
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
72
|
+
}
|
|
73
|
+
/** Options for attach() - binds upload to element clicks */
|
|
74
|
+
export interface UploadAttachOptions {
|
|
75
|
+
/** Vault ID to upload to */
|
|
76
|
+
vaultId: string;
|
|
77
|
+
/** Callback when upload completes successfully */
|
|
78
|
+
onSuccess?: (result: UploadResult) => void;
|
|
79
|
+
/** Callback when an error occurs */
|
|
80
|
+
onError?: (error: Error) => void;
|
|
81
|
+
/** Callback when user cancels */
|
|
82
|
+
onCancel?: () => void;
|
|
83
|
+
/** Callback for upload progress */
|
|
84
|
+
onProgress?: (progress: UploadProgress) => void;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Upload progress information.
|
|
88
|
+
*/
|
|
89
|
+
export interface UploadProgress {
|
|
90
|
+
/** Bytes uploaded */
|
|
91
|
+
bytesUploaded: number;
|
|
92
|
+
/** Total bytes */
|
|
93
|
+
bytesTotal: number;
|
|
94
|
+
/** Percentage (0-100) */
|
|
95
|
+
percentage: number;
|
|
96
|
+
/** Current phase */
|
|
97
|
+
phase: 'uploading' | 'ceremony' | 'complete';
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Successful upload result.
|
|
101
|
+
*/
|
|
102
|
+
export interface UploadResult {
|
|
103
|
+
/** Ingot ID */
|
|
104
|
+
ingotId: string;
|
|
105
|
+
/** Vault ID */
|
|
106
|
+
vaultId: string;
|
|
107
|
+
/** Original filename */
|
|
108
|
+
filename: string;
|
|
109
|
+
/** File size in bytes */
|
|
110
|
+
sizeBytes: number;
|
|
111
|
+
/** Upload timestamp (ISO 8601) */
|
|
112
|
+
uploadTime: string;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Upload view states.
|
|
116
|
+
*/
|
|
117
|
+
export type UploadViewState = {
|
|
118
|
+
view: 'loading';
|
|
119
|
+
} | {
|
|
120
|
+
view: 'form';
|
|
121
|
+
config: VaultUploadConfig;
|
|
122
|
+
error?: string;
|
|
123
|
+
} | {
|
|
124
|
+
view: 'uploading';
|
|
125
|
+
file: File;
|
|
126
|
+
ingotId: string;
|
|
127
|
+
requestId: string;
|
|
128
|
+
progress: number;
|
|
129
|
+
bytesUploaded: number;
|
|
130
|
+
} | {
|
|
131
|
+
view: 'ceremony';
|
|
132
|
+
file: File;
|
|
133
|
+
ingotId: string;
|
|
134
|
+
requestId: string;
|
|
135
|
+
step: number;
|
|
136
|
+
complete: boolean;
|
|
137
|
+
} | {
|
|
138
|
+
view: 'complete';
|
|
139
|
+
result: UploadResult;
|
|
140
|
+
config: VaultUploadConfig;
|
|
141
|
+
} | {
|
|
142
|
+
view: 'error';
|
|
143
|
+
title: string;
|
|
144
|
+
message: string;
|
|
145
|
+
code: string;
|
|
146
|
+
statusCode?: number;
|
|
147
|
+
};
|
|
148
|
+
/**
|
|
149
|
+
* API response for vault upload info.
|
|
150
|
+
*/
|
|
151
|
+
export interface VaultUploadInfoResponse {
|
|
152
|
+
vault_id: string;
|
|
153
|
+
vault_name: string;
|
|
154
|
+
max_size_bytes: number;
|
|
155
|
+
branding: {
|
|
156
|
+
organization_name: string;
|
|
157
|
+
logo_light_url: string | null;
|
|
158
|
+
logo_dark_url: string | null;
|
|
159
|
+
};
|
|
160
|
+
encryption: {
|
|
161
|
+
algorithm: string;
|
|
162
|
+
key_derivation: string;
|
|
163
|
+
post_quantum: string;
|
|
164
|
+
};
|
|
165
|
+
forge_status: 'active' | 'inactive';
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* API response for initiating upload.
|
|
169
|
+
*/
|
|
170
|
+
export interface InitiateUploadResponse {
|
|
171
|
+
forge_url: string;
|
|
172
|
+
ingot_id: string;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Ceremony step definition.
|
|
176
|
+
*/
|
|
177
|
+
export interface CeremonyStep {
|
|
178
|
+
/** Display text */
|
|
179
|
+
text: string;
|
|
180
|
+
/** Duration in milliseconds */
|
|
181
|
+
duration: number;
|
|
182
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sparkvault/sdk-js",
|
|
3
|
+
"version": "1.24.4",
|
|
4
|
+
"description": "SparkVault JavaScript SDK - Identity Verification and Encrypted Vaults",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/sparkvault.cjs.js",
|
|
7
|
+
"module": "dist/sparkvault.esm.js",
|
|
8
|
+
"browser": "dist/sparkvault.js",
|
|
9
|
+
"types": "dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist"
|
|
12
|
+
],
|
|
13
|
+
"scripts": {
|
|
14
|
+
"build": "rollup -c",
|
|
15
|
+
"build:watch": "rollup -c -w",
|
|
16
|
+
"typecheck": "tsc --noEmit",
|
|
17
|
+
"lint": "eslint src --ext .ts",
|
|
18
|
+
"test": "vitest run",
|
|
19
|
+
"test:watch": "vitest"
|
|
20
|
+
},
|
|
21
|
+
"keywords": [
|
|
22
|
+
"sparkvault",
|
|
23
|
+
"identity",
|
|
24
|
+
"authentication",
|
|
25
|
+
"encryption",
|
|
26
|
+
"cryptography",
|
|
27
|
+
"passkey",
|
|
28
|
+
"webauthn",
|
|
29
|
+
"totp",
|
|
30
|
+
"vault"
|
|
31
|
+
],
|
|
32
|
+
"author": "SparkVault",
|
|
33
|
+
"license": "MIT",
|
|
34
|
+
"repository": {
|
|
35
|
+
"type": "git",
|
|
36
|
+
"url": "git+https://github.com/Spark-Vault/platform.git",
|
|
37
|
+
"directory": "packages/sdk-js"
|
|
38
|
+
},
|
|
39
|
+
"homepage": "https://sparkvault.com/api/docs/sdk",
|
|
40
|
+
"devDependencies": {
|
|
41
|
+
"@eslint/js": "^9.0.0",
|
|
42
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
43
|
+
"@rollup/plugin-node-resolve": "^16.0.0",
|
|
44
|
+
"@rollup/plugin-terser": "^0.4.4",
|
|
45
|
+
"@rollup/plugin-typescript": "^12.1.0",
|
|
46
|
+
"@types/node": "^22.0.0",
|
|
47
|
+
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
48
|
+
"@typescript-eslint/parser": "^8.0.0",
|
|
49
|
+
"eslint": "^9.0.0",
|
|
50
|
+
"jsdom": "^25.0.0",
|
|
51
|
+
"rollup": "^4.0.0",
|
|
52
|
+
"rollup-plugin-dts": "^6.0.0",
|
|
53
|
+
"tslib": "^2.8.0",
|
|
54
|
+
"typescript": "^5.7.0",
|
|
55
|
+
"vitest": "^3.0.0"
|
|
56
|
+
},
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=18.0.0"
|
|
59
|
+
},
|
|
60
|
+
"publishConfig": {
|
|
61
|
+
"access": "public"
|
|
62
|
+
}
|
|
63
|
+
}
|