@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 +28 -0
- package/dist/hooks.js +12 -3
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +12 -3
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -19,9 +19,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
19
19
|
var ChipiContext = createContext(null);
|
|
20
20
|
var defaultPasskeyAdapter = {
|
|
21
21
|
// Web default: attempts passkey auth, returns null on failure (caller uses PIN backup)
|
|
22
|
-
getWalletEncryptKey: async () => {
|
|
22
|
+
getWalletEncryptKey: async ({ credentialId } = { externalUserId: "" }) => {
|
|
23
23
|
try {
|
|
24
|
-
return await getWalletEncryptKey();
|
|
24
|
+
return await getWalletEncryptKey(credentialId);
|
|
25
25
|
} catch (error) {
|
|
26
26
|
console.warn(
|
|
27
27
|
"[ChipiProvider] Passkey auth failed, falling back to PIN:",
|
|
@@ -749,7 +749,8 @@ function useTransfer(config3) {
|
|
|
749
749
|
throw new Error("externalUserId is required when usePasskey is true");
|
|
750
750
|
}
|
|
751
751
|
const passkeyKey = await passkeyAdapter.getWalletEncryptKey({
|
|
752
|
-
externalUserId: input.params.externalUserId
|
|
752
|
+
externalUserId: input.params.externalUserId,
|
|
753
|
+
credentialId: input.params.credentialId
|
|
753
754
|
});
|
|
754
755
|
if (passkeyKey) {
|
|
755
756
|
encryptKey = passkeyKey;
|
|
@@ -780,6 +781,8 @@ function useTransfer(config3) {
|
|
|
780
781
|
const {
|
|
781
782
|
usePasskey: _usePasskey,
|
|
782
783
|
externalUserId: _externalUserId,
|
|
784
|
+
// Client-only: scopes the WebAuthn prompt. Never sent to the API.
|
|
785
|
+
credentialId: _credentialId,
|
|
783
786
|
...transferParams
|
|
784
787
|
} = input.params;
|
|
785
788
|
return chipiSDK.transfer({
|
|
@@ -815,7 +818,8 @@ function useApprove() {
|
|
|
815
818
|
}
|
|
816
819
|
try {
|
|
817
820
|
const key = await passkeyAdapter.getWalletEncryptKey({
|
|
818
|
-
externalUserId: params.params.externalUserId
|
|
821
|
+
externalUserId: params.params.externalUserId,
|
|
822
|
+
credentialId: params.params.credentialId
|
|
819
823
|
});
|
|
820
824
|
if (!key) {
|
|
821
825
|
throw new Error("Passkey authentication was cancelled");
|
|
@@ -836,6 +840,8 @@ function useApprove() {
|
|
|
836
840
|
const {
|
|
837
841
|
usePasskey: _usePasskey,
|
|
838
842
|
externalUserId: _externalUserId,
|
|
843
|
+
// Client-only: scopes the WebAuthn prompt. Never sent to the API.
|
|
844
|
+
credentialId: _credentialId,
|
|
839
845
|
...approveParams
|
|
840
846
|
} = params.params;
|
|
841
847
|
return chipiSDK.approve({
|
|
@@ -1188,7 +1194,8 @@ function useCallAnyContract() {
|
|
|
1188
1194
|
}
|
|
1189
1195
|
try {
|
|
1190
1196
|
const key = await passkeyAdapter.getWalletEncryptKey({
|
|
1191
|
-
externalUserId: params.params.externalUserId
|
|
1197
|
+
externalUserId: params.params.externalUserId,
|
|
1198
|
+
credentialId: params.params.credentialId
|
|
1192
1199
|
});
|
|
1193
1200
|
if (!key) {
|
|
1194
1201
|
throw new Error("Passkey authentication was cancelled");
|
|
@@ -1210,6 +1217,8 @@ function useCallAnyContract() {
|
|
|
1210
1217
|
const {
|
|
1211
1218
|
usePasskey: _usePasskey,
|
|
1212
1219
|
externalUserId: _externalUserId,
|
|
1220
|
+
// Client-only: scopes the WebAuthn prompt. Never sent to the API.
|
|
1221
|
+
credentialId: _credentialId,
|
|
1213
1222
|
...contractParams
|
|
1214
1223
|
} = params.params;
|
|
1215
1224
|
return chipiSDK.callAnyContract({
|