@provablehq/sdk 0.9.1 → 0.9.3
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/dist/mainnet/account.d.ts +36 -1
- package/dist/mainnet/browser.d.ts +35 -35
- package/dist/mainnet/browser.js +52 -4
- package/dist/mainnet/browser.js.map +1 -1
- package/dist/mainnet/constants.d.ts +1 -1
- package/dist/mainnet/function-key-provider.d.ts +2 -2
- package/dist/mainnet/managed-worker.d.ts +1 -1
- package/dist/mainnet/models/authorization.d.ts +6 -0
- package/dist/mainnet/models/blockJSON.d.ts +3 -3
- package/dist/mainnet/models/confirmed_transaction.d.ts +2 -2
- package/dist/mainnet/models/deployment/deploymentObject.d.ts +1 -1
- package/dist/mainnet/models/execution/executionJSON.d.ts +1 -1
- package/dist/mainnet/models/execution/executionObject.d.ts +1 -1
- package/dist/mainnet/models/functionObject.d.ts +1 -1
- package/dist/mainnet/models/input/inputObject.d.ts +2 -2
- package/dist/mainnet/models/inputID.d.ts +4 -0
- package/dist/mainnet/models/output/outputObject.d.ts +2 -2
- package/dist/mainnet/models/owner/ownerObject.d.ts +1 -1
- package/dist/mainnet/models/plaintext/array.d.ts +2 -2
- package/dist/mainnet/models/plaintext/plaintext.d.ts +4 -4
- package/dist/mainnet/models/plaintext/struct.d.ts +2 -2
- package/dist/mainnet/models/request.d.ts +14 -0
- package/dist/mainnet/models/transaction/transactionJSON.d.ts +3 -3
- package/dist/mainnet/models/transaction/transactionObject.d.ts +3 -3
- package/dist/mainnet/models/transition/transitionJSON.d.ts +2 -2
- package/dist/mainnet/models/transition/transitionObject.d.ts +3 -3
- package/dist/mainnet/network-client.d.ts +5 -19
- package/dist/mainnet/node-polyfill.d.ts +5 -5
- package/dist/mainnet/node-polyfill.js.map +1 -1
- package/dist/mainnet/node.d.ts +2 -2
- package/dist/mainnet/node.js +2 -2
- package/dist/mainnet/offline-key-provider.d.ts +2 -2
- package/dist/mainnet/{program-manager-DMDKstZ8.js → program-manager-BfZnPCKl.js} +119 -18
- package/dist/mainnet/program-manager-BfZnPCKl.js.map +1 -0
- package/dist/mainnet/program-manager.d.ts +105 -9
- package/dist/mainnet/record-provider.d.ts +3 -3
- package/dist/mainnet/wasm.d.ts +1 -1
- package/dist/mainnet/worker.d.ts +2 -2
- package/dist/mainnet/worker.js +1 -1
- package/dist/mainnet/worker.js.map +1 -1
- package/dist/testnet/account.d.ts +36 -1
- package/dist/testnet/browser.d.ts +35 -35
- package/dist/testnet/browser.js +52 -4
- package/dist/testnet/browser.js.map +1 -1
- package/dist/testnet/constants.d.ts +1 -1
- package/dist/testnet/function-key-provider.d.ts +2 -2
- package/dist/testnet/managed-worker.d.ts +1 -1
- package/dist/testnet/models/authorization.d.ts +6 -0
- package/dist/testnet/models/blockJSON.d.ts +3 -3
- package/dist/testnet/models/confirmed_transaction.d.ts +2 -2
- package/dist/testnet/models/deployment/deploymentObject.d.ts +1 -1
- package/dist/testnet/models/execution/executionJSON.d.ts +1 -1
- package/dist/testnet/models/execution/executionObject.d.ts +1 -1
- package/dist/testnet/models/functionObject.d.ts +1 -1
- package/dist/testnet/models/input/inputObject.d.ts +2 -2
- package/dist/testnet/models/inputID.d.ts +4 -0
- package/dist/testnet/models/output/outputObject.d.ts +2 -2
- package/dist/testnet/models/owner/ownerObject.d.ts +1 -1
- package/dist/testnet/models/plaintext/array.d.ts +2 -2
- package/dist/testnet/models/plaintext/plaintext.d.ts +4 -4
- package/dist/testnet/models/plaintext/struct.d.ts +2 -2
- package/dist/testnet/models/request.d.ts +14 -0
- package/dist/testnet/models/transaction/transactionJSON.d.ts +3 -3
- package/dist/testnet/models/transaction/transactionObject.d.ts +3 -3
- package/dist/testnet/models/transition/transitionJSON.d.ts +2 -2
- package/dist/testnet/models/transition/transitionObject.d.ts +3 -3
- package/dist/testnet/network-client.d.ts +5 -19
- package/dist/testnet/node-polyfill.d.ts +5 -5
- package/dist/testnet/node-polyfill.js.map +1 -1
- package/dist/testnet/node.d.ts +2 -2
- package/dist/testnet/node.js +2 -2
- package/dist/testnet/offline-key-provider.d.ts +2 -2
- package/dist/testnet/{program-manager-BTHjM8b7.js → program-manager-kuhVcNPN.js} +119 -18
- package/dist/testnet/program-manager-kuhVcNPN.js.map +1 -0
- package/dist/testnet/program-manager.d.ts +105 -9
- package/dist/testnet/record-provider.d.ts +3 -3
- package/dist/testnet/wasm.d.ts +1 -1
- package/dist/testnet/worker.d.ts +2 -2
- package/dist/testnet/worker.js +1 -1
- package/dist/testnet/worker.js.map +1 -1
- package/package.json +2 -2
- package/dist/mainnet/program-manager-DMDKstZ8.js.map +0 -1
- package/dist/testnet/program-manager-BTHjM8b7.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Address, ComputeKey, PrivateKey, Signature, ViewKey, PrivateKeyCiphertext, RecordCiphertext, RecordPlaintext } from "./wasm";
|
|
1
|
+
import { Address, ComputeKey, Field, Group, PrivateKey, Signature, ViewKey, PrivateKeyCiphertext, RecordCiphertext, RecordPlaintext } from "./wasm.js";
|
|
2
2
|
interface AccountParam {
|
|
3
3
|
privateKey?: string;
|
|
4
4
|
seed?: Uint8Array;
|
|
@@ -182,6 +182,41 @@ export declare class Account {
|
|
|
182
182
|
* const decryptedRecords = account.decryptRecords(records);
|
|
183
183
|
*/
|
|
184
184
|
decryptRecords(ciphertexts: string[]): RecordPlaintext[];
|
|
185
|
+
/**
|
|
186
|
+
* Generates a record view key from the account owner's view key and the record ciphertext.
|
|
187
|
+
* This key can be used to decrypt the record without revealing the account's view key.
|
|
188
|
+
* @param {RecordCiphertext | string} recordCiphertext The record ciphertext to generate the view key for
|
|
189
|
+
* @returns {Field} The record view key
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* // Import the Account class
|
|
193
|
+
* import { Account } from "@provablehq/sdk/testnet.js";
|
|
194
|
+
*
|
|
195
|
+
* // Create an account object from a previously encrypted ciphertext and password.
|
|
196
|
+
* const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
|
|
197
|
+
*
|
|
198
|
+
* // Generate a record view key from the account's view key and a record ciphertext
|
|
199
|
+
* const recordCiphertext = RecordCiphertext.fromString("your_record_ciphertext_here");
|
|
200
|
+
* const recordViewKey = account.generateRecordViewKey(recordCiphertext);
|
|
201
|
+
*/
|
|
202
|
+
generateRecordViewKey(recordCiphertext: RecordCiphertext | string): Field;
|
|
203
|
+
/**
|
|
204
|
+
* Generates a transition view key from the account owner's view key and the transition public key.
|
|
205
|
+
* This key can be used to decrypt the private inputs and outputs of a the transition without
|
|
206
|
+
* revealing the account's view key.
|
|
207
|
+
* @param {string | Group} tpk The transition public key
|
|
208
|
+
* @returns {Field} The transition view key
|
|
209
|
+
*
|
|
210
|
+
* @example
|
|
211
|
+
* // Import the Account class
|
|
212
|
+
* import { Account } from "@provablehq/sdk/testnet.js";
|
|
213
|
+
*
|
|
214
|
+
* // Generate a transition view key from the account's view key and a transition public key
|
|
215
|
+
* const tpk = Group.fromString("your_transition_public_key_here");
|
|
216
|
+
*
|
|
217
|
+
* const transitionViewKey = account.generateTransitionViewKey(tpk);
|
|
218
|
+
*/
|
|
219
|
+
generateTransitionViewKey(tpk: string | Group): Field;
|
|
185
220
|
/**
|
|
186
221
|
* Determines whether the account owns a ciphertext record.
|
|
187
222
|
* @param {RecordCiphertext | string} ciphertext The record ciphertext to check ownership of
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import "./polyfill/shared";
|
|
2
|
-
import { Account } from "./account";
|
|
3
|
-
import { AleoNetworkClient, ProgramImports } from "./network-client";
|
|
4
|
-
import { BlockJSON, Header, Metadata } from "./models/blockJSON";
|
|
5
|
-
import { ConfirmedTransactionJSON } from "./models/confirmed_transaction";
|
|
6
|
-
import { DeploymentJSON, VerifyingKeys } from "./models/deployment/deploymentJSON";
|
|
7
|
-
import { DeploymentObject } from "./models/deployment/deploymentObject";
|
|
8
|
-
import { ExecutionJSON, FeeExecutionJSON } from "./models/execution/executionJSON";
|
|
9
|
-
import { ExecutionObject, FeeExecutionObject } from "./models/execution/executionObject";
|
|
10
|
-
import { FinalizeJSON } from "./models/finalizeJSON";
|
|
11
|
-
import { FunctionObject } from "./models/functionObject";
|
|
12
|
-
import { ImportedVerifyingKeys, ImportedPrograms } from "./models/imports";
|
|
13
|
-
import { InputJSON } from "./models/input/inputJSON";
|
|
14
|
-
import { InputObject } from "./models/input/inputObject";
|
|
15
|
-
import { OutputJSON } from "./models/output/outputJSON";
|
|
16
|
-
import { OutputObject } from "./models/output/outputObject";
|
|
17
|
-
import { OwnerJSON } from "./models/owner/ownerJSON";
|
|
18
|
-
import { PlaintextArray } from "./models/plaintext/array";
|
|
19
|
-
import { PlaintextLiteral } from "./models/plaintext/literal";
|
|
20
|
-
import { PlaintextObject } from "./models/plaintext/plaintext";
|
|
21
|
-
import { PlaintextStruct } from "./models/plaintext/struct";
|
|
22
|
-
import { RatificationJSON } from "./models/ratification";
|
|
23
|
-
import { SolutionsJSON, SolutionJSON, PartialSolutionJSON } from "./models/solution";
|
|
24
|
-
import { TransactionJSON } from "./models/transaction/transactionJSON";
|
|
25
|
-
import { TransactionObject } from "./models/transaction/transactionObject";
|
|
26
|
-
import { TransitionJSON } from "./models/transition/transitionJSON";
|
|
27
|
-
import { TransitionObject } from "./models/transition/transitionObject";
|
|
28
|
-
import { AleoKeyProvider, AleoKeyProviderParams, AleoKeyProviderInitParams, CachedKeyPair, FunctionKeyPair, FunctionKeyProvider, KeySearchParams } from "./function-key-provider";
|
|
29
|
-
import { OfflineKeyProvider, OfflineSearchParams } from "./offline-key-provider";
|
|
30
|
-
import { BlockHeightSearch, NetworkRecordProvider, RecordProvider, RecordSearchParams } from "./record-provider";
|
|
1
|
+
import "./polyfill/shared.js";
|
|
2
|
+
import { Account } from "./account.js";
|
|
3
|
+
import { AleoNetworkClient, ProgramImports } from "./network-client.js";
|
|
4
|
+
import { BlockJSON, Header, Metadata } from "./models/blockJSON.js";
|
|
5
|
+
import { ConfirmedTransactionJSON } from "./models/confirmed_transaction.js";
|
|
6
|
+
import { DeploymentJSON, VerifyingKeys } from "./models/deployment/deploymentJSON.js";
|
|
7
|
+
import { DeploymentObject } from "./models/deployment/deploymentObject.js";
|
|
8
|
+
import { ExecutionJSON, FeeExecutionJSON } from "./models/execution/executionJSON.js";
|
|
9
|
+
import { ExecutionObject, FeeExecutionObject } from "./models/execution/executionObject.js";
|
|
10
|
+
import { FinalizeJSON } from "./models/finalizeJSON.js";
|
|
11
|
+
import { FunctionObject } from "./models/functionObject.js";
|
|
12
|
+
import { ImportedVerifyingKeys, ImportedPrograms } from "./models/imports.js";
|
|
13
|
+
import { InputJSON } from "./models/input/inputJSON.js";
|
|
14
|
+
import { InputObject } from "./models/input/inputObject.js";
|
|
15
|
+
import { OutputJSON } from "./models/output/outputJSON.js";
|
|
16
|
+
import { OutputObject } from "./models/output/outputObject.js";
|
|
17
|
+
import { OwnerJSON } from "./models/owner/ownerJSON.js";
|
|
18
|
+
import { PlaintextArray } from "./models/plaintext/array.js";
|
|
19
|
+
import { PlaintextLiteral } from "./models/plaintext/literal.js";
|
|
20
|
+
import { PlaintextObject } from "./models/plaintext/plaintext.js";
|
|
21
|
+
import { PlaintextStruct } from "./models/plaintext/struct.js";
|
|
22
|
+
import { RatificationJSON } from "./models/ratification.js";
|
|
23
|
+
import { SolutionsJSON, SolutionJSON, PartialSolutionJSON } from "./models/solution.js";
|
|
24
|
+
import { TransactionJSON } from "./models/transaction/transactionJSON.js";
|
|
25
|
+
import { TransactionObject } from "./models/transaction/transactionObject.js";
|
|
26
|
+
import { TransitionJSON } from "./models/transition/transitionJSON.js";
|
|
27
|
+
import { TransitionObject } from "./models/transition/transitionObject.js";
|
|
28
|
+
import { AleoKeyProvider, AleoKeyProviderParams, AleoKeyProviderInitParams, CachedKeyPair, FunctionKeyPair, FunctionKeyProvider, KeySearchParams } from "./function-key-provider.js";
|
|
29
|
+
import { OfflineKeyProvider, OfflineSearchParams } from "./offline-key-provider.js";
|
|
30
|
+
import { BlockHeightSearch, NetworkRecordProvider, RecordProvider, RecordSearchParams } from "./record-provider.js";
|
|
31
31
|
declare function initializeWasm(): Promise<void>;
|
|
32
|
-
export { createAleoWorker } from "./managed-worker";
|
|
33
|
-
export { ProgramManager } from "./program-manager";
|
|
34
|
-
export { logAndThrow } from "./utils";
|
|
35
|
-
export { Address, BHP256, BHP512, BHP768, BHP1024, Ciphertext, ComputeKey, Execution as FunctionExecution, ExecutionResponse, Field, Group, OfflineQuery, Pedersen64, Pedersen128, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Signature, Scalar, Transaction, Transition, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution, } from "./wasm";
|
|
32
|
+
export { createAleoWorker } from "./managed-worker.js";
|
|
33
|
+
export { ProgramManager } from "./program-manager.js";
|
|
34
|
+
export { logAndThrow } from "./utils.js";
|
|
35
|
+
export { Address, Authorization, BHP256, BHP512, BHP768, BHP1024, Ciphertext, ComputeKey, Execution as FunctionExecution, ExecutionRequest, ExecutionResponse, EncryptionToolkit, Field, Group, OfflineQuery, Pedersen64, Pedersen128, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Signature, Scalar, Transaction, Transition, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution, } from "./wasm.js";
|
|
36
36
|
export { initializeWasm };
|
|
37
|
-
export { Key, CREDITS_PROGRAM_KEYS, KEY_STORE, PRIVATE_TRANSFER, PRIVATE_TO_PUBLIC_TRANSFER, PRIVATE_TRANSFER_TYPES, PUBLIC_TRANSFER, PUBLIC_TRANSFER_AS_SIGNER, PUBLIC_TO_PRIVATE_TRANSFER, VALID_TRANSFER_TYPES, } from "./constants";
|
|
37
|
+
export { Key, CREDITS_PROGRAM_KEYS, KEY_STORE, PRIVATE_TRANSFER, PRIVATE_TO_PUBLIC_TRANSFER, PRIVATE_TRANSFER_TYPES, PUBLIC_TRANSFER, PUBLIC_TRANSFER_AS_SIGNER, PUBLIC_TO_PRIVATE_TRANSFER, VALID_TRANSFER_TYPES, } from "./constants.js";
|
|
38
38
|
export { Account, AleoKeyProvider, AleoKeyProviderParams, AleoKeyProviderInitParams, AleoNetworkClient, BlockJSON, BlockHeightSearch, CachedKeyPair, ConfirmedTransactionJSON, DeploymentJSON, DeploymentObject, ExecutionJSON, ExecutionObject, FeeExecutionJSON, FeeExecutionObject, FinalizeJSON, FunctionObject, FunctionKeyPair, FunctionKeyProvider, Header, ImportedPrograms, ImportedVerifyingKeys, InputJSON, InputObject, KeySearchParams, Metadata, NetworkRecordProvider, OfflineKeyProvider, OfflineSearchParams, OutputJSON, OutputObject, OwnerJSON, PartialSolutionJSON, PlaintextArray, PlaintextLiteral, PlaintextObject, PlaintextStruct, ProgramImports, RatificationJSON, RecordProvider, RecordSearchParams, SolutionJSON, SolutionsJSON, TransactionJSON, TransactionObject, TransitionJSON, TransitionObject, VerifyingKeys, };
|
package/dist/mainnet/browser.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'core-js/proposals/json-parse-with-source.js';
|
|
2
|
-
import { ViewKey, ComputeKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, ProvingKey, VerifyingKey } from '@provablehq/wasm/mainnet.js';
|
|
3
|
-
export { Address, BHP1024, BHP256, BHP512, BHP768, Ciphertext, ComputeKey, ExecutionResponse, Field, Execution as FunctionExecution, Group, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/mainnet.js';
|
|
4
|
-
import { C as CREDITS_PROGRAM_KEYS, c as PRIVATE_TRANSFER, d as PRIVATE_TO_PUBLIC_TRANSFER, f as PUBLIC_TRANSFER, g as PUBLIC_TRANSFER_AS_SIGNER, h as PUBLIC_TO_PRIVATE_TRANSFER, l as logAndThrow } from './program-manager-
|
|
5
|
-
export { A as AleoKeyProvider, a as AleoKeyProviderParams, b as AleoNetworkClient, K as KEY_STORE, e as PRIVATE_TRANSFER_TYPES, P as ProgramManager, V as VALID_TRANSFER_TYPES } from './program-manager-
|
|
2
|
+
import { ViewKey, ComputeKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, EncryptionToolkit, Group, ProvingKey, VerifyingKey } from '@provablehq/wasm/mainnet.js';
|
|
3
|
+
export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Ciphertext, ComputeKey, EncryptionToolkit, ExecutionRequest, ExecutionResponse, Field, Execution as FunctionExecution, Group, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/mainnet.js';
|
|
4
|
+
import { C as CREDITS_PROGRAM_KEYS, c as PRIVATE_TRANSFER, d as PRIVATE_TO_PUBLIC_TRANSFER, f as PUBLIC_TRANSFER, g as PUBLIC_TRANSFER_AS_SIGNER, h as PUBLIC_TO_PRIVATE_TRANSFER, l as logAndThrow } from './program-manager-BfZnPCKl.js';
|
|
5
|
+
export { A as AleoKeyProvider, a as AleoKeyProviderParams, b as AleoNetworkClient, K as KEY_STORE, e as PRIVATE_TRANSFER_TYPES, P as ProgramManager, V as VALID_TRANSFER_TYPES } from './program-manager-BfZnPCKl.js';
|
|
6
6
|
import { wrap } from 'comlink';
|
|
7
7
|
|
|
8
8
|
/**
|
|
@@ -230,6 +230,54 @@ class Account {
|
|
|
230
230
|
decryptRecords(ciphertexts) {
|
|
231
231
|
return ciphertexts.map((ciphertext) => this._viewKey.decrypt(ciphertext));
|
|
232
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* Generates a record view key from the account owner's view key and the record ciphertext.
|
|
235
|
+
* This key can be used to decrypt the record without revealing the account's view key.
|
|
236
|
+
* @param {RecordCiphertext | string} recordCiphertext The record ciphertext to generate the view key for
|
|
237
|
+
* @returns {Field} The record view key
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* // Import the Account class
|
|
241
|
+
* import { Account } from "@provablehq/sdk/testnet.js";
|
|
242
|
+
*
|
|
243
|
+
* // Create an account object from a previously encrypted ciphertext and password.
|
|
244
|
+
* const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
|
|
245
|
+
*
|
|
246
|
+
* // Generate a record view key from the account's view key and a record ciphertext
|
|
247
|
+
* const recordCiphertext = RecordCiphertext.fromString("your_record_ciphertext_here");
|
|
248
|
+
* const recordViewKey = account.generateRecordViewKey(recordCiphertext);
|
|
249
|
+
*/
|
|
250
|
+
generateRecordViewKey(recordCiphertext) {
|
|
251
|
+
if (typeof recordCiphertext === 'string') {
|
|
252
|
+
recordCiphertext = RecordCiphertext.fromString(recordCiphertext);
|
|
253
|
+
}
|
|
254
|
+
if (!(recordCiphertext.isOwner(this._viewKey))) {
|
|
255
|
+
throw new Error("The record ciphertext does not belong to this account");
|
|
256
|
+
}
|
|
257
|
+
return EncryptionToolkit.generateRecordViewKey(this._viewKey, recordCiphertext);
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Generates a transition view key from the account owner's view key and the transition public key.
|
|
261
|
+
* This key can be used to decrypt the private inputs and outputs of a the transition without
|
|
262
|
+
* revealing the account's view key.
|
|
263
|
+
* @param {string | Group} tpk The transition public key
|
|
264
|
+
* @returns {Field} The transition view key
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* // Import the Account class
|
|
268
|
+
* import { Account } from "@provablehq/sdk/testnet.js";
|
|
269
|
+
*
|
|
270
|
+
* // Generate a transition view key from the account's view key and a transition public key
|
|
271
|
+
* const tpk = Group.fromString("your_transition_public_key_here");
|
|
272
|
+
*
|
|
273
|
+
* const transitionViewKey = account.generateTransitionViewKey(tpk);
|
|
274
|
+
*/
|
|
275
|
+
generateTransitionViewKey(tpk) {
|
|
276
|
+
if (typeof tpk === 'string') {
|
|
277
|
+
tpk = Group.fromString(tpk);
|
|
278
|
+
}
|
|
279
|
+
return EncryptionToolkit.generateTvk(this._viewKey, tpk);
|
|
280
|
+
}
|
|
233
281
|
/**
|
|
234
282
|
* Determines whether the account owns a ciphertext record.
|
|
235
283
|
* @param {RecordCiphertext | string} ciphertext The record ciphertext to check ownership of
|