@provablehq/sdk 0.9.15-enc → 0.9.15-experimental
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 +0 -15
- package/dist/mainnet/browser.d.ts +2 -5
- package/dist/mainnet/browser.js +30 -429
- package/dist/mainnet/browser.js.map +1 -1
- package/dist/mainnet/models/provingResponse.d.ts +2 -48
- package/dist/mainnet/network-client.d.ts +2 -48
- package/dist/mainnet/node.js +1 -2
- package/dist/mainnet/node.js.map +1 -1
- package/dist/mainnet/record-scanner.d.ts +5 -53
- package/dist/testnet/account.d.ts +0 -15
- package/dist/testnet/browser.d.ts +2 -5
- package/dist/testnet/browser.js +30 -429
- package/dist/testnet/browser.js.map +1 -1
- package/dist/testnet/models/provingResponse.d.ts +2 -48
- package/dist/testnet/network-client.d.ts +2 -48
- package/dist/testnet/node.js +1 -2
- package/dist/testnet/node.js.map +1 -1
- package/dist/testnet/record-scanner.d.ts +5 -53
- package/package.json +2 -3
- package/dist/mainnet/models/cryptoBoxPubkey.d.ts +0 -4
- package/dist/mainnet/models/encryptedProvingRequest.d.ts +0 -4
- package/dist/mainnet/models/record-scanner/encryptedRegistrationRequest.d.ts +0 -8
- package/dist/mainnet/models/record-scanner/registrationResult.d.ts +0 -26
- package/dist/mainnet/security.d.ts +0 -38
- package/dist/testnet/models/cryptoBoxPubkey.d.ts +0 -4
- package/dist/testnet/models/encryptedProvingRequest.d.ts +0 -4
- package/dist/testnet/models/record-scanner/encryptedRegistrationRequest.d.ts +0 -8
- package/dist/testnet/models/record-scanner/registrationResult.d.ts +0 -26
- package/dist/testnet/security.d.ts +0 -38
|
@@ -1,51 +1,5 @@
|
|
|
1
|
-
import { TransactionJSON } from "./transaction/transactionJSON
|
|
2
|
-
/** HTTP status and optional message from snarkOS broadcast (Accepted/Rejected variants). */
|
|
3
|
-
export interface BroadcastResponse {
|
|
4
|
-
status_code: bigint | number;
|
|
5
|
-
message?: string;
|
|
6
|
-
}
|
|
7
|
-
/** Result of the optional broadcast step. Discriminated by `status`. */
|
|
8
|
-
export type BroadcastResult = {
|
|
9
|
-
status: "Accepted";
|
|
10
|
-
status_code: bigint | number;
|
|
11
|
-
message?: string;
|
|
12
|
-
} | {
|
|
13
|
-
status: "Rejected";
|
|
14
|
-
status_code: bigint | number;
|
|
15
|
-
message?: string;
|
|
16
|
-
} | {
|
|
17
|
-
status: "Failed";
|
|
18
|
-
message: string;
|
|
19
|
-
} | {
|
|
20
|
-
status: "Skipped";
|
|
21
|
-
};
|
|
22
|
-
/** Success response body for POST /prove (HTTP 200). */
|
|
1
|
+
import { TransactionJSON } from "./transaction/transactionJSON";
|
|
23
2
|
export interface ProvingResponse {
|
|
24
3
|
transaction: TransactionJSON;
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
/** Error response body for POST /prove (HTTP 400, 500, 503). Same shape for all error cases. */
|
|
28
|
-
export interface ProveApiErrorBody {
|
|
29
|
-
message: string;
|
|
30
|
-
}
|
|
31
|
-
/** Error thrown on prove API failure; `status` is set for retry logic (e.g. retryWithBackoff checks error.status >= 500). */
|
|
32
|
-
export interface ProvingRequestError extends Error {
|
|
33
|
-
status?: bigint | number;
|
|
34
|
-
}
|
|
35
|
-
/** Success variant of a proving request result. */
|
|
36
|
-
export interface ProvingSuccess {
|
|
37
|
-
ok: true;
|
|
38
|
-
data: ProvingResponse;
|
|
39
|
-
}
|
|
40
|
-
/** Failure variant of a proving request result (HTTP 400, 500, 503). */
|
|
41
|
-
export interface ProvingFailure {
|
|
42
|
-
ok: false;
|
|
43
|
-
status: bigint | number;
|
|
44
|
-
error: ProveApiErrorBody;
|
|
4
|
+
broadcast?: boolean;
|
|
45
5
|
}
|
|
46
|
-
/** Result of a proving request. Type used to give callers the ability to self-handle errors. */
|
|
47
|
-
export type ProvingResult = ProvingSuccess | ProvingFailure;
|
|
48
|
-
/** Type guard: value is a ProvingResponse. */
|
|
49
|
-
export declare function isProvingResponse(value: unknown): value is ProvingResponse;
|
|
50
|
-
/** Type guard: value is a ProveApiErrorBody. */
|
|
51
|
-
export declare function isProveApiErrorBody(value: unknown): value is ProveApiErrorBody;
|
|
@@ -3,7 +3,7 @@ import { BlockJSON } from "./models/blockJSON.js";
|
|
|
3
3
|
import { TransactionJSON } from "./models/transaction/transactionJSON.js";
|
|
4
4
|
import { Address, Plaintext, Program, ProvingRequest, RecordPlaintext, PrivateKey, Transaction } from "./wasm.js";
|
|
5
5
|
import { ConfirmedTransactionJSON } from "./models/confirmed_transaction.js";
|
|
6
|
-
import { ProvingResponse
|
|
6
|
+
import { ProvingResponse } from "./models/provingResponse.js";
|
|
7
7
|
type ProgramImports = {
|
|
8
8
|
[key: string]: string | Program;
|
|
9
9
|
};
|
|
@@ -11,8 +11,6 @@ interface AleoNetworkClientOptions {
|
|
|
11
11
|
headers?: {
|
|
12
12
|
[key: string]: string;
|
|
13
13
|
};
|
|
14
|
-
proverUri?: string;
|
|
15
|
-
recordScannerUri?: string;
|
|
16
14
|
}
|
|
17
15
|
/**
|
|
18
16
|
* Interface for the JWT data.
|
|
@@ -39,7 +37,6 @@ interface DelegatedProvingParams {
|
|
|
39
37
|
apiKey?: string;
|
|
40
38
|
consumerId?: string;
|
|
41
39
|
jwtData?: JWTData;
|
|
42
|
-
dpsPrivacy?: boolean;
|
|
43
40
|
}
|
|
44
41
|
/**
|
|
45
42
|
* Client library that encapsulates REST calls to publicly exposed endpoints of Aleo nodes. The methods provided in this
|
|
@@ -70,8 +67,6 @@ declare class AleoNetworkClient {
|
|
|
70
67
|
apiKey?: string;
|
|
71
68
|
consumerId?: string;
|
|
72
69
|
jwtData?: JWTData;
|
|
73
|
-
proverUri?: string;
|
|
74
|
-
recordScannerUri?: string;
|
|
75
70
|
constructor(host: string, options?: AleoNetworkClientOptions);
|
|
76
71
|
/**
|
|
77
72
|
* Set an account to use in networkClient calls
|
|
@@ -107,36 +102,6 @@ declare class AleoNetworkClient {
|
|
|
107
102
|
* networkClient.setHost("http://api.explorer.provable.com/v1");
|
|
108
103
|
*/
|
|
109
104
|
setHost(host: string): void;
|
|
110
|
-
/**
|
|
111
|
-
* Set a new uri for a remote prover.
|
|
112
|
-
*
|
|
113
|
-
* @param {string} proverUri The uri of the remote prover.
|
|
114
|
-
*
|
|
115
|
-
* @example
|
|
116
|
-
* import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
|
|
117
|
-
*
|
|
118
|
-
* // Create a networkClient that connects to the provable explorer api.
|
|
119
|
-
* const networkClient = new AleoNetworkClient("http://api.explorer.provable.com/v1", undefined);
|
|
120
|
-
*
|
|
121
|
-
* // Set the prover uri.
|
|
122
|
-
* networkClient.setProverUri("https://prover.provable.prove");
|
|
123
|
-
*/
|
|
124
|
-
setProverUri(proverUri: string): void;
|
|
125
|
-
/**
|
|
126
|
-
* Set a new uri for a remote record scanner.
|
|
127
|
-
*
|
|
128
|
-
* @param {string} recordScannerUri The uri of the remote record scanner.
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* import { AleoNetworkClient } from "@provablehq/sdk/mainnet.js";
|
|
132
|
-
*
|
|
133
|
-
* // Create a networkClient that connects to the provable explorer api.
|
|
134
|
-
* const networkClient = new AleoNetworkClient("http://api.explorer.provable.com/v1", undefined);
|
|
135
|
-
*
|
|
136
|
-
* // Set the record scanner uri.
|
|
137
|
-
* networkClient.setRecordScannerUri("https://scanner.provable.scan");
|
|
138
|
-
*/
|
|
139
|
-
setRecordScannerUri(recordScannerUri: string): void;
|
|
140
105
|
/**
|
|
141
106
|
* Set verbose errors to true or false for the `AleoNetworkClient`. When set to true, if `submitTransaction` fails, the failure responses will report descriptive information as to why the transaction failed.
|
|
142
107
|
*
|
|
@@ -797,23 +762,12 @@ declare class AleoNetworkClient {
|
|
|
797
762
|
*/
|
|
798
763
|
private refreshJwt;
|
|
799
764
|
/**
|
|
800
|
-
*
|
|
801
|
-
*/
|
|
802
|
-
private handleProvingResponse;
|
|
803
|
-
/**
|
|
804
|
-
* Submit a `ProvingRequest` to a remote proving service for delegated proving. If the broadcast flag of the `ProvingRequest` is set to `true` the remote service will attempt to broadcast the result `Transaction` on behalf of the requestor. Throws on HTTP 400, 500, 503 (and retries on 500/503). Callers should {@link submitProvingRequestSafe} to handle proving request failures without throwing.
|
|
765
|
+
* Submit a `ProvingRequest` to a remote proving service for delegated proving. If the broadcast flag of the `ProvingRequest` is set to `true` the remote service will attempt to broadcast the result `Transaction` on behalf of the requestor.
|
|
805
766
|
*
|
|
806
767
|
* @param {DelegatedProvingParams} options - The optional parameters required to submit a proving request.
|
|
807
768
|
* @returns {Promise<ProvingResponse>} The ProvingResponse containing the transaction result and the result of the broadcast if the `broadcast` flag was set to `true`.
|
|
808
769
|
*/
|
|
809
770
|
submitProvingRequest(options: DelegatedProvingParams): Promise<ProvingResponse>;
|
|
810
|
-
/**
|
|
811
|
-
* Submit a proving request and return a result object instead of throwing. This method is usable when callers want to handle HTTP status (400, 500, 503) yourself. Retries on 500/503 and returns on 200 or 400.
|
|
812
|
-
*
|
|
813
|
-
* @param {DelegatedProvingParams} options - The optional parameters required to submit a proving request.
|
|
814
|
-
* @returns {Promise<ProvingResult>} `{ ok: true, data }` on success (200), or `{ ok: false, status, error }` on 400/500/503. Check `result.ok` and then either `result.data` or `result.status` / `result.error.message`.
|
|
815
|
-
*/
|
|
816
|
-
submitProvingRequestSafe(options: DelegatedProvingParams): Promise<ProvingResult>;
|
|
817
771
|
/**
|
|
818
772
|
* Await a submitted transaction to be confirmed or rejected on the Aleo network.
|
|
819
773
|
*
|
package/dist/testnet/node.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import './node-polyfill.js';
|
|
2
|
-
export { Account, AleoKeyProvider, AleoKeyProviderParams, AleoNetworkClient, BlockHeightSearch, CREDITS_PROGRAM_KEYS, KEY_STORE, NetworkRecordProvider, OfflineKeyProvider, OfflineSearchParams, PRIVATE_TO_PUBLIC_TRANSFER, PRIVATE_TRANSFER, PRIVATE_TRANSFER_TYPES, PUBLIC_TO_PRIVATE_TRANSFER, PUBLIC_TRANSFER, PUBLIC_TRANSFER_AS_SIGNER, ProgramManager, RECORD_DOMAIN, RecordScanner, SealanceMerkleTree, VALID_TRANSFER_TYPES,
|
|
2
|
+
export { Account, AleoKeyProvider, AleoKeyProviderParams, AleoNetworkClient, BlockHeightSearch, CREDITS_PROGRAM_KEYS, KEY_STORE, NetworkRecordProvider, OfflineKeyProvider, OfflineSearchParams, PRIVATE_TO_PUBLIC_TRANSFER, PRIVATE_TRANSFER, PRIVATE_TRANSFER_TYPES, PUBLIC_TO_PRIVATE_TRANSFER, PUBLIC_TRANSFER, PUBLIC_TRANSFER_AS_SIGNER, ProgramManager, RECORD_DOMAIN, RecordScanner, SealanceMerkleTree, VALID_TRANSFER_TYPES, initializeWasm, logAndThrow } from './browser.js';
|
|
3
3
|
export { Address, Authorization, BHP1024, BHP256, BHP512, BHP768, Boolean, Ciphertext, ComputeKey, EncryptionToolkit, ExecutionRequest, ExecutionResponse, Field, Execution as FunctionExecution, GraphKey, Group, I128, I16, I32, I64, I8, OfflineQuery, Pedersen128, Pedersen64, Plaintext, Poseidon2, Poseidon4, Poseidon8, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, ProvingRequest, RecordCiphertext, RecordPlaintext, Scalar, Signature, Transaction, Transition, U128, U16, U32, U64, U8, VerifyingKey, ViewKey, getOrInitConsensusVersionTestHeights, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/testnet.js';
|
|
4
4
|
import 'core-js/proposals/json-parse-with-source.js';
|
|
5
5
|
import 'node:crypto';
|
|
@@ -8,6 +8,5 @@ import 'mime/lite';
|
|
|
8
8
|
import 'xmlhttprequest-ssl';
|
|
9
9
|
import 'node:worker_threads';
|
|
10
10
|
import 'node:os';
|
|
11
|
-
import 'libsodium-wrappers';
|
|
12
11
|
import '@scure/base';
|
|
13
12
|
//# sourceMappingURL=node.js.map
|
package/dist/testnet/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"node.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -1,29 +1,17 @@
|
|
|
1
1
|
import { EncryptedRecord } from "./models/record-provider/encryptedRecord";
|
|
2
|
-
import { CryptoBoxPubKey } from "./models/cryptoBoxPubkey.js";
|
|
3
2
|
import { OwnedFilter } from "./models/record-scanner/ownedFilter";
|
|
4
3
|
import { OwnedRecord } from "./models/record-provider/ownedRecord";
|
|
5
4
|
import { RecordProvider } from "./record-provider";
|
|
6
5
|
import { Field, ViewKey } from "./wasm";
|
|
7
6
|
import { RecordsFilter } from "./models/record-scanner/recordsFilter";
|
|
8
|
-
import {
|
|
7
|
+
import { RegistrationResponse } from "./models/record-scanner/registrationResponse";
|
|
9
8
|
import { StatusResponse } from "./models/record-scanner/statusResponse";
|
|
10
|
-
/**
|
|
11
|
-
* JWT data for optional authentication with the record scanning service (e.g. Provable API).
|
|
12
|
-
*/
|
|
13
|
-
export interface RecordScannerJWTData {
|
|
14
|
-
jwt: string;
|
|
15
|
-
expiration: number;
|
|
16
|
-
}
|
|
17
9
|
type RecordScannerOptions = {
|
|
18
10
|
url: string;
|
|
19
11
|
apiKey?: string | {
|
|
20
12
|
header: string;
|
|
21
13
|
value: string;
|
|
22
14
|
};
|
|
23
|
-
/** Required for JWT refresh when using authenticated record scanner (e.g. Provable API). */
|
|
24
|
-
consumerId?: string;
|
|
25
|
-
/** Optional JWT for auth. If omitted and apiKey + consumerId are set, JWT is refreshed when needed. */
|
|
26
|
-
jwtData?: RecordScannerJWTData;
|
|
27
15
|
};
|
|
28
16
|
/**
|
|
29
17
|
* RecordScanner is a RecordProvider implementation that uses the record scanner service to find records.
|
|
@@ -34,8 +22,7 @@ type RecordScannerOptions = {
|
|
|
34
22
|
* const recordScanner = new RecordScanner({ url: "https://record-scanner.aleo.org" });
|
|
35
23
|
* recordScanner.setAccount(account);
|
|
36
24
|
* recordScanner.setApiKey("your-api-key");
|
|
37
|
-
* const
|
|
38
|
-
* if (result.ok) { const uuid = result.data.uuid; }
|
|
25
|
+
* const uuid = await recordScanner.register(0);
|
|
39
26
|
*
|
|
40
27
|
* const filter = {
|
|
41
28
|
* uuid,
|
|
@@ -71,8 +58,6 @@ declare class RecordScanner implements RecordProvider {
|
|
|
71
58
|
readonly url: string;
|
|
72
59
|
private apiKey?;
|
|
73
60
|
private uuid?;
|
|
74
|
-
private consumerId?;
|
|
75
|
-
private jwtData?;
|
|
76
61
|
constructor(options: RecordScannerOptions);
|
|
77
62
|
/**
|
|
78
63
|
* Set the API key to use for the record scanner.
|
|
@@ -83,22 +68,6 @@ declare class RecordScanner implements RecordProvider {
|
|
|
83
68
|
header: string;
|
|
84
69
|
value: string;
|
|
85
70
|
}): Promise<void>;
|
|
86
|
-
/**
|
|
87
|
-
* Set the consumer ID used for JWT refresh when using authenticated record scanner (e.g. Provable API).
|
|
88
|
-
*/
|
|
89
|
-
setConsumerId(consumerId: string): Promise<void>;
|
|
90
|
-
/**
|
|
91
|
-
* Set JWT data for authentication. Optional; when not set, JWT can be refreshed from apiKey + consumerId if provided.
|
|
92
|
-
*/
|
|
93
|
-
setJwtData(jwtData: RecordScannerJWTData | undefined): Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* Refreshes the JWT by making a POST request to /jwts/{consumer_id}. Used when authentication is required.
|
|
96
|
-
*/
|
|
97
|
-
private refreshJwt;
|
|
98
|
-
/**
|
|
99
|
-
* Returns auth headers (e.g. Authorization with JWT). Refreshes JWT if expired and apiKey + consumerId are set. Empty when auth is not configured.
|
|
100
|
-
*/
|
|
101
|
-
private getAuthHeaders;
|
|
102
71
|
/**
|
|
103
72
|
* Set the UUID to use for the record scanner.
|
|
104
73
|
*
|
|
@@ -106,28 +75,12 @@ declare class RecordScanner implements RecordProvider {
|
|
|
106
75
|
*/
|
|
107
76
|
setUuid(uuidOrViewKey: Field | ViewKey): Promise<void>;
|
|
108
77
|
/**
|
|
109
|
-
* Register the account with the record scanner service
|
|
110
|
-
*
|
|
111
|
-
* @param {ViewKey} viewKey The view key to register.
|
|
112
|
-
* @param {number} startBlock The block height to start scanning from.
|
|
113
|
-
* @returns {Promise<RegisterResult>} `{ ok: true, data }` on success, or `{ ok: false, status, error }` on failure.
|
|
114
|
-
*/
|
|
115
|
-
register(viewKey: ViewKey, startBlock: number): Promise<RegisterResult>;
|
|
116
|
-
/**
|
|
117
|
-
* Fetches an ephemeral public key from the record scanner service for use with registerEncrypted.
|
|
118
|
-
* Follows the same pattern as the delegated proving service /pubkey endpoint.
|
|
119
|
-
*
|
|
120
|
-
* @returns {Promise<CryptoBoxPubKey>} The service's ephemeral public key and key_id.
|
|
121
|
-
*/
|
|
122
|
-
getPubkey(): Promise<CryptoBoxPubKey>;
|
|
123
|
-
/**
|
|
124
|
-
* Registers the account with the record scanner service using the encrypted flow: 1. fetches an ephemeral public key from /pubkey - 2. encrypts the registration request (view key + start block) - 3. POSTs to /register/encrypted. Does not HTTP error on a proper error response from the record scanner; returns a result object instead.
|
|
78
|
+
* Register the account with the record scanner service.
|
|
125
79
|
*
|
|
126
|
-
* @param {ViewKey} viewKey The view key to register.
|
|
127
80
|
* @param {number} startBlock The block height to start scanning from.
|
|
128
|
-
* @returns {Promise<
|
|
81
|
+
* @returns {Promise<RegistrationResponse>} The response from the record scanner service.
|
|
129
82
|
*/
|
|
130
|
-
|
|
83
|
+
register(viewKey: ViewKey, startBlock: number): Promise<RegistrationResponse>;
|
|
131
84
|
/**
|
|
132
85
|
* Get encrypted records from the record scanner service.
|
|
133
86
|
*
|
|
@@ -188,7 +141,6 @@ declare class RecordScanner implements RecordProvider {
|
|
|
188
141
|
findCreditsRecords(microcreditAmounts: number[], searchParameters: OwnedFilter): Promise<OwnedRecord[]>;
|
|
189
142
|
/**
|
|
190
143
|
* Wrapper function to make a request to the record scanner service and handle any errors.
|
|
191
|
-
* Optionally adds JWT Authorization header when consumerId/jwtData (or apiKey+consumerId) are configured.
|
|
192
144
|
*
|
|
193
145
|
* @param {Request} req The request to make.
|
|
194
146
|
* @returns {Promise<Response>} The response.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@provablehq/sdk",
|
|
3
|
-
"version": "0.9.15-
|
|
3
|
+
"version": "0.9.15-experimental",
|
|
4
4
|
"description": "A Software Development Kit (SDK) for Zero-Knowledge Transactions",
|
|
5
5
|
"collaborators": [
|
|
6
6
|
"The Provable Team"
|
|
@@ -51,12 +51,11 @@
|
|
|
51
51
|
},
|
|
52
52
|
"homepage": "https://github.com/ProvableHQ/sdk#readme",
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@provablehq/wasm": "0.9.15-
|
|
54
|
+
"@provablehq/wasm": "^0.9.15-experimental",
|
|
55
55
|
"@scure/base": "^2.0.0",
|
|
56
56
|
"comlink": "^4.4.2",
|
|
57
57
|
"core-js": "^3.40.0",
|
|
58
58
|
"mime": "^4.0.6",
|
|
59
|
-
"libsodium-wrappers": "^0.8.2",
|
|
60
59
|
"xmlhttprequest-ssl": "^4.0.0"
|
|
61
60
|
},
|
|
62
61
|
"devDependencies": {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { RegistrationResponse } from "./registrationResponse.js";
|
|
2
|
-
/**
|
|
3
|
-
* Error thrown when a record scanner request fails (e.g. /register, /register/encrypted).
|
|
4
|
-
* Includes HTTP status so callers can handle 422 vs 500 etc.
|
|
5
|
-
*/
|
|
6
|
-
export declare class RecordScannerRequestError extends Error {
|
|
7
|
-
readonly status: number;
|
|
8
|
-
constructor(message: string, status: number);
|
|
9
|
-
}
|
|
10
|
-
/** Error payload for registration failure result (/register and /register/encrypted). */
|
|
11
|
-
export interface RegistrationErrorBody {
|
|
12
|
-
message: string;
|
|
13
|
-
}
|
|
14
|
-
/** Success variant of registration result. */
|
|
15
|
-
export interface RegisterSuccess {
|
|
16
|
-
ok: true;
|
|
17
|
-
data: RegistrationResponse;
|
|
18
|
-
}
|
|
19
|
-
/** Failure variant of registration result. */
|
|
20
|
-
export interface RegisterFailure {
|
|
21
|
-
ok: false;
|
|
22
|
-
status: number;
|
|
23
|
-
error: RegistrationErrorBody;
|
|
24
|
-
}
|
|
25
|
-
/** Result of register() and registerEncrypted(); never throws on HTTP error. */
|
|
26
|
-
export type RegisterResult = RegisterSuccess | RegisterFailure;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ViewKey, Authorization, ProvingRequest } from "@provablehq/wasm";
|
|
2
|
-
/**
|
|
3
|
-
* Encrypt an authorization with a libsodium cryptobox public key.
|
|
4
|
-
*
|
|
5
|
-
* @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
|
|
6
|
-
* @param {Authorization} authorization the authorization to encrypt.
|
|
7
|
-
*
|
|
8
|
-
* @returns {string} the encrypted authorization in RFC 4648 standard Base64.
|
|
9
|
-
*/
|
|
10
|
-
export declare function encryptAuthorization(publicKey: string, authorization: Authorization): string;
|
|
11
|
-
/**
|
|
12
|
-
* Encrypt a ProvingRequest with a libsodium cryptobox public key.
|
|
13
|
-
*
|
|
14
|
-
* @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
|
|
15
|
-
* @param {Authorization} provingRequest the ProvingRequest to encrypt.
|
|
16
|
-
*
|
|
17
|
-
* @returns {string} the encrypted ProvingRequest in RFC 4648 standard Base64.
|
|
18
|
-
*/
|
|
19
|
-
export declare function encryptProvingRequest(publicKey: string, provingRequest: ProvingRequest): string;
|
|
20
|
-
/**
|
|
21
|
-
* Encrypt a view key with a libsodium cryptobox public key.
|
|
22
|
-
*
|
|
23
|
-
* @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
|
|
24
|
-
* @param {ViewKey} viewKey the view key to encrypt.
|
|
25
|
-
*
|
|
26
|
-
* @returns {string} the encrypted view key in RFC 4648 standard Base64.
|
|
27
|
-
*/
|
|
28
|
-
export declare function encryptViewKey(publicKey: string, viewKey: ViewKey): string;
|
|
29
|
-
/**
|
|
30
|
-
* Encrypt a record scanner registration request.
|
|
31
|
-
*
|
|
32
|
-
* @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
|
|
33
|
-
* @param {ViewKey} viewKey the view key to encrypt.
|
|
34
|
-
* @param {number} start the start height of the registration request.
|
|
35
|
-
*
|
|
36
|
-
* @returns {string} the encrypted view key in RFC 4648 standard Base64.
|
|
37
|
-
*/
|
|
38
|
-
export declare function encryptRegistrationRequest(publicKey: string, viewKey: ViewKey, start: number): string;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { RegistrationResponse } from "./registrationResponse.js";
|
|
2
|
-
/**
|
|
3
|
-
* Error thrown when a record scanner request fails (e.g. /register, /register/encrypted).
|
|
4
|
-
* Includes HTTP status so callers can handle 422 vs 500 etc.
|
|
5
|
-
*/
|
|
6
|
-
export declare class RecordScannerRequestError extends Error {
|
|
7
|
-
readonly status: number;
|
|
8
|
-
constructor(message: string, status: number);
|
|
9
|
-
}
|
|
10
|
-
/** Error payload for registration failure result (/register and /register/encrypted). */
|
|
11
|
-
export interface RegistrationErrorBody {
|
|
12
|
-
message: string;
|
|
13
|
-
}
|
|
14
|
-
/** Success variant of registration result. */
|
|
15
|
-
export interface RegisterSuccess {
|
|
16
|
-
ok: true;
|
|
17
|
-
data: RegistrationResponse;
|
|
18
|
-
}
|
|
19
|
-
/** Failure variant of registration result. */
|
|
20
|
-
export interface RegisterFailure {
|
|
21
|
-
ok: false;
|
|
22
|
-
status: number;
|
|
23
|
-
error: RegistrationErrorBody;
|
|
24
|
-
}
|
|
25
|
-
/** Result of register() and registerEncrypted(); never throws on HTTP error. */
|
|
26
|
-
export type RegisterResult = RegisterSuccess | RegisterFailure;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { ViewKey, Authorization, ProvingRequest } from "@provablehq/wasm";
|
|
2
|
-
/**
|
|
3
|
-
* Encrypt an authorization with a libsodium cryptobox public key.
|
|
4
|
-
*
|
|
5
|
-
* @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
|
|
6
|
-
* @param {Authorization} authorization the authorization to encrypt.
|
|
7
|
-
*
|
|
8
|
-
* @returns {string} the encrypted authorization in RFC 4648 standard Base64.
|
|
9
|
-
*/
|
|
10
|
-
export declare function encryptAuthorization(publicKey: string, authorization: Authorization): string;
|
|
11
|
-
/**
|
|
12
|
-
* Encrypt a ProvingRequest with a libsodium cryptobox public key.
|
|
13
|
-
*
|
|
14
|
-
* @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
|
|
15
|
-
* @param {Authorization} provingRequest the ProvingRequest to encrypt.
|
|
16
|
-
*
|
|
17
|
-
* @returns {string} the encrypted ProvingRequest in RFC 4648 standard Base64.
|
|
18
|
-
*/
|
|
19
|
-
export declare function encryptProvingRequest(publicKey: string, provingRequest: ProvingRequest): string;
|
|
20
|
-
/**
|
|
21
|
-
* Encrypt a view key with a libsodium cryptobox public key.
|
|
22
|
-
*
|
|
23
|
-
* @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
|
|
24
|
-
* @param {ViewKey} viewKey the view key to encrypt.
|
|
25
|
-
*
|
|
26
|
-
* @returns {string} the encrypted view key in RFC 4648 standard Base64.
|
|
27
|
-
*/
|
|
28
|
-
export declare function encryptViewKey(publicKey: string, viewKey: ViewKey): string;
|
|
29
|
-
/**
|
|
30
|
-
* Encrypt a record scanner registration request.
|
|
31
|
-
*
|
|
32
|
-
* @param {string} publicKey The cryptobox X25519 public key to encrypt with (encoded in RFC 4648 standard Base64).
|
|
33
|
-
* @param {ViewKey} viewKey the view key to encrypt.
|
|
34
|
-
* @param {number} start the start height of the registration request.
|
|
35
|
-
*
|
|
36
|
-
* @returns {string} the encrypted view key in RFC 4648 standard Base64.
|
|
37
|
-
*/
|
|
38
|
-
export declare function encryptRegistrationRequest(publicKey: string, viewKey: ViewKey, start: number): string;
|