Skip to content

Commit e0fa35d

Browse files
committed
updated docs
1 parent 920aa1d commit e0fa35d

File tree

4 files changed

+448
-13
lines changed

4 files changed

+448
-13
lines changed

docs/api_reference/sdk-src_account.md

Lines changed: 114 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -285,6 +285,61 @@ const decryptedRecords = account.decryptRecords(records);
285285

286286
---
287287

288+
### `generateRecordViewKey(recordCiphertext) ► Field`
289+
290+
![modifier: public](images/badges/modifier-public.svg)
291+
292+
Generates a record view key from the account owner's view key and the record ciphertext.
293+
This key can be used to decrypt the record without revealing the account's view key.
294+
295+
Parameters | Type | Description
296+
--- | --- | ---
297+
__recordCiphertext__ | [RecordCiphertext](sdk-src_wasm.md) | *The record ciphertext to generate the view key for*
298+
__*return*__ | [Field](sdk-src_wasm.md) | *The record view key*
299+
300+
#### Examples
301+
302+
```javascript
303+
// Import the Account class
304+
import { Account } from "@provablehq/sdk/testnet.js";
305+
306+
// Create an account object from a previously encrypted ciphertext and password.
307+
const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
308+
309+
// Generate a record view key from the account's view key and a record ciphertext
310+
const recordCiphertext = RecordCiphertext.fromString("your_record_ciphertext_here");
311+
const recordViewKey = account.generateRecordViewKey(recordCiphertext);
312+
```
313+
314+
---
315+
316+
### `generateTransitionViewKey(tpk) ► Field`
317+
318+
![modifier: public](images/badges/modifier-public.svg)
319+
320+
Generates a transition view key from the account owner's view key and the transition public key.
321+
This key can be used to decrypt the private inputs and outputs of a the transition without
322+
revealing the account's view key.
323+
324+
Parameters | Type | Description
325+
--- | --- | ---
326+
__tpk__ | `string` | *The transition public key*
327+
__*return*__ | [Field](sdk-src_wasm.md) | *The transition view key*
328+
329+
#### Examples
330+
331+
```javascript
332+
// Import the Account class
333+
import { Account } from "@provablehq/sdk/testnet.js";
334+
335+
// Generate a transition view key from the account's view key and a transition public key
336+
const tpk = Group.fromString("your_transition_public_key_here");
337+
338+
const transitionViewKey = account.generateTransitionViewKey(tpk);
339+
```
340+
341+
---
342+
288343
### `ownsRecordCiphertext(ciphertext) ► boolean`
289344

290345
![modifier: public](images/badges/modifier-public.svg)
@@ -449,23 +504,21 @@ const viewKey = account.viewKey();
449504

450505
---
451506

452-
### `computeKey() ► ComputeKey`
507+
### `computeKey() ► Field`
453508

454509
![modifier: public](images/badges/modifier-public.svg)
455510

456-
Returns the ComputeKey associated with the account.
511+
Returns the Transition View Key associated with the transition public key.
457512

458513
Parameters | Type | Description
459514
--- | --- | ---
460-
__*return*__ | `ComputeKey` | *The compute key of the account*
515+
__*return*__ | [Field](sdk-src_wasm.md) | *The transition view key*
461516

462517
#### Examples
463518

464519
```javascript
465520
import { Account } from "@provablehq/sdk/testnet.js";
466-
467-
const account = new Account();
468-
const computeKey = account.computeKey();
521+
const account =
469522
```
470523

471524
---
@@ -614,6 +667,61 @@ const decryptedRecords = account.decryptRecords(records);
614667

615668
---
616669

670+
### `generateRecordViewKey(recordCiphertext) ► Field`
671+
672+
![modifier: public](images/badges/modifier-public.svg)
673+
674+
Generates a record view key from the account owner's view key and the record ciphertext.
675+
This key can be used to decrypt the record without revealing the account's view key.
676+
677+
Parameters | Type | Description
678+
--- | --- | ---
679+
__recordCiphertext__ | [RecordCiphertext](sdk-src_wasm.md) | *The record ciphertext to generate the view key for*
680+
__*return*__ | [Field](sdk-src_wasm.md) | *The record view key*
681+
682+
#### Examples
683+
684+
```javascript
685+
// Import the Account class
686+
import { Account } from "@provablehq/sdk/testnet.js";
687+
688+
// Create an account object from a previously encrypted ciphertext and password.
689+
const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
690+
691+
// Generate a record view key from the account's view key and a record ciphertext
692+
const recordCiphertext = RecordCiphertext.fromString("your_record_ciphertext_here");
693+
const recordViewKey = account.generateRecordViewKey(recordCiphertext);
694+
```
695+
696+
---
697+
698+
### `generateTransitionViewKey(tpk) ► Field`
699+
700+
![modifier: public](images/badges/modifier-public.svg)
701+
702+
Generates a transition view key from the account owner's view key and the transition public key.
703+
This key can be used to decrypt the private inputs and outputs of a the transition without
704+
revealing the account's view key.
705+
706+
Parameters | Type | Description
707+
--- | --- | ---
708+
__tpk__ | `string` | *The transition public key*
709+
__*return*__ | [Field](sdk-src_wasm.md) | *The transition view key*
710+
711+
#### Examples
712+
713+
```javascript
714+
// Import the Account class
715+
import { Account } from "@provablehq/sdk/testnet.js";
716+
717+
// Generate a transition view key from the account's view key and a transition public key
718+
const tpk = Group.fromString("your_transition_public_key_here");
719+
720+
const transitionViewKey = account.generateTransitionViewKey(tpk);
721+
```
722+
723+
---
724+
617725
### `ownsRecordCiphertext(ciphertext) ► boolean`
618726

