@chipi-stack/chipi-react 14.11.0 → 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.d.mts
CHANGED
|
@@ -14,6 +14,12 @@ import '@chipi-stack/core';
|
|
|
14
14
|
interface PasskeyAdapter {
|
|
15
15
|
getWalletEncryptKey: (input: {
|
|
16
16
|
externalUserId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Scope the prompt to one credential. Optional, and additive: an adapter
|
|
19
|
+
* written before this field existed keeps compiling and simply ignores it,
|
|
20
|
+
* which is the pre-existing behavior.
|
|
21
|
+
*/
|
|
22
|
+
credentialId?: string;
|
|
17
23
|
}) => Promise<string | null>;
|
|
18
24
|
}
|
|
19
25
|
interface ChipiContextValue {
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,12 @@ import '@chipi-stack/core';
|
|
|
14
14
|
interface PasskeyAdapter {
|
|
15
15
|
getWalletEncryptKey: (input: {
|
|
16
16
|
externalUserId: string;
|
|
17
|
+
/**
|
|
18
|
+
* Scope the prompt to one credential. Optional, and additive: an adapter
|
|
19
|
+
* written before this field existed keeps compiling and simply ignores it,
|
|
20
|
+
* which is the pre-existing behavior.
|
|
21
|
+
*/
|
|
22
|
+
credentialId?: string;
|
|
17
23
|
}) => Promise<string | null>;
|
|
18
24
|
}
|
|
19
25
|
interface ChipiContextValue {
|
package/dist/index.js
CHANGED
|
@@ -43,9 +43,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
43
43
|
var ChipiContext = React.createContext(null);
|
|
44
44
|
var defaultPasskeyAdapter = {
|
|
45
45
|
// Web default: attempts passkey auth, returns null on failure (caller uses PIN backup)
|
|
46
|
-
getWalletEncryptKey: async () => {
|
|
46
|
+
getWalletEncryptKey: async ({ credentialId } = { externalUserId: "" }) => {
|
|
47
47
|
try {
|
|
48
|
-
return await chipiPasskey.getWalletEncryptKey();
|
|
48
|
+
return await chipiPasskey.getWalletEncryptKey(credentialId);
|
|
49
49
|
} catch (error) {
|
|
50
50
|
console.warn(
|
|
51
51
|
"[ChipiProvider] Passkey auth failed, falling back to PIN:",
|
|
@@ -773,7 +773,8 @@ function useTransfer(config3) {
|
|
|
773
773
|
throw new Error("externalUserId is required when usePasskey is true");
|
|
774
774
|
}
|
|
775
775
|
const passkeyKey = await passkeyAdapter.getWalletEncryptKey({
|
|
776
|
-
externalUserId: input.params.externalUserId
|
|
776
|
+
externalUserId: input.params.externalUserId,
|
|
777
|
+
credentialId: input.params.credentialId
|
|
777
778
|
});
|
|
778
779
|
if (passkeyKey) {
|
|
779
780
|
encryptKey = passkeyKey;
|
|
@@ -804,6 +805,8 @@ function useTransfer(config3) {
|
|
|
804
805
|
const {
|
|
805
806
|
usePasskey: _usePasskey,
|
|
806
807
|
externalUserId: _externalUserId,
|
|
808
|
+
// Client-only: scopes the WebAuthn prompt. Never sent to the API.
|
|
809
|
+
credentialId: _credentialId,
|
|
807
810
|
...transferParams
|
|
808
811
|
} = input.params;
|
|
809
812
|
return chipiSDK.transfer({
|
|
@@ -839,7 +842,8 @@ function useApprove() {
|
|
|
839
842
|
}
|
|
840
843
|
try {
|
|
841
844
|
const key = await passkeyAdapter.getWalletEncryptKey({
|
|
842
|
-
externalUserId: params.params.externalUserId
|
|
845
|
+
externalUserId: params.params.externalUserId,
|
|
846
|
+
credentialId: params.params.credentialId
|
|
843
847
|
});
|
|
844
848
|
if (!key) {
|
|
845
849
|
throw new Error("Passkey authentication was cancelled");
|
|
@@ -860,6 +864,8 @@ function useApprove() {
|
|
|
860
864
|
const {
|
|
861
865
|
usePasskey: _usePasskey,
|
|
862
866
|
externalUserId: _externalUserId,
|
|
867
|
+
// Client-only: scopes the WebAuthn prompt. Never sent to the API.
|
|
868
|
+
credentialId: _credentialId,
|
|
863
869
|
...approveParams
|
|
864
870
|
} = params.params;
|
|
865
871
|
return chipiSDK.approve({
|
|
@@ -1212,7 +1218,8 @@ function useCallAnyContract() {
|
|
|
1212
1218
|
}
|
|
1213
1219
|
try {
|
|
1214
1220
|
const key = await passkeyAdapter.getWalletEncryptKey({
|
|
1215
|
-
externalUserId: params.params.externalUserId
|
|
1221
|
+
externalUserId: params.params.externalUserId,
|
|
1222
|
+
credentialId: params.params.credentialId
|
|
1216
1223
|
});
|
|
1217
1224
|
if (!key) {
|
|
1218
1225
|
throw new Error("Passkey authentication was cancelled");
|
|
@@ -1234,6 +1241,8 @@ function useCallAnyContract() {
|
|
|
1234
1241
|
const {
|
|
1235
1242
|
usePasskey: _usePasskey,
|
|
1236
1243
|
externalUserId: _externalUserId,
|
|
1244
|
+
// Client-only: scopes the WebAuthn prompt. Never sent to the API.
|
|
1245
|
+
credentialId: _credentialId,
|
|
1237
1246
|
...contractParams
|
|
1238
1247
|
} = params.params;
|
|
1239
1248
|
return chipiSDK.callAnyContract({
|