@zama-fhe/react-sdk 2.5.0-alpha.2 → 2.5.0-alpha.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.
Files changed (2) hide show
  1. package/README.md +8 -4
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -295,14 +295,18 @@ const { data: balance } = useConfidentialBalance({ tokenAddress: "0xTokenA" });
295
295
 
296
296
  #### `useIsAllowed`
297
297
 
298
- Check whether a session signature is cached and valid. Returns `true` if decrypt operations can proceed without a wallet prompt. Use this to conditionally enable UI elements (e.g. a "Reveal Balances" button).
298
+ Check whether a session signature is cached, valid, and scoped to the contract addresses you want to decrypt. Returns `true` if decrypt operations can proceed without a wallet prompt. Use this to conditionally enable UI elements (e.g. a "Reveal Balances" button).
299
299
 
300
300
  ```ts
301
- function useIsAllowed(): UseQueryResult<boolean, Error>;
301
+ function useIsAllowed(config: {
302
+ contractAddresses: [Address, ...Address[]];
303
+ }): UseQueryResult<boolean, Error>;
302
304
  ```
303
305
 
304
306
  ```tsx
305
- const { data: allowed } = useIsAllowed();
307
+ const { data: allowed } = useIsAllowed({
308
+ contractAddresses: ["0xTokenA"],
309
+ });
306
310
 
307
311
  <button disabled={!allowed}>Reveal Balance</button>;
308
312
  ```
@@ -854,7 +858,7 @@ FHE decrypt credentials are generated once per wallet + contract set and cached
854
858
  3. **Page reload** — Encrypted credentials are loaded from storage; the wallet is prompted once to re-sign for the session.
855
859
  4. **Expiry** — Credentials expire based on `keypairTTL` (default: 2592000s = 30 days). After expiry, the next decrypt regenerates and re-prompts.
856
860
  5. **Pre-authorization** — Call `useAllow(contractAddresses)` early to batch-authorize all contracts in one wallet prompt, avoiding repeated popups.
857
- 6. **Check status** — Use `useIsAllowed()` to conditionally enable UI elements (e.g. disable "Reveal" until allowed).
861
+ 6. **Check status** — Use `useIsAllowed({ contractAddresses })` to conditionally enable UI elements (e.g. disable "Reveal" until allowed).
858
862
  7. **Disconnect** — Call `useRevoke(contractAddresses)` or `await credentials.revoke()` to clear the session signature from memory.
859
863
 
860
864
  ### Web Extension Support
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zama-fhe/react-sdk",
3
- "version": "2.5.0-alpha.2",
3
+ "version": "2.5.0-alpha.3",
4
4
  "description": "React hooks for Zama SDK",
5
5
  "license": "BSD-3-Clause-Clear",
6
6
  "author": "Zama",
@@ -64,7 +64,7 @@
64
64
  },
65
65
  "peerDependencies": {
66
66
  "@tanstack/react-query": ">=5",
67
- "@zama-fhe/sdk": "^2.5.0-alpha.2",
67
+ "@zama-fhe/sdk": "^2.5.0-alpha.3",
68
68
  "react": ">=18",
69
69
  "viem": "^2.47.0",
70
70
  "wagmi": ">=2"