@opensecret/react 1.0.1 → 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/README.md +177 -36
- package/dist/index.d.ts +296 -67
- package/dist/opensecret-react.es.js +1568 -1457
- package/dist/opensecret-react.umd.js +19 -19
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -47,6 +47,7 @@ declare namespace api {
|
|
|
47
47
|
GoogleAuthResponse,
|
|
48
48
|
PrivateKeyResponse,
|
|
49
49
|
PrivateKeyBytesResponse,
|
|
50
|
+
KeyOptions,
|
|
50
51
|
SignMessageResponse,
|
|
51
52
|
SignMessageRequest,
|
|
52
53
|
PublicKeyResponse,
|
|
@@ -201,26 +202,45 @@ declare function createProjectSecret(orgId: string, projectId: string, keyName:
|
|
|
201
202
|
/**
|
|
202
203
|
* Decrypts data that was previously encrypted with the user's key
|
|
203
204
|
* @param encryptedData - Base64-encoded encrypted data string
|
|
204
|
-
* @param
|
|
205
|
+
* @param key_options - Key derivation options (see KeyOptions type)
|
|
205
206
|
* @returns A promise resolving to the decrypted string
|
|
206
207
|
* @throws {Error} If:
|
|
207
208
|
* - The encrypted data is malformed
|
|
208
|
-
* - The derivation
|
|
209
|
+
* - The derivation paths are invalid
|
|
209
210
|
* - Authentication fails
|
|
210
211
|
* - Server-side decryption error occurs
|
|
211
212
|
*
|
|
212
213
|
* @description
|
|
214
|
+
* This function supports multiple decryption approaches:
|
|
215
|
+
*
|
|
216
|
+
* 1. Decrypt with master key (no derivation parameters)
|
|
217
|
+
*
|
|
218
|
+
* 2. Decrypt with BIP-32 derived key
|
|
219
|
+
* - Derives a child key from the master seed using BIP-32
|
|
220
|
+
*
|
|
221
|
+
* 3. Decrypt with BIP-85 derived key
|
|
222
|
+
* - Derives a child mnemonic using BIP-85, then uses its master key
|
|
223
|
+
*
|
|
224
|
+
* 4. Decrypt with combined BIP-85 and BIP-32 derivation
|
|
225
|
+
* - First derives a child mnemonic via BIP-85
|
|
226
|
+
* - Then applies BIP-32 derivation to derive a key from that seed
|
|
227
|
+
*
|
|
228
|
+
* IMPORTANT: You must use the exact same derivation paths for decryption
|
|
229
|
+
* that were used for encryption.
|
|
230
|
+
*
|
|
231
|
+
* Technical details:
|
|
213
232
|
* - Uses AES-256-GCM decryption with authentication tag verification
|
|
214
233
|
* - Extracts the nonce from the first 12 bytes of the encrypted data
|
|
215
|
-
* - If derivation_path is provided, decryption uses the derived key at that path
|
|
216
|
-
* - If derivation_path is omitted, decryption uses the master key
|
|
217
234
|
* - The encrypted_data must be in the exact format returned by the encrypt endpoint
|
|
218
235
|
*/
|
|
219
|
-
declare function decryptData(encryptedData: string,
|
|
236
|
+
declare function decryptData(encryptedData: string, key_options?: KeyOptions): Promise<string>;
|
|
220
237
|
|
|
221
238
|
declare type DecryptDataRequest = {
|
|
222
239
|
encrypted_data: string;
|
|
223
|
-
|
|
240
|
+
key_options?: {
|
|
241
|
+
private_key_derivation_path?: string;
|
|
242
|
+
seed_phrase_derivation_path?: string;
|
|
243
|
+
};
|
|
224
244
|
};
|
|
225
245
|
|
|
226
246
|
declare function deleteOrganization(orgId: string): Promise<void>;
|
|
@@ -248,28 +268,44 @@ declare type EmailSettings = {
|
|
|
248
268
|
/**
|
|
249
269
|
* Encrypts arbitrary string data using the user's private key
|
|
250
270
|
* @param data - String content to be encrypted
|
|
251
|
-
* @param
|
|
271
|
+
* @param key_options - Key derivation options (see KeyOptions type)
|
|
252
272
|
* @returns A promise resolving to the encrypted data response
|
|
253
273
|
* @throws {Error} If:
|
|
254
|
-
* - The derivation
|
|
274
|
+
* - The derivation paths are invalid
|
|
255
275
|
* - Authentication fails
|
|
256
276
|
* - Server-side encryption error occurs
|
|
257
277
|
*
|
|
258
278
|
* @description
|
|
279
|
+
* This function supports multiple encryption approaches:
|
|
280
|
+
*
|
|
281
|
+
* 1. Encrypt with master key (no derivation parameters)
|
|
282
|
+
*
|
|
283
|
+
* 2. Encrypt with BIP-32 derived key
|
|
284
|
+
* - Derives a child key from the master seed using BIP-32
|
|
285
|
+
*
|
|
286
|
+
* 3. Encrypt with BIP-85 derived key
|
|
287
|
+
* - Derives a child mnemonic using BIP-85, then uses its master key
|
|
288
|
+
*
|
|
289
|
+
* 4. Encrypt with combined BIP-85 and BIP-32 derivation
|
|
290
|
+
* - First derives a child mnemonic via BIP-85
|
|
291
|
+
* - Then applies BIP-32 derivation to derive a key from that seed
|
|
292
|
+
*
|
|
293
|
+
* Technical details:
|
|
259
294
|
* - Encrypts data with AES-256-GCM
|
|
260
295
|
* - A random nonce is generated for each encryption operation (included in the result)
|
|
261
|
-
* - If derivation_path is provided, encryption uses the derived key at that path
|
|
262
|
-
* - If derivation_path is omitted, encryption uses the master key
|
|
263
296
|
* - The encrypted_data format:
|
|
264
297
|
* - First 12 bytes: Nonce used for encryption (prepended to ciphertext)
|
|
265
298
|
* - Remaining bytes: AES-256-GCM encrypted ciphertext + authentication tag
|
|
266
299
|
* - The entire payload is base64-encoded for safe transport
|
|
267
300
|
*/
|
|
268
|
-
declare function encryptData(data: string,
|
|
301
|
+
declare function encryptData(data: string, key_options?: KeyOptions): Promise<EncryptDataResponse>;
|
|
269
302
|
|
|
270
303
|
declare type EncryptDataRequest = {
|
|
271
304
|
data: string;
|
|
272
|
-
|
|
305
|
+
key_options?: {
|
|
306
|
+
private_key_derivation_path?: string;
|
|
307
|
+
seed_phrase_derivation_path?: string;
|
|
308
|
+
};
|
|
273
309
|
};
|
|
274
310
|
|
|
275
311
|
declare type EncryptDataResponse = {
|
|
@@ -294,38 +330,85 @@ declare function fetchLogin(email: string, password: string, client_id: string):
|
|
|
294
330
|
|
|
295
331
|
declare function fetchLogout(refresh_token: string): Promise<void>;
|
|
296
332
|
|
|
297
|
-
|
|
333
|
+
/**
|
|
334
|
+
* Fetches the private key as a mnemonic phrase with optional derivation paths
|
|
335
|
+
* @param key_options - Optional key derivation options (see KeyOptions type)
|
|
336
|
+
*
|
|
337
|
+
* @returns A promise resolving to the private key response containing the mnemonic
|
|
338
|
+
*
|
|
339
|
+
* @description
|
|
340
|
+
* - If seed_phrase_derivation_path is provided, a child mnemonic is derived via BIP-85
|
|
341
|
+
* - If seed_phrase_derivation_path is omitted, the master mnemonic is returned
|
|
342
|
+
* - BIP-85 allows deriving child mnemonics from a master seed in a deterministic way
|
|
343
|
+
* - Common BIP-85 path format: m/83696968'/39'/0'/[entropy in bits]'/[index]'
|
|
344
|
+
* where entropy is typically 12' for 12-word mnemonics
|
|
345
|
+
*/
|
|
346
|
+
declare function fetchPrivateKey(key_options?: KeyOptions): Promise<PrivateKeyResponse>;
|
|
298
347
|
|
|
299
348
|
/**
|
|
300
|
-
* Fetches private key bytes for
|
|
301
|
-
* @param
|
|
349
|
+
* Fetches private key bytes for the given derivation options
|
|
350
|
+
* @param key_options - Key derivation options (see KeyOptions type)
|
|
351
|
+
*
|
|
352
|
+
* @returns A promise resolving to the private key bytes response
|
|
353
|
+
*
|
|
354
|
+
* @description
|
|
355
|
+
* This function supports multiple derivation approaches:
|
|
356
|
+
*
|
|
357
|
+
* 1. Master key only (no parameters)
|
|
358
|
+
* - Returns the master private key bytes
|
|
359
|
+
*
|
|
360
|
+
* 2. BIP-32 derivation only
|
|
361
|
+
* - Uses a single derivation path to derive a child key from the master seed
|
|
362
|
+
* - Supports both absolute and relative paths with hardened derivation:
|
|
363
|
+
* - Absolute path: "m/44'/0'/0'/0/0"
|
|
364
|
+
* - Relative path: "0'/0'/0'/0/0"
|
|
365
|
+
* - Hardened notation: "44'" or "44h"
|
|
366
|
+
* - Common paths:
|
|
367
|
+
* - BIP44 (Legacy): m/44'/0'/0'/0/0
|
|
368
|
+
* - BIP49 (SegWit): m/49'/0'/0'/0/0
|
|
369
|
+
* - BIP84 (Native SegWit): m/84'/0'/0'/0/0
|
|
370
|
+
* - BIP86 (Taproot): m/86'/0'/0'/0/0
|
|
302
371
|
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
*
|
|
372
|
+
* 3. BIP-85 derivation only
|
|
373
|
+
* - Derives a child mnemonic from the master seed using BIP-85
|
|
374
|
+
* - Then returns the master private key of that derived seed
|
|
375
|
+
* - Example path: "m/83696968'/39'/0'/12'/0'"
|
|
307
376
|
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
* -
|
|
311
|
-
*
|
|
312
|
-
* - BIP86 (Taproot): m/86'/0'/0'/0/0
|
|
377
|
+
* 4. Combined BIP-85 and BIP-32 derivation
|
|
378
|
+
* - First derives a child mnemonic via BIP-85
|
|
379
|
+
* - Then applies BIP-32 derivation to that derived seed
|
|
380
|
+
* - This allows for more complex derivation schemes
|
|
313
381
|
*/
|
|
314
|
-
declare function fetchPrivateKeyBytes(
|
|
382
|
+
declare function fetchPrivateKeyBytes(key_options?: KeyOptions): Promise<PrivateKeyBytesResponse>;
|
|
315
383
|
|
|
316
384
|
/**
|
|
317
|
-
* Retrieves the public key for a given algorithm and derivation
|
|
385
|
+
* Retrieves the public key for a given algorithm and derivation options
|
|
318
386
|
* @param algorithm - Signing algorithm (schnorr or ecdsa)
|
|
319
|
-
* @param
|
|
387
|
+
* @param key_options - Key derivation options (see KeyOptions type)
|
|
388
|
+
*
|
|
389
|
+
* @returns A promise resolving to the public key response
|
|
390
|
+
*
|
|
391
|
+
* @description
|
|
392
|
+
* The derivation paths determine which key is used to generate the public key:
|
|
393
|
+
*
|
|
394
|
+
* 1. Master key (no derivation parameters)
|
|
395
|
+
* - Returns the public key corresponding to the master private key
|
|
396
|
+
*
|
|
397
|
+
* 2. BIP-32 derived key
|
|
398
|
+
* - Returns the public key for a derived child key
|
|
399
|
+
* - Useful for:
|
|
400
|
+
* - Separating keys by purpose (e.g., different chains or applications)
|
|
401
|
+
* - Generating deterministic addresses
|
|
402
|
+
* - Supporting different address formats (Legacy, SegWit, Native SegWit, Taproot)
|
|
320
403
|
*
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
404
|
+
* 3. BIP-85 derived key
|
|
405
|
+
* - Returns the public key for the master key of a BIP-85 derived seed
|
|
406
|
+
*
|
|
407
|
+
* 4. Combined BIP-85 and BIP-32 derivation
|
|
408
|
+
* - First derives a child mnemonic via BIP-85
|
|
409
|
+
* - Then applies BIP-32 derivation to get the corresponding public key
|
|
327
410
|
*/
|
|
328
|
-
declare function fetchPublicKey(algorithm: SigningAlgorithm,
|
|
411
|
+
declare function fetchPublicKey(algorithm: SigningAlgorithm, key_options?: KeyOptions): Promise<PublicKeyResponse>;
|
|
329
412
|
|
|
330
413
|
declare function fetchPut(key: string, value: string): Promise<string>;
|
|
331
414
|
|
|
@@ -387,6 +470,22 @@ declare function keyExchange(clientPublicKey: string, nonce: string, explicitApi
|
|
|
387
470
|
session_id: string;
|
|
388
471
|
}>;
|
|
389
472
|
|
|
473
|
+
/**
|
|
474
|
+
* Options for key derivation operations
|
|
475
|
+
*/
|
|
476
|
+
declare type KeyOptions = {
|
|
477
|
+
/**
|
|
478
|
+
* BIP-85 derivation path to derive a child mnemonic
|
|
479
|
+
* Examples: "m/83696968'/39'/0'/12'/0'"
|
|
480
|
+
*/
|
|
481
|
+
seed_phrase_derivation_path?: string;
|
|
482
|
+
/**
|
|
483
|
+
* BIP-32 derivation path to derive a child key from the master (or BIP-85 derived) seed
|
|
484
|
+
* Examples: "m/44'/0'/0'/0/0"
|
|
485
|
+
*/
|
|
486
|
+
private_key_derivation_path?: string;
|
|
487
|
+
};
|
|
488
|
+
|
|
390
489
|
export declare type KVListItem = {
|
|
391
490
|
key: string;
|
|
392
491
|
value: string;
|
|
@@ -600,44 +699,104 @@ export declare type OpenSecretContextType = {
|
|
|
600
699
|
handleGoogleCallback: (code: string, state: string, inviteCode: string) => Promise<void>;
|
|
601
700
|
/**
|
|
602
701
|
* Retrieves the user's private key mnemonic phrase
|
|
702
|
+
* @param options - Optional key derivation options
|
|
603
703
|
* @returns A promise resolving to the private key response
|
|
604
704
|
* @throws {Error} If the private key cannot be retrieved
|
|
705
|
+
*
|
|
706
|
+
* @description
|
|
707
|
+
* This function supports two modes:
|
|
708
|
+
*
|
|
709
|
+
* 1. Master mnemonic (no parameters)
|
|
710
|
+
* - Returns the user's master 12-word BIP39 mnemonic
|
|
711
|
+
*
|
|
712
|
+
* 2. BIP-85 derived mnemonic
|
|
713
|
+
* - Derives a child mnemonic using BIP-85
|
|
714
|
+
* - Requires seed_phrase_derivation_path in options
|
|
715
|
+
* - Example: "m/83696968'/39'/0'/12'/0'"
|
|
605
716
|
*/
|
|
606
717
|
getPrivateKey: typeof api.fetchPrivateKey;
|
|
607
718
|
/**
|
|
608
|
-
* Retrieves the private key bytes for
|
|
609
|
-
* @param
|
|
719
|
+
* Retrieves the private key bytes for the given derivation options
|
|
720
|
+
* @param options - Optional key derivation options or legacy BIP32 derivation path string
|
|
610
721
|
* @returns A promise resolving to the private key bytes response
|
|
611
722
|
* @throws {Error} If:
|
|
612
723
|
* - The private key bytes cannot be retrieved
|
|
613
|
-
* - The derivation
|
|
724
|
+
* - The derivation paths are invalid
|
|
614
725
|
*
|
|
615
726
|
* @description
|
|
616
|
-
*
|
|
617
|
-
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
*
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
727
|
+
* This function supports multiple derivation approaches:
|
|
728
|
+
*
|
|
729
|
+
* 1. Master key only (no parameters)
|
|
730
|
+
* - Returns the master private key bytes
|
|
731
|
+
*
|
|
732
|
+
* 2. BIP-32 derivation only
|
|
733
|
+
* - Uses a single derivation path to derive a child key from the master seed
|
|
734
|
+
* - Supports both absolute and relative paths with hardened derivation:
|
|
735
|
+
* - Absolute path: "m/44'/0'/0'/0/0"
|
|
736
|
+
* - Relative path: "0'/0'/0'/0/0"
|
|
737
|
+
* - Hardened notation: "44'" or "44h"
|
|
738
|
+
* - Common paths:
|
|
739
|
+
* - BIP44 (Legacy): m/44'/0'/0'/0/0
|
|
740
|
+
* - BIP49 (SegWit): m/49'/0'/0'/0/0
|
|
741
|
+
* - BIP84 (Native SegWit): m/84'/0'/0'/0/0
|
|
742
|
+
* - BIP86 (Taproot): m/86'/0'/0'/0/0
|
|
743
|
+
*
|
|
744
|
+
* 3. BIP-85 derivation only
|
|
745
|
+
* - Derives a child mnemonic from the master seed using BIP-85
|
|
746
|
+
* - Then returns the master private key of that derived seed
|
|
747
|
+
* - Example path: "m/83696968'/39'/0'/12'/0'"
|
|
748
|
+
*
|
|
749
|
+
* 4. Combined BIP-85 and BIP-32 derivation
|
|
750
|
+
* - First derives a child mnemonic via BIP-85
|
|
751
|
+
* - Then applies BIP-32 derivation to that derived seed
|
|
624
752
|
*/
|
|
625
753
|
getPrivateKeyBytes: typeof api.fetchPrivateKeyBytes;
|
|
626
754
|
/**
|
|
627
755
|
* Retrieves the user's public key for the specified algorithm
|
|
628
756
|
* @param algorithm - The signing algorithm ('schnorr' or 'ecdsa')
|
|
629
|
-
* @param
|
|
757
|
+
* @param options - Optional key derivation options or legacy BIP32 derivation path string
|
|
630
758
|
* @returns A promise resolving to the public key response
|
|
631
759
|
* @throws {Error} If the public key cannot be retrieved
|
|
760
|
+
*
|
|
761
|
+
* @description
|
|
762
|
+
* The derivation paths determine which key is used to generate the public key:
|
|
763
|
+
*
|
|
764
|
+
* 1. Master key (no derivation parameters)
|
|
765
|
+
* - Returns the public key corresponding to the master private key
|
|
766
|
+
*
|
|
767
|
+
* 2. BIP-32 derived key
|
|
768
|
+
* - Returns the public key for a derived child key
|
|
769
|
+
*
|
|
770
|
+
* 3. BIP-85 derived key
|
|
771
|
+
* - Returns the public key for the master key of a BIP-85 derived seed
|
|
772
|
+
*
|
|
773
|
+
* 4. Combined BIP-85 and BIP-32 derivation
|
|
774
|
+
* - First derives a child mnemonic via BIP-85
|
|
775
|
+
* - Then applies BIP-32 derivation to get the corresponding public key
|
|
632
776
|
*/
|
|
633
777
|
getPublicKey: typeof api.fetchPublicKey;
|
|
634
778
|
/**
|
|
635
779
|
* Signs a message using the specified algorithm
|
|
636
780
|
* @param messageBytes - The message to sign as a Uint8Array
|
|
637
781
|
* @param algorithm - The signing algorithm ('schnorr' or 'ecdsa')
|
|
638
|
-
* @param
|
|
782
|
+
* @param options - Optional key derivation options or legacy BIP32 derivation path string
|
|
639
783
|
* @returns A promise resolving to the signature response
|
|
640
784
|
* @throws {Error} If the message signing fails
|
|
785
|
+
*
|
|
786
|
+
* @description
|
|
787
|
+
* This function supports multiple signing approaches:
|
|
788
|
+
*
|
|
789
|
+
* 1. Sign with master key (no derivation parameters)
|
|
790
|
+
*
|
|
791
|
+
* 2. Sign with BIP-32 derived key
|
|
792
|
+
* - Derives a child key from the master seed using BIP-32
|
|
793
|
+
*
|
|
794
|
+
* 3. Sign with BIP-85 derived key
|
|
795
|
+
* - Derives a child mnemonic using BIP-85, then uses its master key
|
|
796
|
+
*
|
|
797
|
+
* 4. Sign with combined BIP-85 and BIP-32 derivation
|
|
798
|
+
* - First derives a child mnemonic via BIP-85
|
|
799
|
+
* - Then applies BIP-32 derivation to derive a key from that seed
|
|
641
800
|
*/
|
|
642
801
|
signMessage: typeof api.signMessage;
|
|
643
802
|
/**
|
|
@@ -720,41 +879,68 @@ export declare type OpenSecretContextType = {
|
|
|
720
879
|
/**
|
|
721
880
|
* Encrypts arbitrary string data using the user's private key
|
|
722
881
|
* @param data - String content to be encrypted
|
|
723
|
-
* @param
|
|
882
|
+
* @param options - Optional key derivation options or legacy BIP32 derivation path string
|
|
724
883
|
* @returns A promise resolving to the encrypted data response
|
|
725
884
|
* @throws {Error} If:
|
|
726
|
-
* - The derivation
|
|
885
|
+
* - The derivation paths are invalid
|
|
727
886
|
* - Authentication fails
|
|
728
887
|
* - Server-side encryption error occurs
|
|
729
888
|
*
|
|
730
889
|
* @description
|
|
890
|
+
* This function supports multiple encryption approaches:
|
|
891
|
+
*
|
|
892
|
+
* 1. Encrypt with master key (no derivation parameters)
|
|
893
|
+
*
|
|
894
|
+
* 2. Encrypt with BIP-32 derived key
|
|
895
|
+
* - Derives a child key from the master seed using BIP-32
|
|
896
|
+
* - Example: "m/44'/0'/0'/0/0"
|
|
897
|
+
*
|
|
898
|
+
* 3. Encrypt with BIP-85 derived key
|
|
899
|
+
* - Derives a child mnemonic using BIP-85, then uses its master key
|
|
900
|
+
* - Example: { seed_phrase_derivation_path: "m/83696968'/39'/0'/12'/0'" }
|
|
901
|
+
*
|
|
902
|
+
* 4. Encrypt with combined BIP-85 and BIP-32 derivation
|
|
903
|
+
* - First derives a child mnemonic via BIP-85
|
|
904
|
+
* - Then applies BIP-32 derivation to derive a key from that seed
|
|
905
|
+
* - Example: {
|
|
906
|
+
* seed_phrase_derivation_path: "m/83696968'/39'/0'/12'/0'",
|
|
907
|
+
* private_key_derivation_path: "m/44'/0'/0'/0/0"
|
|
908
|
+
* }
|
|
909
|
+
*
|
|
910
|
+
* Technical details:
|
|
731
911
|
* - Encrypts data with AES-256-GCM
|
|
732
912
|
* - A random nonce is generated for each encryption operation (included in the result)
|
|
733
|
-
* -
|
|
734
|
-
* - If derivation_path is omitted, encryption uses the master key
|
|
735
|
-
* - The encrypted_data format:
|
|
736
|
-
* - First 12 bytes: Nonce used for encryption (prepended to ciphertext)
|
|
737
|
-
* - Remaining bytes: AES-256-GCM encrypted ciphertext + authentication tag
|
|
738
|
-
* - The entire payload is base64-encoded for safe transport
|
|
913
|
+
* - The encrypted_data format includes the nonce and is base64-encoded
|
|
739
914
|
*/
|
|
740
915
|
encryptData: typeof api.encryptData;
|
|
741
916
|
/**
|
|
742
917
|
* Decrypts data that was previously encrypted with the user's key
|
|
743
918
|
* @param encryptedData - Base64-encoded encrypted data string
|
|
744
|
-
* @param
|
|
919
|
+
* @param options - Optional key derivation options or legacy BIP32 derivation path string
|
|
745
920
|
* @returns A promise resolving to the decrypted string
|
|
746
921
|
* @throws {Error} If:
|
|
747
922
|
* - The encrypted data is malformed
|
|
748
|
-
* - The derivation
|
|
923
|
+
* - The derivation paths are invalid
|
|
749
924
|
* - Authentication fails
|
|
750
925
|
* - Server-side decryption error occurs
|
|
751
926
|
*
|
|
752
927
|
* @description
|
|
753
|
-
*
|
|
754
|
-
*
|
|
755
|
-
*
|
|
756
|
-
*
|
|
757
|
-
*
|
|
928
|
+
* This function supports multiple decryption approaches:
|
|
929
|
+
*
|
|
930
|
+
* 1. Decrypt with master key (no derivation parameters)
|
|
931
|
+
*
|
|
932
|
+
* 2. Decrypt with BIP-32 derived key
|
|
933
|
+
* - Derives a child key from the master seed using BIP-32
|
|
934
|
+
*
|
|
935
|
+
* 3. Decrypt with BIP-85 derived key
|
|
936
|
+
* - Derives a child mnemonic using BIP-85, then uses its master key
|
|
937
|
+
*
|
|
938
|
+
* 4. Decrypt with combined BIP-85 and BIP-32 derivation
|
|
939
|
+
* - First derives a child mnemonic via BIP-85
|
|
940
|
+
* - Then applies BIP-32 derivation to derive a key from that seed
|
|
941
|
+
*
|
|
942
|
+
* IMPORTANT: You must use the exact same derivation options for decryption
|
|
943
|
+
* that were used for encryption.
|
|
758
944
|
*/
|
|
759
945
|
decryptData: typeof api.decryptData;
|
|
760
946
|
};
|
|
@@ -1192,14 +1378,35 @@ export declare type ParsedAttestationView = {
|
|
|
1192
1378
|
validatedPcr0Hash: Pcr0ValidationResult | null;
|
|
1193
1379
|
};
|
|
1194
1380
|
|
|
1381
|
+
/**
|
|
1382
|
+
* Result of PCR0 validation
|
|
1383
|
+
*/
|
|
1195
1384
|
export declare type Pcr0ValidationResult = {
|
|
1385
|
+
/** Whether the PCR0 hash matches a known good value */
|
|
1196
1386
|
isMatch: boolean;
|
|
1387
|
+
/** Human-readable description of the validation result */
|
|
1197
1388
|
text: string;
|
|
1389
|
+
/** Timestamp of when the PCR was verified (for remote attestation) */
|
|
1390
|
+
verifiedAt?: string;
|
|
1198
1391
|
};
|
|
1199
1392
|
|
|
1393
|
+
/**
|
|
1394
|
+
* Configuration options for PCR validation
|
|
1395
|
+
*/
|
|
1200
1396
|
export declare type PcrConfig = {
|
|
1397
|
+
/** Additional custom PCR0 values for production environments */
|
|
1201
1398
|
pcr0Values?: string[];
|
|
1399
|
+
/** Additional custom PCR0 values for development environments */
|
|
1202
1400
|
pcr0DevValues?: string[];
|
|
1401
|
+
/** Enable/disable remote attestation (defaults to true) */
|
|
1402
|
+
remoteAttestation?: boolean;
|
|
1403
|
+
/** Custom URLs for remote attestation */
|
|
1404
|
+
remoteAttestationUrls?: {
|
|
1405
|
+
/** URL for production PCR history */
|
|
1406
|
+
prod?: string;
|
|
1407
|
+
/** URL for development PCR history */
|
|
1408
|
+
dev?: string;
|
|
1409
|
+
};
|
|
1203
1410
|
};
|
|
1204
1411
|
|
|
1205
1412
|
declare namespace platformApi {
|
|
@@ -1404,10 +1611,27 @@ declare function setPlatformApiUrl(url: string): void;
|
|
|
1404
1611
|
declare type SigningAlgorithm = "schnorr" | "ecdsa";
|
|
1405
1612
|
|
|
1406
1613
|
/**
|
|
1407
|
-
* Signs a message using the specified algorithm and derivation
|
|
1614
|
+
* Signs a message using the specified algorithm and derivation options
|
|
1408
1615
|
* @param message_bytes - Message to sign as Uint8Array
|
|
1409
1616
|
* @param algorithm - Signing algorithm (schnorr or ecdsa)
|
|
1410
|
-
* @param
|
|
1617
|
+
* @param key_options - Key derivation options (see KeyOptions type)
|
|
1618
|
+
*
|
|
1619
|
+
* @returns A promise resolving to the signature response
|
|
1620
|
+
*
|
|
1621
|
+
* @description
|
|
1622
|
+
* This function supports multiple signing approaches:
|
|
1623
|
+
*
|
|
1624
|
+
* 1. Sign with master key (no derivation parameters)
|
|
1625
|
+
*
|
|
1626
|
+
* 2. Sign with BIP-32 derived key
|
|
1627
|
+
* - Derives a child key from the master seed using BIP-32
|
|
1628
|
+
*
|
|
1629
|
+
* 3. Sign with BIP-85 derived key
|
|
1630
|
+
* - Derives a child mnemonic using BIP-85, then uses its master key
|
|
1631
|
+
*
|
|
1632
|
+
* 4. Sign with combined BIP-85 and BIP-32 derivation
|
|
1633
|
+
* - First derives a child mnemonic via BIP-85
|
|
1634
|
+
* - Then applies BIP-32 derivation to derive a key from that seed
|
|
1411
1635
|
*
|
|
1412
1636
|
* Example message preparation:
|
|
1413
1637
|
* ```typescript
|
|
@@ -1418,15 +1642,20 @@ declare type SigningAlgorithm = "schnorr" | "ecdsa";
|
|
|
1418
1642
|
* const messageBytes = new Uint8Array(Buffer.from("deadbeef", "hex"));
|
|
1419
1643
|
* ```
|
|
1420
1644
|
*/
|
|
1421
|
-
declare function signMessage(message_bytes: Uint8Array, algorithm: SigningAlgorithm,
|
|
1645
|
+
declare function signMessage(message_bytes: Uint8Array, algorithm: SigningAlgorithm, key_options?: KeyOptions): Promise<SignMessageResponse>;
|
|
1422
1646
|
|
|
1423
1647
|
declare type SignMessageRequest = {
|
|
1424
1648
|
/** Base64-encoded message to sign */
|
|
1425
1649
|
message_base64: string;
|
|
1426
1650
|
/** Signing algorithm to use (schnorr or ecdsa) */
|
|
1427
1651
|
algorithm: SigningAlgorithm;
|
|
1428
|
-
/** Optional
|
|
1429
|
-
|
|
1652
|
+
/** Optional key derivation options */
|
|
1653
|
+
key_options?: {
|
|
1654
|
+
/** Optional BIP32 derivation path (e.g., "m/44'/0'/0'/0/0") */
|
|
1655
|
+
private_key_derivation_path?: string;
|
|
1656
|
+
/** Optional BIP-85 seed phrase derivation path (e.g., "m/83696968'/39'/0'/12'/0'") */
|
|
1657
|
+
seed_phrase_derivation_path?: string;
|
|
1658
|
+
};
|
|
1430
1659
|
};
|
|
1431
1660
|
|
|
1432
1661
|
declare type SignMessageResponse = {
|