@provablehq/sdk 0.11.8 → 0.11.10
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.cts +3 -3
- package/dist/mainnet/account.d.ts +3 -3
- package/dist/mainnet/api-auth.d.cts +14 -7
- package/dist/mainnet/api-auth.d.ts +14 -7
- package/dist/mainnet/browser.cjs +550 -193
- package/dist/mainnet/browser.cjs.map +1 -1
- package/dist/mainnet/browser.d.cts +1 -1
- package/dist/mainnet/browser.d.ts +1 -1
- package/dist/mainnet/browser.js +550 -194
- package/dist/mainnet/browser.js.map +1 -1
- package/dist/mainnet/keys/provider/interface.d.cts +4 -4
- package/dist/mainnet/keys/provider/interface.d.ts +4 -4
- package/dist/mainnet/keys/provider/memory.d.cts +6 -6
- package/dist/mainnet/keys/provider/memory.d.ts +6 -6
- package/dist/mainnet/keys/provider/offline.d.cts +1 -1
- package/dist/mainnet/keys/provider/offline.d.ts +1 -1
- package/dist/mainnet/network-client.d.cts +40 -38
- package/dist/mainnet/network-client.d.ts +40 -38
- package/dist/mainnet/node.cjs +1 -0
- package/dist/mainnet/node.cjs.map +1 -1
- package/dist/mainnet/node.js +1 -1
- package/dist/mainnet/program-manager.d.cts +132 -35
- package/dist/mainnet/program-manager.d.ts +132 -35
- package/dist/mainnet/record-provider.d.cts +7 -7
- package/dist/mainnet/record-provider.d.ts +7 -7
- package/dist/mainnet/record-scanner.d.cts +3 -3
- package/dist/mainnet/record-scanner.d.ts +3 -3
- package/dist/testnet/account.d.cts +3 -3
- package/dist/testnet/account.d.ts +3 -3
- package/dist/testnet/api-auth.d.cts +14 -7
- package/dist/testnet/api-auth.d.ts +14 -7
- package/dist/testnet/browser.cjs +550 -193
- package/dist/testnet/browser.cjs.map +1 -1
- package/dist/testnet/browser.d.cts +1 -1
- package/dist/testnet/browser.d.ts +1 -1
- package/dist/testnet/browser.js +550 -194
- package/dist/testnet/browser.js.map +1 -1
- package/dist/testnet/keys/provider/interface.d.cts +4 -4
- package/dist/testnet/keys/provider/interface.d.ts +4 -4
- package/dist/testnet/keys/provider/memory.d.cts +6 -6
- package/dist/testnet/keys/provider/memory.d.ts +6 -6
- package/dist/testnet/keys/provider/offline.d.cts +1 -1
- package/dist/testnet/keys/provider/offline.d.ts +1 -1
- package/dist/testnet/network-client.d.cts +40 -38
- package/dist/testnet/network-client.d.ts +40 -38
- package/dist/testnet/node.cjs +1 -0
- package/dist/testnet/node.cjs.map +1 -1
- package/dist/testnet/node.js +1 -1
- package/dist/testnet/program-manager.d.cts +132 -35
- package/dist/testnet/program-manager.d.ts +132 -35
- package/dist/testnet/record-provider.d.cts +7 -7
- package/dist/testnet/record-provider.d.ts +7 -7
- package/dist/testnet/record-scanner.d.cts +3 -3
- package/dist/testnet/record-scanner.d.ts +3 -3
- package/package.json +2 -2
|
@@ -171,7 +171,7 @@ export declare class Account {
|
|
|
171
171
|
* import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
|
|
172
172
|
*
|
|
173
173
|
* // Create a connection to the Aleo network and an account
|
|
174
|
-
* const networkClient = new AleoNetworkClient("https://
|
|
174
|
+
* const networkClient = new AleoNetworkClient("https://edge.provable.com/api/v2");
|
|
175
175
|
* const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
|
|
176
176
|
*
|
|
177
177
|
* // Get the record ciphertexts from a transaction.
|
|
@@ -198,7 +198,7 @@ export declare class Account {
|
|
|
198
198
|
* import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
|
|
199
199
|
*
|
|
200
200
|
* // Create a connection to the Aleo network and an account
|
|
201
|
-
* const networkClient = new AleoNetworkClient("https://
|
|
201
|
+
* const networkClient = new AleoNetworkClient("https://edge.provable.com/api/v2");
|
|
202
202
|
* const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
|
|
203
203
|
*
|
|
204
204
|
* // Get the record ciphertexts from a transaction.
|
|
@@ -254,7 +254,7 @@ export declare class Account {
|
|
|
254
254
|
* import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
|
|
255
255
|
*
|
|
256
256
|
* // Create a connection to the Aleo network and an account
|
|
257
|
-
* const networkClient = new AleoNetworkClient("https://
|
|
257
|
+
* const networkClient = new AleoNetworkClient("https://edge.provable.com/api/v2");
|
|
258
258
|
* const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
|
|
259
259
|
*
|
|
260
260
|
* // Get the record ciphertexts from a transaction and check ownership of them.
|
|
@@ -171,7 +171,7 @@ export declare class Account {
|
|
|
171
171
|
* import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
|
|
172
172
|
*
|
|
173
173
|
* // Create a connection to the Aleo network and an account
|
|
174
|
-
* const networkClient = new AleoNetworkClient("https://
|
|
174
|
+
* const networkClient = new AleoNetworkClient("https://edge.provable.com/api/v2");
|
|
175
175
|
* const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
|
|
176
176
|
*
|
|
177
177
|
* // Get the record ciphertexts from a transaction.
|
|
@@ -198,7 +198,7 @@ export declare class Account {
|
|
|
198
198
|
* import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
|
|
199
199
|
*
|
|
200
200
|
* // Create a connection to the Aleo network and an account
|
|
201
|
-
* const networkClient = new AleoNetworkClient("https://
|
|
201
|
+
* const networkClient = new AleoNetworkClient("https://edge.provable.com/api/v2");
|
|
202
202
|
* const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
|
|
203
203
|
*
|
|
204
204
|
* // Get the record ciphertexts from a transaction.
|
|
@@ -254,7 +254,7 @@ export declare class Account {
|
|
|
254
254
|
* import { AleoNetworkClient, Account } from "@provablehq/sdk/testnet.js";
|
|
255
255
|
*
|
|
256
256
|
* // Create a connection to the Aleo network and an account
|
|
257
|
-
* const networkClient = new AleoNetworkClient("https://
|
|
257
|
+
* const networkClient = new AleoNetworkClient("https://edge.provable.com/api/v2");
|
|
258
258
|
* const account = Account.fromCiphertext(process.env.ciphertext!, process.env.password!);
|
|
259
259
|
*
|
|
260
260
|
* // Get the record ciphertexts from a transaction and check ownership of them.
|
|
@@ -14,13 +14,18 @@ export declare const DEFAULT_API_KEY_HEADER = "X-API-Key";
|
|
|
14
14
|
/**
|
|
15
15
|
* Authentication configuration for Provable API services.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* - `
|
|
17
|
+
* The SDK targets edge.provable.com/api by default. That gateway is unauthenticated: it never
|
|
18
|
+
* mints or accepts JWTs, and a provisioned key is optional. The legacy api.provable.com gateway
|
|
19
|
+
* authenticates with JWTs. The modes map onto the gateways as follows:
|
|
20
|
+
* - `none`: requests carry no auth headers of their own. This is the default for edge, and
|
|
21
|
+
* nothing ever calls `/jwts`. A token injected via `setJwtData` is still sent — the
|
|
22
|
+
* session-driven pattern, where an external session owns minting and hands a fresh token in.
|
|
23
|
+
* - `api-key`: edge with a provisioned key. The key is sent verbatim on every request in a
|
|
21
24
|
* header (default `X-API-Key`). There is no registration, minting, or refresh in this mode;
|
|
22
25
|
* a 401 means the key is invalid or revoked and retrying cannot help.
|
|
23
|
-
* - `
|
|
26
|
+
* - `jwt`: api.provable.com. The apiKey + consumerId pair mints a short-lived JWT at
|
|
27
|
+
* `/jwts/{consumerId}` which is sent as an `Authorization` header and refreshed near expiry.
|
|
28
|
+
* Edge has no `/jwts` route, so do not point a `jwt` configuration at it.
|
|
24
29
|
*/
|
|
25
30
|
export type ApiAuthConfig = {
|
|
26
31
|
mode: "jwt";
|
|
@@ -50,10 +55,12 @@ export interface LegacyAuthOptions {
|
|
|
50
55
|
/**
|
|
51
56
|
* Normalize legacy auth options into an explicit {@link ApiAuthConfig}.
|
|
52
57
|
*
|
|
53
|
-
* Rules
|
|
58
|
+
* Rules:
|
|
54
59
|
* - An explicit `auth` wins. Combining it with legacy fields throws — the caller's intent
|
|
55
60
|
* is ambiguous and guessing hides misconfiguration.
|
|
56
|
-
* - A string `apiKey`
|
|
61
|
+
* - A string `apiKey` on its own selects `api-key` mode with the default header: nothing can
|
|
62
|
+
* mint a JWT without a `consumerId`, so a lone key is a provisioned edge key.
|
|
63
|
+
* - A string `apiKey` with a `consumerId`, or a bare `jwtData`, selects `jwt` mode.
|
|
57
64
|
* - An `{ header, value }` apiKey selects `api-key` mode with that header. Combining it with
|
|
58
65
|
* a `consumerId` throws: keyed auth has no consumer and the pair would silently pick one.
|
|
59
66
|
* - Nothing configured selects `none`.
|
|
@@ -14,13 +14,18 @@ export declare const DEFAULT_API_KEY_HEADER = "X-API-Key";
|
|
|
14
14
|
/**
|
|
15
15
|
* Authentication configuration for Provable API services.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* - `
|
|
17
|
+
* The SDK targets edge.provable.com/api by default. That gateway is unauthenticated: it never
|
|
18
|
+
* mints or accepts JWTs, and a provisioned key is optional. The legacy api.provable.com gateway
|
|
19
|
+
* authenticates with JWTs. The modes map onto the gateways as follows:
|
|
20
|
+
* - `none`: requests carry no auth headers of their own. This is the default for edge, and
|
|
21
|
+
* nothing ever calls `/jwts`. A token injected via `setJwtData` is still sent — the
|
|
22
|
+
* session-driven pattern, where an external session owns minting and hands a fresh token in.
|
|
23
|
+
* - `api-key`: edge with a provisioned key. The key is sent verbatim on every request in a
|
|
21
24
|
* header (default `X-API-Key`). There is no registration, minting, or refresh in this mode;
|
|
22
25
|
* a 401 means the key is invalid or revoked and retrying cannot help.
|
|
23
|
-
* - `
|
|
26
|
+
* - `jwt`: api.provable.com. The apiKey + consumerId pair mints a short-lived JWT at
|
|
27
|
+
* `/jwts/{consumerId}` which is sent as an `Authorization` header and refreshed near expiry.
|
|
28
|
+
* Edge has no `/jwts` route, so do not point a `jwt` configuration at it.
|
|
24
29
|
*/
|
|
25
30
|
export type ApiAuthConfig = {
|
|
26
31
|
mode: "jwt";
|
|
@@ -50,10 +55,12 @@ export interface LegacyAuthOptions {
|
|
|
50
55
|
/**
|
|
51
56
|
* Normalize legacy auth options into an explicit {@link ApiAuthConfig}.
|
|
52
57
|
*
|
|
53
|
-
* Rules
|
|
58
|
+
* Rules:
|
|
54
59
|
* - An explicit `auth` wins. Combining it with legacy fields throws — the caller's intent
|
|
55
60
|
* is ambiguous and guessing hides misconfiguration.
|
|
56
|
-
* - A string `apiKey`
|
|
61
|
+
* - A string `apiKey` on its own selects `api-key` mode with the default header: nothing can
|
|
62
|
+
* mint a JWT without a `consumerId`, so a lone key is a provisioned edge key.
|
|
63
|
+
* - A string `apiKey` with a `consumerId`, or a bare `jwtData`, selects `jwt` mode.
|
|
57
64
|
* - An `{ header, value }` apiKey selects `api-key` mode with that header. Combining it with
|
|
58
65
|
* a `consumerId` throws: keyed auth has no consumer and the pair would silently pick one.
|
|
59
66
|
* - Nothing configured selects `none`.
|