619727
![modifier: public](images/badges/modifier-public.svg)

docs/api_reference/sdk-src_network-client.md

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,55 @@ networkClient.setHost("http://api.explorer.provable.com/v1");
8585

8686
---
8787

88+
### `setHeader(headerName, value)`
89+
90+
![modifier: public](images/badges/modifier-public.svg)
91+
92+
Set a header in the `AleoNetworkClient`s header map
93+
94+
Parameters | Type | Description
95+
--- | --- | ---
96+
__headerName__ | `string` | *The name of the header to set*
97+
__value__ | `string` | *The header value*
98+
99+
#### Examples
100+
101+
```javascript
102+
import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
103+
104+
// Create a networkClient
105+
const networkClient = new AleoNetworkClient();
106+
107+
// Set the value of the `Accept-Language` header to `en-US`
108+
networkClient.setHeader('Accept-Language', 'en-US');
109+
```
110+
111+
---
112+
113+
### `removeHeader(headerName)`
114+
115+
![modifier: public](images/badges/modifier-public.svg)
116+
117+
Remove a header from the `AleoNetworkClient`s header map
118+
119+
Parameters | Type | Description
120+
--- | --- | ---
121+
__headerName__ | `string` | *The name of the header to be removed*
122+
123+
#### Examples
124+
125+
```javascript
126+
import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
127+
128+
// Create a networkClient
129+
const networkClient = new AleoNetworkClient();
130+
131+
// Remove the default `X-Aleo-SDK-Version` header
132+
networkClient.removeHeader('X-Aleo-SDK-Version');
133+
```
134+
135+
---
136+
88137
### `fetchData(url)`
89138

90139
![modifier: public](images/badges/modifier-public.svg)
@@ -1058,6 +1107,55 @@ networkClient.setHost("http://api.explorer.provable.com/v1");
10581107
10591108
---
10601109
1110+
### `setHeader(headerName, value)`
1111+
1112+
![modifier: public](images/badges/modifier-public.svg)
1113+
1114+
Set a header in the `AleoNetworkClient`s header map
1115+
1116+
Parameters | Type | Description
1117+
--- | --- | ---
1118+
__headerName__ | `string` | *The name of the header to set*
1119+
__value__ | `string` | *The header value*
1120+
1121+
#### Examples
1122+
1123+
```javascript
1124+
import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
1125+
1126+
// Create a networkClient
1127+
const networkClient = new AleoNetworkClient();
1128+
1129+
// Set the value of the `Accept-Language` header to `en-US`
1130+
networkClient.setHeader('Accept-Language', 'en-US');
1131+
```
1132+
1133+
---
1134+
1135+
### `removeHeader(headerName)`
1136+
1137+
![modifier: public](images/badges/modifier-public.svg)
1138+
1139+
Remove a header from the `AleoNetworkClient`s header map
1140+
1141+
Parameters | Type | Description
1142+
--- | --- | ---
1143+
__headerName__ | `string` | *The name of the header to be removed*
1144+
1145+
#### Examples
1146+
1147+
```javascript
1148+
import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
1149+
1150+
// Create a networkClient
1151+
const networkClient = new AleoNetworkClient();
1152+
1153+
// Remove the default `X-Aleo-SDK-Version` header
1154+
networkClient.removeHeader('X-Aleo-SDK-Version');
1155+
```
1156+
1157+
---
1158+
10611159
### `fetchData(url) ► Promise.<Type>`
10621160
10631161
![modifier: public](images/badges/modifier-public.svg)
@@ -1967,3 +2065,31 @@ const transaction = await networkClient.waitForTransactionConfirmation(transacti
19672065
```
19682066
19692067
---
2068+
2069+
### `_sendPost(url, options) ► `
2070+
2071+
![modifier: private](images/badges/modifier-private.svg)
2072+
2073+
Wrapper around the POST helper to allow mocking in tests. Not meant for use in production.
2074+
2075+
Parameters | Type | Description
2076+
--- | --- | ---
2077+
__url__ | `undefined` | *The URL to POST to.*
2078+
__options__ | `undefined` | *The RequestInit options for the POST request.*
2079+
__*return*__ | `undefined` | *The Response object from the POST request.*
2080+
2081+
---
2082+
2083+
### `_sendPost(url, options) ► `
2084+
2085+
![modifier: private](images/badges/modifier-private.svg)
2086+
2087+
Wrapper around the POST helper to allow mocking in tests. Not meant for use in production.
2088+
2089+
Parameters | Type | Description
2090+
--- | --- | ---
2091+
__url__ | `undefined` | *The URL to POST to.*
2092+
__options__ | `undefined` | *The RequestInit options for the POST request.*
2093+
__*return*__ | `undefined` | *The Response object from the POST request.*
2094+
2095+
---

0 commit comments

Comments
 (0)