@omnituum/pqc-shared 0.2.6
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/LICENSE +22 -0
- package/README.md +543 -0
- package/dist/crypto/index.cjs +807 -0
- package/dist/crypto/index.d.cts +641 -0
- package/dist/crypto/index.d.ts +641 -0
- package/dist/crypto/index.js +716 -0
- package/dist/decrypt-eSHlbh1j.d.cts +321 -0
- package/dist/decrypt-eSHlbh1j.d.ts +321 -0
- package/dist/fs/index.cjs +1168 -0
- package/dist/fs/index.d.cts +400 -0
- package/dist/fs/index.d.ts +400 -0
- package/dist/fs/index.js +1091 -0
- package/dist/index.cjs +2160 -0
- package/dist/index.d.cts +282 -0
- package/dist/index.d.ts +282 -0
- package/dist/index.js +2031 -0
- package/dist/integrity-CCYjrap3.d.ts +31 -0
- package/dist/integrity-Dx9jukMH.d.cts +31 -0
- package/dist/types-61c7Q9ri.d.ts +134 -0
- package/dist/types-Ch0y-n7K.d.cts +134 -0
- package/dist/utils/index.cjs +129 -0
- package/dist/utils/index.d.cts +49 -0
- package/dist/utils/index.d.ts +49 -0
- package/dist/utils/index.js +114 -0
- package/dist/vault/index.cjs +713 -0
- package/dist/vault/index.d.cts +237 -0
- package/dist/vault/index.d.ts +237 -0
- package/dist/vault/index.js +677 -0
- package/dist/version-BygzPVGs.d.cts +55 -0
- package/dist/version-BygzPVGs.d.ts +55 -0
- package/package.json +86 -0
- package/src/crypto/dilithium.ts +233 -0
- package/src/crypto/hybrid.ts +358 -0
- package/src/crypto/index.ts +181 -0
- package/src/crypto/kyber.ts +199 -0
- package/src/crypto/nacl.ts +204 -0
- package/src/crypto/primitives/blake3.ts +141 -0
- package/src/crypto/primitives/chacha.ts +211 -0
- package/src/crypto/primitives/hkdf.ts +192 -0
- package/src/crypto/primitives/index.ts +54 -0
- package/src/crypto/primitives.ts +144 -0
- package/src/crypto/x25519.ts +134 -0
- package/src/fs/aes.ts +343 -0
- package/src/fs/argon2.ts +184 -0
- package/src/fs/browser.ts +408 -0
- package/src/fs/decrypt.ts +320 -0
- package/src/fs/encrypt.ts +324 -0
- package/src/fs/format.ts +425 -0
- package/src/fs/index.ts +144 -0
- package/src/fs/types.ts +304 -0
- package/src/index.ts +414 -0
- package/src/kdf/index.ts +311 -0
- package/src/runtime/crypto.ts +16 -0
- package/src/security/index.ts +345 -0
- package/src/tunnel/index.ts +39 -0
- package/src/tunnel/session.ts +229 -0
- package/src/tunnel/types.ts +115 -0
- package/src/utils/entropy.ts +128 -0
- package/src/utils/index.ts +25 -0
- package/src/utils/integrity.ts +95 -0
- package/src/vault/decrypt.ts +167 -0
- package/src/vault/encrypt.ts +207 -0
- package/src/vault/index.ts +71 -0
- package/src/vault/manager.ts +327 -0
- package/src/vault/migrate.ts +190 -0
- package/src/vault/types.ts +177 -0
- package/src/version.ts +304 -0
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { O as OmnituumVault, E as EncryptedVaultFile, a as EncryptedVaultFileV2, H as HybridIdentityRecord, V as VaultSettings, b as VaultSession } from '../types-Ch0y-n7K.cjs';
|
|
2
|
+
export { D as DEFAULT_VAULT_SETTINGS, c as EncryptedVaultFileV1, d as HealthStatus, I as IdentityHealth, P as PBKDF2_ITERATIONS } from '../types-Ch0y-n7K.cjs';
|
|
3
|
+
import '../version-BygzPVGs.cjs';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Omnituum PQC Shared - Vault Encryption
|
|
7
|
+
*
|
|
8
|
+
* Password-based encryption using PBKDF2 or Argon2id + AES-256-GCM.
|
|
9
|
+
* All operations use the Web Crypto API for browser compatibility.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Derive an AES-256 key from a password using PBKDF2-SHA256.
|
|
14
|
+
*
|
|
15
|
+
* @param password - User password
|
|
16
|
+
* @param salt - 32-byte salt
|
|
17
|
+
* @param iterations - PBKDF2 iterations (default: 600,000)
|
|
18
|
+
* @returns CryptoKey for AES-GCM
|
|
19
|
+
*/
|
|
20
|
+
declare function deriveKey(password: string, salt: Uint8Array, iterations?: number): Promise<CryptoKey>;
|
|
21
|
+
/**
|
|
22
|
+
* Encrypt a vault with a password.
|
|
23
|
+
*
|
|
24
|
+
* Uses PBKDF2-SHA256 for key derivation and AES-256-GCM for encryption.
|
|
25
|
+
* The salt and IV are randomly generated and included in the output.
|
|
26
|
+
*
|
|
27
|
+
* @param vault - Vault to encrypt
|
|
28
|
+
* @param password - User password
|
|
29
|
+
* @returns Encrypted vault file structure
|
|
30
|
+
*/
|
|
31
|
+
declare function encryptVault(vault: OmnituumVault, password: string): Promise<EncryptedVaultFile>;
|
|
32
|
+
/**
|
|
33
|
+
* Encrypt vault to a downloadable blob.
|
|
34
|
+
*
|
|
35
|
+
* @param vault - Vault to encrypt
|
|
36
|
+
* @param password - User password
|
|
37
|
+
* @returns Blob for download
|
|
38
|
+
*/
|
|
39
|
+
declare function encryptVaultToBlob(vault: OmnituumVault, password: string): Promise<Blob>;
|
|
40
|
+
/**
|
|
41
|
+
* Encrypt vault to a data URL for download.
|
|
42
|
+
*
|
|
43
|
+
* @param vault - Vault to encrypt
|
|
44
|
+
* @param password - User password
|
|
45
|
+
* @returns Data URL
|
|
46
|
+
*/
|
|
47
|
+
declare function encryptVaultToDataURL(vault: OmnituumVault, password: string): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Encrypt a vault with a password using Argon2id (v2 format).
|
|
50
|
+
*
|
|
51
|
+
* Uses Argon2id for key derivation (64MB memory, 3 iterations) and AES-256-GCM.
|
|
52
|
+
* This is the recommended format for new vaults.
|
|
53
|
+
*
|
|
54
|
+
* @param vault - Vault to encrypt
|
|
55
|
+
* @param password - User password
|
|
56
|
+
* @returns Encrypted vault file structure (v2)
|
|
57
|
+
*/
|
|
58
|
+
declare function encryptVaultV2(vault: OmnituumVault, password: string): Promise<EncryptedVaultFileV2>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Omnituum PQC Shared - Vault Decryption
|
|
62
|
+
*
|
|
63
|
+
* Password-based decryption using PBKDF2 or Argon2id + AES-256-GCM.
|
|
64
|
+
* Includes integrity verification.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Decrypt an encrypted vault file with a password.
|
|
69
|
+
* Supports both v1 (PBKDF2) and v2 (Argon2id) formats.
|
|
70
|
+
*
|
|
71
|
+
* @param encryptedFile - Encrypted vault file structure
|
|
72
|
+
* @param password - User password
|
|
73
|
+
* @returns Decrypted vault
|
|
74
|
+
* @throws Error if decryption fails (wrong password or corrupted data)
|
|
75
|
+
*/
|
|
76
|
+
declare function decryptVault(encryptedFile: EncryptedVaultFile, password: string): Promise<OmnituumVault>;
|
|
77
|
+
/**
|
|
78
|
+
* Decrypt a vault from a JSON string.
|
|
79
|
+
*
|
|
80
|
+
* @param json - Encrypted vault JSON string
|
|
81
|
+
* @param password - User password
|
|
82
|
+
* @returns Decrypted vault
|
|
83
|
+
*/
|
|
84
|
+
declare function decryptVaultFromJson(json: string, password: string): Promise<OmnituumVault>;
|
|
85
|
+
/**
|
|
86
|
+
* Decrypt a vault from a File object.
|
|
87
|
+
*
|
|
88
|
+
* @param file - File object (from file input)
|
|
89
|
+
* @param password - User password
|
|
90
|
+
* @returns Decrypted vault
|
|
91
|
+
*/
|
|
92
|
+
declare function decryptVaultFromFile(file: File, password: string): Promise<OmnituumVault>;
|
|
93
|
+
/**
|
|
94
|
+
* Validate an encrypted vault file without decrypting.
|
|
95
|
+
*
|
|
96
|
+
* @param json - JSON string to validate
|
|
97
|
+
* @returns true if valid encrypted vault file structure
|
|
98
|
+
*/
|
|
99
|
+
declare function isValidEncryptedVaultFile(json: string): boolean;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Omnituum PQC Shared - Vault Manager
|
|
103
|
+
*
|
|
104
|
+
* High-level operations for managing the PQC identity vault.
|
|
105
|
+
* Handles identity creation, rotation, import/export, and session management.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Create a new empty vault.
|
|
110
|
+
*/
|
|
111
|
+
declare function createEmptyVault(): OmnituumVault;
|
|
112
|
+
/**
|
|
113
|
+
* Create a new hybrid identity.
|
|
114
|
+
*/
|
|
115
|
+
declare function createIdentity(name: string): Promise<HybridIdentityRecord | null>;
|
|
116
|
+
/**
|
|
117
|
+
* Add an identity to the vault.
|
|
118
|
+
*/
|
|
119
|
+
declare function addIdentity(vault: OmnituumVault, identity: HybridIdentityRecord): OmnituumVault;
|
|
120
|
+
/**
|
|
121
|
+
* Remove an identity from the vault.
|
|
122
|
+
*/
|
|
123
|
+
declare function removeIdentity(vault: OmnituumVault, identityId: string): OmnituumVault;
|
|
124
|
+
/**
|
|
125
|
+
* Rotate keys for an identity (regenerate Kyber + X25519).
|
|
126
|
+
*/
|
|
127
|
+
declare function rotateIdentityKeys(vault: OmnituumVault, identityId: string): Promise<OmnituumVault | null>;
|
|
128
|
+
/**
|
|
129
|
+
* Update identity metadata.
|
|
130
|
+
*/
|
|
131
|
+
declare function updateIdentityMetadata(vault: OmnituumVault, identityId: string, updates: Partial<Pick<HybridIdentityRecord, 'name' | 'metadata'>>): OmnituumVault;
|
|
132
|
+
/**
|
|
133
|
+
* Update vault settings.
|
|
134
|
+
*/
|
|
135
|
+
declare function updateSettings(vault: OmnituumVault, settings: Partial<VaultSettings>): OmnituumVault;
|
|
136
|
+
/**
|
|
137
|
+
* Set the active identity.
|
|
138
|
+
*/
|
|
139
|
+
declare function setActiveIdentity(vault: OmnituumVault, identityId: string): OmnituumVault;
|
|
140
|
+
/**
|
|
141
|
+
* Export vault to encrypted file.
|
|
142
|
+
*/
|
|
143
|
+
declare function exportVault(vault: OmnituumVault, password: string): Promise<Blob>;
|
|
144
|
+
/**
|
|
145
|
+
* Import vault from encrypted file.
|
|
146
|
+
*/
|
|
147
|
+
declare function importVault(file: File, password: string): Promise<OmnituumVault>;
|
|
148
|
+
/**
|
|
149
|
+
* Trigger download of encrypted vault.
|
|
150
|
+
*/
|
|
151
|
+
declare function downloadVault(vault: OmnituumVault, password: string): Promise<void>;
|
|
152
|
+
/**
|
|
153
|
+
* Get current session state.
|
|
154
|
+
*/
|
|
155
|
+
declare function getSession(): VaultSession;
|
|
156
|
+
/**
|
|
157
|
+
* Unlock vault and store session key in memory.
|
|
158
|
+
*/
|
|
159
|
+
declare function unlockSession(password: string, vault: OmnituumVault): Promise<boolean>;
|
|
160
|
+
/**
|
|
161
|
+
* Lock the session.
|
|
162
|
+
*/
|
|
163
|
+
declare function lockSession(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Set active identity in session.
|
|
166
|
+
*/
|
|
167
|
+
declare function setSessionActiveIdentity(identityId: string): void;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Omnituum PQC Shared - Vault Migration
|
|
171
|
+
*
|
|
172
|
+
* One-way migration from v1 (PBKDF2) to v2 (Argon2id) encrypted vaults.
|
|
173
|
+
* Includes memory hygiene for sensitive data.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
interface MigrationOptions {
|
|
177
|
+
/** Source encrypted vault */
|
|
178
|
+
encryptedVault: EncryptedVaultFile;
|
|
179
|
+
/** Vault password */
|
|
180
|
+
password: string;
|
|
181
|
+
/** Keep backup of original vault data (default: false) */
|
|
182
|
+
keepBackup?: boolean;
|
|
183
|
+
}
|
|
184
|
+
interface MigrationResult {
|
|
185
|
+
/** New v2 encrypted vault */
|
|
186
|
+
encryptedVault: EncryptedVaultFileV2;
|
|
187
|
+
/** Original vault (only if keepBackup was true) */
|
|
188
|
+
backup?: EncryptedVaultFile;
|
|
189
|
+
/** Source version */
|
|
190
|
+
sourceVersion: string;
|
|
191
|
+
/** Target version */
|
|
192
|
+
targetVersion: string;
|
|
193
|
+
/** Migration timestamp */
|
|
194
|
+
migratedAt: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Check if vault needs migration (is v1 format).
|
|
198
|
+
*/
|
|
199
|
+
declare function needsMigration(encryptedVault: EncryptedVaultFile): boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Check if vault is already v2 format.
|
|
202
|
+
*/
|
|
203
|
+
declare function isV2Vault(encryptedVault: EncryptedVaultFile): boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Get vault KDF info for display.
|
|
206
|
+
*/
|
|
207
|
+
declare function getVaultKdfInfo(encryptedVault: EncryptedVaultFile): {
|
|
208
|
+
kdf: string;
|
|
209
|
+
version: string;
|
|
210
|
+
isSecure: boolean;
|
|
211
|
+
recommendation?: string;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Migrate an encrypted vault from v1 (PBKDF2) to v2 (Argon2id).
|
|
215
|
+
*
|
|
216
|
+
* This is a ONE-WAY migration. The original vault remains unchanged,
|
|
217
|
+
* but a new v2 encrypted vault is returned.
|
|
218
|
+
*
|
|
219
|
+
* Memory hygiene: Sensitive data (decrypted vault) is zeroed after use.
|
|
220
|
+
*
|
|
221
|
+
* @param options - Migration options
|
|
222
|
+
* @returns Migration result with new v2 vault
|
|
223
|
+
* @throws Error if decryption fails or vault is already v2
|
|
224
|
+
*/
|
|
225
|
+
declare function migrateEncryptedVault(options: MigrationOptions): Promise<MigrationResult>;
|
|
226
|
+
/**
|
|
227
|
+
* Validate migration by decrypting both versions and comparing.
|
|
228
|
+
* Used for testing migration integrity.
|
|
229
|
+
*
|
|
230
|
+
* @param original - Original encrypted vault
|
|
231
|
+
* @param migrated - Migrated encrypted vault
|
|
232
|
+
* @param password - Vault password
|
|
233
|
+
* @returns true if vaults contain identical data
|
|
234
|
+
*/
|
|
235
|
+
declare function validateMigration(original: EncryptedVaultFile, migrated: EncryptedVaultFileV2, password: string): Promise<boolean>;
|
|
236
|
+
|
|
237
|
+
export { EncryptedVaultFile, EncryptedVaultFileV2, HybridIdentityRecord, type MigrationOptions, type MigrationResult, OmnituumVault, VaultSession, VaultSettings, addIdentity, createEmptyVault, createIdentity, decryptVault, decryptVaultFromFile, decryptVaultFromJson, deriveKey, downloadVault, encryptVault, encryptVaultToBlob, encryptVaultToDataURL, encryptVaultV2, exportVault, getSession, getVaultKdfInfo, importVault, isV2Vault, isValidEncryptedVaultFile, lockSession, migrateEncryptedVault, needsMigration, removeIdentity, rotateIdentityKeys, setActiveIdentity, setSessionActiveIdentity, unlockSession, updateIdentityMetadata, updateSettings, validateMigration };
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { O as OmnituumVault, E as EncryptedVaultFile, a as EncryptedVaultFileV2, H as HybridIdentityRecord, V as VaultSettings, b as VaultSession } from '../types-61c7Q9ri.js';
|
|
2
|
+
export { D as DEFAULT_VAULT_SETTINGS, c as EncryptedVaultFileV1, d as HealthStatus, I as IdentityHealth, P as PBKDF2_ITERATIONS } from '../types-61c7Q9ri.js';
|
|
3
|
+
import '../version-BygzPVGs.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Omnituum PQC Shared - Vault Encryption
|
|
7
|
+
*
|
|
8
|
+
* Password-based encryption using PBKDF2 or Argon2id + AES-256-GCM.
|
|
9
|
+
* All operations use the Web Crypto API for browser compatibility.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Derive an AES-256 key from a password using PBKDF2-SHA256.
|
|
14
|
+
*
|
|
15
|
+
* @param password - User password
|
|
16
|
+
* @param salt - 32-byte salt
|
|
17
|
+
* @param iterations - PBKDF2 iterations (default: 600,000)
|
|
18
|
+
* @returns CryptoKey for AES-GCM
|
|
19
|
+
*/
|
|
20
|
+
declare function deriveKey(password: string, salt: Uint8Array, iterations?: number): Promise<CryptoKey>;
|
|
21
|
+
/**
|
|
22
|
+
* Encrypt a vault with a password.
|
|
23
|
+
*
|
|
24
|
+
* Uses PBKDF2-SHA256 for key derivation and AES-256-GCM for encryption.
|
|
25
|
+
* The salt and IV are randomly generated and included in the output.
|
|
26
|
+
*
|
|
27
|
+
* @param vault - Vault to encrypt
|
|
28
|
+
* @param password - User password
|
|
29
|
+
* @returns Encrypted vault file structure
|
|
30
|
+
*/
|
|
31
|
+
declare function encryptVault(vault: OmnituumVault, password: string): Promise<EncryptedVaultFile>;
|
|
32
|
+
/**
|
|
33
|
+
* Encrypt vault to a downloadable blob.
|
|
34
|
+
*
|
|
35
|
+
* @param vault - Vault to encrypt
|
|
36
|
+
* @param password - User password
|
|
37
|
+
* @returns Blob for download
|
|
38
|
+
*/
|
|
39
|
+
declare function encryptVaultToBlob(vault: OmnituumVault, password: string): Promise<Blob>;
|
|
40
|
+
/**
|
|
41
|
+
* Encrypt vault to a data URL for download.
|
|
42
|
+
*
|
|
43
|
+
* @param vault - Vault to encrypt
|
|
44
|
+
* @param password - User password
|
|
45
|
+
* @returns Data URL
|
|
46
|
+
*/
|
|
47
|
+
declare function encryptVaultToDataURL(vault: OmnituumVault, password: string): Promise<string>;
|
|
48
|
+
/**
|
|
49
|
+
* Encrypt a vault with a password using Argon2id (v2 format).
|
|
50
|
+
*
|
|
51
|
+
* Uses Argon2id for key derivation (64MB memory, 3 iterations) and AES-256-GCM.
|
|
52
|
+
* This is the recommended format for new vaults.
|
|
53
|
+
*
|
|
54
|
+
* @param vault - Vault to encrypt
|
|
55
|
+
* @param password - User password
|
|
56
|
+
* @returns Encrypted vault file structure (v2)
|
|
57
|
+
*/
|
|
58
|
+
declare function encryptVaultV2(vault: OmnituumVault, password: string): Promise<EncryptedVaultFileV2>;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Omnituum PQC Shared - Vault Decryption
|
|
62
|
+
*
|
|
63
|
+
* Password-based decryption using PBKDF2 or Argon2id + AES-256-GCM.
|
|
64
|
+
* Includes integrity verification.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Decrypt an encrypted vault file with a password.
|
|
69
|
+
* Supports both v1 (PBKDF2) and v2 (Argon2id) formats.
|
|
70
|
+
*
|
|
71
|
+
* @param encryptedFile - Encrypted vault file structure
|
|
72
|
+
* @param password - User password
|
|
73
|
+
* @returns Decrypted vault
|
|
74
|
+
* @throws Error if decryption fails (wrong password or corrupted data)
|
|
75
|
+
*/
|
|
76
|
+
declare function decryptVault(encryptedFile: EncryptedVaultFile, password: string): Promise<OmnituumVault>;
|
|
77
|
+
/**
|
|
78
|
+
* Decrypt a vault from a JSON string.
|
|
79
|
+
*
|
|
80
|
+
* @param json - Encrypted vault JSON string
|
|
81
|
+
* @param password - User password
|
|
82
|
+
* @returns Decrypted vault
|
|
83
|
+
*/
|
|
84
|
+
declare function decryptVaultFromJson(json: string, password: string): Promise<OmnituumVault>;
|
|
85
|
+
/**
|
|
86
|
+
* Decrypt a vault from a File object.
|
|
87
|
+
*
|
|
88
|
+
* @param file - File object (from file input)
|
|
89
|
+
* @param password - User password
|
|
90
|
+
* @returns Decrypted vault
|
|
91
|
+
*/
|
|
92
|
+
declare function decryptVaultFromFile(file: File, password: string): Promise<OmnituumVault>;
|
|
93
|
+
/**
|
|
94
|
+
* Validate an encrypted vault file without decrypting.
|
|
95
|
+
*
|
|
96
|
+
* @param json - JSON string to validate
|
|
97
|
+
* @returns true if valid encrypted vault file structure
|
|
98
|
+
*/
|
|
99
|
+
declare function isValidEncryptedVaultFile(json: string): boolean;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Omnituum PQC Shared - Vault Manager
|
|
103
|
+
*
|
|
104
|
+
* High-level operations for managing the PQC identity vault.
|
|
105
|
+
* Handles identity creation, rotation, import/export, and session management.
|
|
106
|
+
*/
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Create a new empty vault.
|
|
110
|
+
*/
|
|
111
|
+
declare function createEmptyVault(): OmnituumVault;
|
|
112
|
+
/**
|
|
113
|
+
* Create a new hybrid identity.
|
|
114
|
+
*/
|
|
115
|
+
declare function createIdentity(name: string): Promise<HybridIdentityRecord | null>;
|
|
116
|
+
/**
|
|
117
|
+
* Add an identity to the vault.
|
|
118
|
+
*/
|
|
119
|
+
declare function addIdentity(vault: OmnituumVault, identity: HybridIdentityRecord): OmnituumVault;
|
|
120
|
+
/**
|
|
121
|
+
* Remove an identity from the vault.
|
|
122
|
+
*/
|
|
123
|
+
declare function removeIdentity(vault: OmnituumVault, identityId: string): OmnituumVault;
|
|
124
|
+
/**
|
|
125
|
+
* Rotate keys for an identity (regenerate Kyber + X25519).
|
|
126
|
+
*/
|
|
127
|
+
declare function rotateIdentityKeys(vault: OmnituumVault, identityId: string): Promise<OmnituumVault | null>;
|
|
128
|
+
/**
|
|
129
|
+
* Update identity metadata.
|
|
130
|
+
*/
|
|
131
|
+
declare function updateIdentityMetadata(vault: OmnituumVault, identityId: string, updates: Partial<Pick<HybridIdentityRecord, 'name' | 'metadata'>>): OmnituumVault;
|
|
132
|
+
/**
|
|
133
|
+
* Update vault settings.
|
|
134
|
+
*/
|
|
135
|
+
declare function updateSettings(vault: OmnituumVault, settings: Partial<VaultSettings>): OmnituumVault;
|
|
136
|
+
/**
|
|
137
|
+
* Set the active identity.
|
|
138
|
+
*/
|
|
139
|
+
declare function setActiveIdentity(vault: OmnituumVault, identityId: string): OmnituumVault;
|
|
140
|
+
/**
|
|
141
|
+
* Export vault to encrypted file.
|
|
142
|
+
*/
|
|
143
|
+
declare function exportVault(vault: OmnituumVault, password: string): Promise<Blob>;
|
|
144
|
+
/**
|
|
145
|
+
* Import vault from encrypted file.
|
|
146
|
+
*/
|
|
147
|
+
declare function importVault(file: File, password: string): Promise<OmnituumVault>;
|
|
148
|
+
/**
|
|
149
|
+
* Trigger download of encrypted vault.
|
|
150
|
+
*/
|
|
151
|
+
declare function downloadVault(vault: OmnituumVault, password: string): Promise<void>;
|
|
152
|
+
/**
|
|
153
|
+
* Get current session state.
|
|
154
|
+
*/
|
|
155
|
+
declare function getSession(): VaultSession;
|
|
156
|
+
/**
|
|
157
|
+
* Unlock vault and store session key in memory.
|
|
158
|
+
*/
|
|
159
|
+
declare function unlockSession(password: string, vault: OmnituumVault): Promise<boolean>;
|
|
160
|
+
/**
|
|
161
|
+
* Lock the session.
|
|
162
|
+
*/
|
|
163
|
+
declare function lockSession(): void;
|
|
164
|
+
/**
|
|
165
|
+
* Set active identity in session.
|
|
166
|
+
*/
|
|
167
|
+
declare function setSessionActiveIdentity(identityId: string): void;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Omnituum PQC Shared - Vault Migration
|
|
171
|
+
*
|
|
172
|
+
* One-way migration from v1 (PBKDF2) to v2 (Argon2id) encrypted vaults.
|
|
173
|
+
* Includes memory hygiene for sensitive data.
|
|
174
|
+
*/
|
|
175
|
+
|
|
176
|
+
interface MigrationOptions {
|
|
177
|
+
/** Source encrypted vault */
|
|
178
|
+
encryptedVault: EncryptedVaultFile;
|
|
179
|
+
/** Vault password */
|
|
180
|
+
password: string;
|
|
181
|
+
/** Keep backup of original vault data (default: false) */
|
|
182
|
+
keepBackup?: boolean;
|
|
183
|
+
}
|
|
184
|
+
interface MigrationResult {
|
|
185
|
+
/** New v2 encrypted vault */
|
|
186
|
+
encryptedVault: EncryptedVaultFileV2;
|
|
187
|
+
/** Original vault (only if keepBackup was true) */
|
|
188
|
+
backup?: EncryptedVaultFile;
|
|
189
|
+
/** Source version */
|
|
190
|
+
sourceVersion: string;
|
|
191
|
+
/** Target version */
|
|
192
|
+
targetVersion: string;
|
|
193
|
+
/** Migration timestamp */
|
|
194
|
+
migratedAt: string;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Check if vault needs migration (is v1 format).
|
|
198
|
+
*/
|
|
199
|
+
declare function needsMigration(encryptedVault: EncryptedVaultFile): boolean;
|
|
200
|
+
/**
|
|
201
|
+
* Check if vault is already v2 format.
|
|
202
|
+
*/
|
|
203
|
+
declare function isV2Vault(encryptedVault: EncryptedVaultFile): boolean;
|
|
204
|
+
/**
|
|
205
|
+
* Get vault KDF info for display.
|
|
206
|
+
*/
|
|
207
|
+
declare function getVaultKdfInfo(encryptedVault: EncryptedVaultFile): {
|
|
208
|
+
kdf: string;
|
|
209
|
+
version: string;
|
|
210
|
+
isSecure: boolean;
|
|
211
|
+
recommendation?: string;
|
|
212
|
+
};
|
|
213
|
+
/**
|
|
214
|
+
* Migrate an encrypted vault from v1 (PBKDF2) to v2 (Argon2id).
|
|
215
|
+
*
|
|
216
|
+
* This is a ONE-WAY migration. The original vault remains unchanged,
|
|
217
|
+
* but a new v2 encrypted vault is returned.
|
|
218
|
+
*
|
|
219
|
+
* Memory hygiene: Sensitive data (decrypted vault) is zeroed after use.
|
|
220
|
+
*
|
|
221
|
+
* @param options - Migration options
|
|
222
|
+
* @returns Migration result with new v2 vault
|
|
223
|
+
* @throws Error if decryption fails or vault is already v2
|
|
224
|
+
*/
|
|
225
|
+
declare function migrateEncryptedVault(options: MigrationOptions): Promise<MigrationResult>;
|
|
226
|
+
/**
|
|
227
|
+
* Validate migration by decrypting both versions and comparing.
|
|
228
|
+
* Used for testing migration integrity.
|
|
229
|
+
*
|
|
230
|
+
* @param original - Original encrypted vault
|
|
231
|
+
* @param migrated - Migrated encrypted vault
|
|
232
|
+
* @param password - Vault password
|
|
233
|
+
* @returns true if vaults contain identical data
|
|
234
|
+
*/
|
|
235
|
+
declare function validateMigration(original: EncryptedVaultFile, migrated: EncryptedVaultFileV2, password: string): Promise<boolean>;
|
|
236
|
+
|
|
237
|
+
export { EncryptedVaultFile, EncryptedVaultFileV2, HybridIdentityRecord, type MigrationOptions, type MigrationResult, OmnituumVault, VaultSession, VaultSettings, addIdentity, createEmptyVault, createIdentity, decryptVault, decryptVaultFromFile, decryptVaultFromJson, deriveKey, downloadVault, encryptVault, encryptVaultToBlob, encryptVaultToDataURL, encryptVaultV2, exportVault, getSession, getVaultKdfInfo, importVault, isV2Vault, isValidEncryptedVaultFile, lockSession, migrateEncryptedVault, needsMigration, removeIdentity, rotateIdentityKeys, setActiveIdentity, setSessionActiveIdentity, unlockSession, updateIdentityMetadata, updateSettings, validateMigration };
|