@@ -42,16 +42,17 @@ assert(myRandomAccount.verify(hello_world, signature));
42
42
43
43
## Methods
44
44
45
- ### ` fromCiphertext(ciphertext, password ) ► Account `
45
+ ### ` fromCiphertext(params ) ► Account `
46
46
47
47
![ modifier: public] ( images/badges/modifier-public.svg ) ![ modifier: static] ( images/badges/modifier-static.svg )
48
48
49
49
Attempts to create an account from a private key ciphertext
50
50
51
51
Parameters | Type | Description
52
52
--- | --- | ---
53
- __ ciphertext__ | [ PrivateKeyCiphertext] ( sdk-src_wasm.md ) | * The encrypted private key ciphertext or its string representation*
54
- __ password__ | ` string ` | * The password used to decrypt the private key ciphertext*
53
+ __ params__ | ` Object ` | **
54
+ __ params.ciphertext__ | [ PrivateKeyCiphertext] ( sdk-src_wasm.md ) | * The encrypted private key ciphertext or its string representation*
55
+ __ params.password__ | ` string ` | * The password used to decrypt the private key ciphertext*
55
56
__ * return* __ | [ Account] ( sdk-src_account.md ) | * A new Account instance created from the decrypted private key*
56
57
57
58
#### Examples
@@ -60,7 +61,10 @@ __*return*__ | [Account](sdk-src_account.md) | *A new Account instance created f
60
61
import { Account } from " @provablehq/sdk/testnet.js" ;
61
62
62
63
// Create an account object from a previously encrypted ciphertext and password.
63
- const account = Account .fromCiphertext (process .env .ciphertext , process .env .password );
64
+ const account = Account .fromCiphertext ({
65
+ ciphertext: process .env .ciphertext ,
66
+ password: process .env .password ,
67
+ });
64
68
```
65
69
66
70
---
@@ -237,7 +241,10 @@ import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
237
241
238
242
// Create a connection to the Aleo network and an account
239
243
const networkClient = new AleoNetworkClient ({ host: " https://api.explorer.provable.com/v1" });
240
- const account = Account .fromCiphertext (process .env .ciphertext ! , process .env .password ! );
244
+ const account = Account .fromCiphertext ({
245
+ ciphertext: process .env .ciphertext ! ,
246
+ password: process .env .password ! ,
247
+ });
241
248
242
249
// Get the record ciphertexts from a transaction.
243
250
const transaction = await networkClient .getTransactionObject (" at1fjy6s9md2v4rgcn3j3q4qndtfaa2zvg58a4uha0rujvrn4cumu9qfazxdd" );
@@ -273,7 +280,10 @@ import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
273
280
274
281
// Create a connection to the Aleo network and an account
275
282
const networkClient = new AleoNetworkClient ({ host: " https://api.explorer.provable.com/v1" });
276
- const account = Account .fromCiphertext (process .env .ciphertext ! , process .env .password ! );
283
+ const account = Account .fromCiphertext ({
284
+ ciphertext: process .env .ciphertext ! ,
285
+ password: process .env .password ! ,
286
+ });
277
287
278
288
// Get the record ciphertexts from a transaction.
279
289
const transaction = await networkClient .getTransactionObject (" at1fjy6s9md2v4rgcn3j3q4qndtfaa2zvg58a4uha0rujvrn4cumu9qfazxdd" );
@@ -304,7 +314,10 @@ __*return*__ | [Field](sdk-src_wasm.md) | *The record view key*
304
314
import { Account } from " @provablehq/sdk/testnet.js" ;
305
315
306
316
// Create an account object from a previously encrypted ciphertext and password.
307
- const account = Account .fromCiphertext (process .env .ciphertext ! , process .env .password ! );
317
+ const account = Account .fromCiphertext ({
318
+ ciphertext: process .env .ciphertext ! ,
319
+ password: process .env .password ! ,
320
+ });
308
321
309
322
// Generate a record view key from the account's view key and a record ciphertext
310
323
const recordCiphertext = RecordCiphertext .fromString (" your_record_ciphertext_here" );
@@ -359,7 +372,10 @@ import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
359
372
360
373
// Create a connection to the Aleo network and an account
361
374
const networkClient = new AleoNetworkClient ({ host: " https://api.explorer.provable.com/v1" });
362
- const account = Account .fromCiphertext (process .env .ciphertext ! , process .env .password ! );
375
+ const account = Account .fromCiphertext ({
376
+ ciphertext: process .env .ciphertext ! ,
377
+ password: process .env .password ! ,
378
+ });
363
379
364
380
// Get the record ciphertexts from a transaction and check ownership of them.
365
381
const transaction = await networkClient .getTransactionObject (" at1fjy6s9md2v4rgcn3j3q4qndtfaa2zvg58a4uha0rujvrn4cumu9qfazxdd" );
@@ -395,29 +411,33 @@ __*return*__ | [Signature](sdk-src_wasm.md) | *Signature over the message in byt
395
411
import { Account } from " @provablehq/sdk/testnet.js" ;
396
412
397
413
// Create a connection to the Aleo network and an account
398
- const account = Account .fromCiphertext (process .env .ciphertext , process .env .password );
414
+ const account = Account .fromCiphertext ({
415
+ ciphertext: process .env .ciphertext ,
416
+ password: process .env .password ,
417
+ });
399
418
400
419
// Create an account and a message to sign.
401
420
const account = new Account ();
402
421
const message = Uint8Array .from ([104 , 101 , 108 , 108 , 111 119 , 111 , 114 , 108 , 100 ])
403
422
const signature = account .sign (message);
404
423
405
424
// Verify the signature.
406
- assert (account .verify (message, signature));
425
+ assert (account .verify ({ message, signature } ));
407
426
```
408
427
409
428
---
410
429
411
- ### ` verify(message, signature ) ► boolean `
430
+ ### ` verify(params ) ► boolean `
412
431
413
432
![ modifier: public] ( images/badges/modifier-public.svg )
414
433
415
434
Verifies the Signature on a message.
416
435
417
436
Parameters | Type | Description
418
437
--- | --- | ---
419
- __ message__ | ` Uint8Array ` | * Message in bytes to be signed.*
420
- __ signature__ | [ Signature] ( sdk-src_wasm.md ) | * Signature to be verified.*
438
+ __ params__ | ` Object ` | **
439
+ __ params.message__ | ` Uint8Array ` | * Message in bytes to be signed.*
440
+ __ params.signature__ | [ Signature] ( sdk-src_wasm.md ) | * Signature to be verified.*
421
441
__ * return* __ | ` boolean ` | * True if the signature is valid, false otherwise.*
422
442
423
443
#### Examples
@@ -427,28 +447,32 @@ __*return*__ | `boolean` | *True if the signature is valid, false otherwise.*
427
447
import { Account } from " @provablehq/sdk/testnet.js" ;
428
448
429
449
// Create a connection to the Aleo network and an account
430
- const account = Account .fromCiphertext (process .env .ciphertext , process .env .password );
450
+ const account = Account .fromCiphertext ({
451
+ ciphertext: process .env .ciphertext ,
452
+ password: process .env .password ,
453
+ });
431
454
432
455
// Sign a message.
433
456
const message = Uint8Array .from ([104 , 101 , 108 , 108 , 111 119 , 111 , 114 , 108 , 100 ])
434
457
const signature = account .sign (message);
435
458
436
459
// Verify the signature.
437
- assert (account .verify (message, signature));
460
+ assert (account .verify ({ message, signature } ));
438
461
```
439
462
440
463
---
441
464
442
- ### ` fromCiphertext(ciphertext, password ) ► Account `
465
+ ### ` fromCiphertext(params ) ► Account `
443
466
444
467
![ modifier: public] ( images/badges/modifier-public.svg ) ![ modifier: static] ( images/badges/modifier-static.svg )
445
468
446
469
Attempts to create an account from a private key ciphertext
447
470
448
471
Parameters | Type | Description
449
472
--- | --- | ---
450
- __ ciphertext__ | [ PrivateKeyCiphertext] ( sdk-src_wasm.md ) | * The encrypted private key ciphertext or its string representation*
451
- __ password__ | ` string ` | * The password used to decrypt the private key ciphertext*
473
+ __ params__ | ` Object ` | **
474
+ __ params.ciphertext__ | [ PrivateKeyCiphertext] ( sdk-src_wasm.md ) | * The encrypted private key ciphertext or its string representation*
475
+ __ params.password__ | ` string ` | * The password used to decrypt the private key ciphertext*
452
476
__ * return* __ | [ Account] ( sdk-src_account.md ) | * A new Account instance created from the decrypted private key*
453
477
454
478
#### Examples
@@ -457,7 +481,10 @@ __*return*__ | [Account](sdk-src_account.md) | *A new Account instance created f
457
481
import { Account } from " @provablehq/sdk/testnet.js" ;
458
482
459
483
// Create an account object from a previously encrypted ciphertext and password.
460
- const account = Account .fromCiphertext (process .env .ciphertext , process .env .password );
484
+ const account = Account .fromCiphertext ({
485
+ ciphertext: process .env .ciphertext ,
486
+ password: process .env .password ,
487
+ });
461
488
```
462
489
463
490
---
@@ -621,7 +648,10 @@ import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
621
648
622
649
// Create a connection to the Aleo network and an account
623
650
const networkClient = new AleoNetworkClient ({ host: " https://api.explorer.provable.com/v1" });
624
- const account = Account .fromCiphertext (process .env .ciphertext ! , process .env .password ! );
651
+ const account = Account .fromCiphertext ({
652
+ ciphertext: process .env .ciphertext ! ,
653
+ password: process .env .password ! ,
654
+ });
625
655
626
656
// Get the record ciphertexts from a transaction.
627
657
const transaction = await networkClient .getTransactionObject (" at1fjy6s9md2v4rgcn3j3q4qndtfaa2zvg58a4uha0rujvrn4cumu9qfazxdd" );
@@ -657,7 +687,10 @@ import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
657
687
658
688
// Create a connection to the Aleo network and an account
659
689
const networkClient = new AleoNetworkClient ({ host: " https://api.explorer.provable.com/v1" });
660
- const account = Account .fromCiphertext (process .env .ciphertext ! , process .env .password ! );
690
+ const account = Account .fromCiphertext ({
691
+ ciphertext: process .env .ciphertext ! ,
692
+ password: process .env .password ! ,
693
+ });
661
694
662
695
// Get the record ciphertexts from a transaction.
663
696
const transaction = await networkClient .getTransactionObject (" at1fjy6s9md2v4rgcn3j3q4qndtfaa2zvg58a4uha0rujvrn4cumu9qfazxdd" );
@@ -688,7 +721,10 @@ __*return*__ | [Field](sdk-src_wasm.md) | *The record view key*
688
721
import { Account } from " @provablehq/sdk/testnet.js" ;
689
722
690
723
// Create an account object from a previously encrypted ciphertext and password.
691
- const account = Account .fromCiphertext (process .env .ciphertext ! , process .env .password ! );
724
+ const account = Account .fromCiphertext ({
725
+ ciphertext: process .env .ciphertext ! ,
726
+ password: process .env .password ! ,
727
+ });
692
728
693
729
// Generate a record view key from the account's view key and a record ciphertext
694
730
const recordCiphertext = RecordCiphertext .fromString (" your_record_ciphertext_here" );
@@ -702,7 +738,7 @@ const recordViewKey = account.generateRecordViewKey(recordCiphertext);
702
738
![ modifier: public] ( images/badges/modifier-public.svg )
703
739
704
740
Generates a transition view key from the account owner' ; s view key and the transition public key.
705
- This key can be used to decrypt the private inputs and outputs of a the transition without
741
+ This key can be used to decrypt the private inputs and outputs of a the transition without
706
742
revealing the account' ; s view key.
707
743
708
744
Parameters | Type | Description
@@ -743,7 +779,10 @@ import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
743
779
744
780
// Create a connection to the Aleo network and an account
745
781
const networkClient = new AleoNetworkClient ({ host: " https://api.explorer.provable.com/v1" });
746
- const account = Account .fromCiphertext (process .env .ciphertext ! , process .env .password ! );
782
+ const account = Account .fromCiphertext ({
783
+ ciphertext: process .env .ciphertext ! ,
784
+ password: process .env .password ! ,
785
+ });
747
786
748
787
// Get the record ciphertexts from a transaction and check ownership of them.
749
788
const transaction = await networkClient .getTransactionObject (" at1fjy6s9md2v4rgcn3j3q4qndtfaa2zvg58a4uha0rujvrn4cumu9qfazxdd" );
@@ -779,29 +818,33 @@ __*return*__ | [Signature](sdk-src_wasm.md) | *Signature over the message in byt
779
818
import { Account } from " @provablehq/sdk/testnet.js" ;
780
819
781
820
// Create a connection to the Aleo network and an account
782
- const account = Account .fromCiphertext (process .env .ciphertext , process .env .password );
821
+ const account = Account .fromCiphertext ({
822
+ ciphertext: process .env .ciphertext ,
823
+ password: process .env .password ,
824
+ });
783
825
784
826
// Create an account and a message to sign.
785
827
const account = new Account ();
786
828
const message = Uint8Array .from ([104 , 101 , 108 , 108 , 111 119 , 111 , 114 , 108 , 100 ])
787
829
const signature = account .sign (message);
788
830
789
831
// Verify the signature.
790
- assert (account .verify (message, signature));
832
+ assert (account .verify ({ message, signature } ));
791
833
```
792
834
793
835
---
794
836
795
- ### ` verify(message, signature ) ► boolean `
837
+ ### ` verify(params ) ► boolean `
796
838
797
839
![ modifier: public] ( images/badges/modifier-public.svg )
798
840
799
841
Verifies the Signature on a message.
800
842
801
843
Parameters | Type | Description
802
844
--- | --- | ---
803
- __ message__ | ` Uint8Array ` | * Message in bytes to be signed.*
804
- __ signature__ | [ Signature] ( sdk-src_wasm.md ) | * Signature to be verified.*
845
+ __ params__ | ` Object ` | **
846
+ __ params.message__ | ` Uint8Array ` | * Message in bytes to be signed.*
847
+ __ params.signature__ | [ Signature] ( sdk-src_wasm.md ) | * Signature to be verified.*
805
848
__ * return* __ | ` boolean ` | * True if the signature is valid, false otherwise.*
806
849
807
850
#### Examples
@@ -811,14 +854,17 @@ __*return*__ | `boolean` | *True if the signature is valid, false otherwise.*
811
854
import { Account } from " @provablehq/sdk/testnet.js" ;
812
855
813
856
// Create a connection to the Aleo network and an account
814
- const account = Account .fromCiphertext (process .env .ciphertext , process .env .password );
857
+ const account = Account .fromCiphertext ({
858
+ ciphertext: process .env .ciphertext ,
859
+ password: process .env .password ,
860
+ });
815
861
816
862
// Sign a message.
817
863
const message = Uint8Array .from ([104 , 101 , 108 , 108 , 111 119 , 111 , 114 , 108 , 100 ])
818
864
const signature = account .sign (message);
819
865
820
866
// Verify the signature.
821
- assert (account .verify (message, signature));
867
+ assert (account .verify ({ message, signature } ));
822
868
```
823
869
824
870
---
0 commit comments