@chipi-stack/chipi-react 14.10.1 → 14.12.0

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/README.md CHANGED
@@ -52,6 +52,34 @@ function Wallet() {
52
52
  }
53
53
  ```
54
54
 
55
+ ## Scoping the passkey prompt
56
+
57
+ `useCallAnyContract`, `useApprove` and `useTransfer` accept an optional
58
+ `credentialId` alongside `externalUserId`. It scopes the WebAuthn prompt to one
59
+ credential instead of letting the authenticator choose:
60
+
61
+ ```tsx
62
+ await callAnyContractAsync({
63
+ params: {
64
+ usePasskey: true,
65
+ externalUserId,
66
+ credentialId, // scopes the biometric prompt
67
+ wallet,
68
+ contractAddress,
69
+ calls,
70
+ },
71
+ bearerToken,
72
+ });
73
+ ```
74
+
75
+ Reach for it when a user holds more than one Chipi credential on the same
76
+ device, for example a wallet that was reset or a per-entity wallet, where the
77
+ unscoped prompt can resolve to the wrong credential and derive a key for the
78
+ wrong wallet.
79
+
80
+ Omitting it produces exactly the prompt you get today. `credentialId` is a
81
+ client-side concern and never reaches the API.
82
+
55
83
  ## What you can ship
56
84
 
57
85
  - **Crypto checkout components** — drop-in payment UIs for e-commerce and SaaS
package/dist/hooks.js CHANGED
@@ -723,7 +723,8 @@ function useTransfer(config3) {
723
723
  throw new Error("externalUserId is required when usePasskey is true");
724
724
  }
725
725
  const passkeyKey = await passkeyAdapter.getWalletEncryptKey({
726
- externalUserId: input.params.externalUserId
726
+ externalUserId: input.params.externalUserId,
727
+ credentialId: input.params.credentialId
727
728
  });
728
729
  if (passkeyKey) {
729
730
  encryptKey = passkeyKey;
@@ -754,6 +755,8 @@ function useTransfer(config3) {
754
755
  const {
755
756
  usePasskey: _usePasskey,
756
757
  externalUserId: _externalUserId,
758
+ // Client-only: scopes the WebAuthn prompt. Never sent to the API.
759
+ credentialId: _credentialId,
757
760
  ...transferParams
758
761
  } = input.params;
759
762
  return chipiSDK.transfer({
@@ -789,7 +792,8 @@ function useApprove() {
789
792
  }
790
793
  try {
791
794
  const key = await passkeyAdapter.getWalletEncryptKey({
792
- externalUserId: params.params.externalUserId
795
+ externalUserId: params.params.externalUserId,
796
+ credentialId: params.params.credentialId
793
797
  });
794
798
  if (!key) {
795
799
  throw new Error("Passkey authentication was cancelled");
@@ -810,6 +814,8 @@ function useApprove() {
810
814
  const {
811
815
  usePasskey: _usePasskey,
812
816
  externalUserId: _externalUserId,
817
+ // Client-only: scopes the WebAuthn prompt. Never sent to the API.
818
+ credentialId: _credentialId,
813
819
  ...approveParams
814
820
  } = params.params;
815
821
  return chipiSDK.approve({
@@ -1162,7 +1168,8 @@ function useCallAnyContract() {
1162
1168
  }
1163
1169
  try {
1164
1170
  const key = await passkeyAdapter.getWalletEncryptKey({
1165
- externalUserId: params.params.externalUserId
1171
+ externalUserId: params.params.externalUserId,
1172
+ credentialId: params.params.credentialId
1166
1173
  });
1167
1174
  if (!key) {
1168
1175
  throw new Error("Passkey authentication was cancelled");
@@ -1184,6 +1191,8 @@ function useCallAnyContract() {
1184
1191
  const {
1185
1192
  usePasskey: _usePasskey,
1186
1193
  externalUserId: _externalUserId,
1194
+ // Client-only: scopes the WebAuthn prompt. Never sent to the API.
1195
+ credentialId: _credentialId,
1187
1196
  ...contractParams
1188
1197
  } = params.params;
1189
1198
  return chipiSDK.callAnyContract({