@provablehq/sdk 0.11.8 → 0.11.9
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/api-auth.d.cts +3 -1
- package/dist/mainnet/api-auth.d.ts +3 -1
- package/dist/mainnet/browser.cjs +7 -4
- package/dist/mainnet/browser.cjs.map +1 -1
- package/dist/mainnet/browser.js +7 -4
- package/dist/mainnet/browser.js.map +1 -1
- package/dist/testnet/api-auth.d.cts +3 -1
- package/dist/testnet/api-auth.d.ts +3 -1
- package/dist/testnet/browser.cjs +7 -4
- package/dist/testnet/browser.cjs.map +1 -1
- package/dist/testnet/browser.js +7 -4
- package/dist/testnet/browser.js.map +1 -1
- package/package.json +2 -2
|
@@ -20,7 +20,9 @@ export declare const DEFAULT_API_KEY_HEADER = "X-API-Key";
|
|
|
20
20
|
* - `api-key` (edge.provable.com): a provisioned key is sent verbatim on every request in a
|
|
21
21
|
* header (default `X-API-Key`). There is no registration, minting, or refresh in this mode;
|
|
22
22
|
* a 401 means the key is invalid or revoked and retrying cannot help.
|
|
23
|
-
* - `none`: requests carry no auth headers.
|
|
23
|
+
* - `none`: requests carry no auth headers of their own. A token injected via
|
|
24
|
+
* `setJwtData` is still sent — the session-driven pattern, where an external
|
|
25
|
+
* session owns minting and hands a fresh token in before each request.
|
|
24
26
|
*/
|
|
25
27
|
export type ApiAuthConfig = {
|
|
26
28
|
mode: "jwt";
|
|
@@ -20,7 +20,9 @@ export declare const DEFAULT_API_KEY_HEADER = "X-API-Key";
|
|
|
20
20
|
* - `api-key` (edge.provable.com): a provisioned key is sent verbatim on every request in a
|
|
21
21
|
* header (default `X-API-Key`). There is no registration, minting, or refresh in this mode;
|
|
22
22
|
* a 401 means the key is invalid or revoked and retrying cannot help.
|
|
23
|
-
* - `none`: requests carry no auth headers.
|
|
23
|
+
* - `none`: requests carry no auth headers of their own. A token injected via
|
|
24
|
+
* `setJwtData` is still sent — the session-driven pattern, where an external
|
|
25
|
+
* session owns minting and hands a fresh token in before each request.
|
|
24
26
|
*/
|
|
25
27
|
export type ApiAuthConfig = {
|
|
26
28
|
mode: "jwt";
|
package/dist/mainnet/browser.cjs
CHANGED
|
@@ -1631,11 +1631,14 @@ class ApiAuth {
|
|
|
1631
1631
|
* both a usable token and the material to mint one.
|
|
1632
1632
|
*/
|
|
1633
1633
|
async headers() {
|
|
1634
|
-
if (this.config.mode === "none")
|
|
1635
|
-
return {};
|
|
1636
1634
|
if (this.config.mode === "api-key") {
|
|
1637
1635
|
return { [this.config.header ?? DEFAULT_API_KEY_HEADER]: this.config.value };
|
|
1638
1636
|
}
|
|
1637
|
+
if (this.config.mode === "none") {
|
|
1638
|
+
// A token injected via setJwtData authenticates even without mint
|
|
1639
|
+
// material: an external session owns minting and hands tokens in.
|
|
1640
|
+
return this.jwtData?.jwt ? { Authorization: this.jwtData.jwt } : {};
|
|
1641
|
+
}
|
|
1639
1642
|
const stale = !this.jwtData || Date.now() >= this.jwtData.expiration - FIVE_MINUTES;
|
|
1640
1643
|
if (stale) {
|
|
1641
1644
|
const { apiKey, consumerId } = this.config;
|
|
@@ -1751,7 +1754,7 @@ class AleoNetworkClient {
|
|
|
1751
1754
|
else {
|
|
1752
1755
|
this.headers = {
|
|
1753
1756
|
// This is replaced by the actual version by a Rollup plugin
|
|
1754
|
-
"X-Aleo-SDK-Version": "0.11.
|
|
1757
|
+
"X-Aleo-SDK-Version": "0.11.9",
|
|
1755
1758
|
"X-Aleo-environment": environment(),
|
|
1756
1759
|
};
|
|
1757
1760
|
}
|
|
@@ -1773,7 +1776,7 @@ class AleoNetworkClient {
|
|
|
1773
1776
|
else {
|
|
1774
1777
|
this.headers = {
|
|
1775
1778
|
// This is replaced by the actual version by a Rollup plugin
|
|
1776
|
-
"X-Aleo-SDK-Version": "0.11.
|
|
1779
|
+
"X-Aleo-SDK-Version": "0.11.9",
|
|
1777
1780
|
"X-Aleo-environment": environment(),
|
|
1778
1781
|
};
|
|
1779
1782
|
}
|