@chipi-stack/chipi-react 14.15.0 → 14.15.1

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.
@@ -14,13 +14,39 @@ type CreateWalletInput = {
14
14
  /**
15
15
  * Hook for creating a new wallet.
16
16
  *
17
- * Supports dual-key wrapping: when `usePasskey: true` AND `encryptKey` (PIN) provided,
18
- * the private key is encrypted twice — once with the passkey-derived key (primary) and
19
- * once with the PIN (backup). If passkey fails later, PIN recovers the wallet.
17
+ * With `usePasskey: true` the hook creates a WebAuthn passkey and uses its PRF
18
+ * output, derived on the device, as the key that encrypts the private key. It
19
+ * stores the passkey's `credentialId` and `prfSupported` on the wallet so any
20
+ * device with the synced passkey can unlock it later with
21
+ * `getWalletEncryptKey(wallet.credentialId, { prfSupported: wallet.prfSupported })`.
22
+ * On a device without WebAuthn PRF it throws with `code: "PRF_UNSUPPORTED"`
23
+ * (the original `PrfUnsupportedError` is the `cause`) instead of creating a
24
+ * custodial wallet.
25
+ *
26
+ * - Passkey only (`usePasskey: true`, no `encryptKey`): `authMethod: "passkey"`.
27
+ * Recommended for self-custodial apps; the passkey's platform sync (iCloud
28
+ * Keychain, Google Password Manager) is the recovery path.
29
+ * - Passkey + PIN (`usePasskey: true` and `encryptKey`): `authMethod: "passkey+pin"`.
30
+ * The private key is encrypted twice, once with the passkey key (primary)
31
+ * and once with the PIN (backup). The backup is only as strong as the PIN,
32
+ * which can be brute-forced offline against the stored ciphertext.
33
+ * - PIN only (`encryptKey`, no `usePasskey`): `authMethod: "pin"`. Legacy.
34
+ *
35
+ * The passkey's user name (shown by the OS passkey picker) is `externalUserId`.
20
36
  *
21
37
  * @example
22
38
  * ```tsx
23
- * // Passkey + PIN (recommended)
39
+ * // Passkey only (recommended)
40
+ * await createWalletAsync({
41
+ * params: {
42
+ * externalUserId: userId,
43
+ * chain: Chain.STARKNET,
44
+ * usePasskey: true, // Creates the passkey; its PRF output encrypts the key
45
+ * },
46
+ * bearerToken,
47
+ * });
48
+ *
49
+ * // Passkey + PIN backup
24
50
  * await createWalletAsync({
25
51
  * params: {
26
52
  * encryptKey: pin, // PIN backup
@@ -31,7 +57,7 @@ type CreateWalletInput = {
31
57
  * bearerToken,
32
58
  * });
33
59
  *
34
- * // PIN only (backward compatible)
60
+ * // PIN only (legacy)
35
61
  * await createWalletAsync({
36
62
  * params: {
37
63
  * encryptKey: pin,
@@ -14,13 +14,39 @@ type CreateWalletInput = {
14
14
  /**
15
15
  * Hook for creating a new wallet.
16
16
  *
17
- * Supports dual-key wrapping: when `usePasskey: true` AND `encryptKey` (PIN) provided,
18
- * the private key is encrypted twice — once with the passkey-derived key (primary) and
19
- * once with the PIN (backup). If passkey fails later, PIN recovers the wallet.
17
+ * With `usePasskey: true` the hook creates a WebAuthn passkey and uses its PRF
18
+ * output, derived on the device, as the key that encrypts the private key. It
19
+ * stores the passkey's `credentialId` and `prfSupported` on the wallet so any
20
+ * device with the synced passkey can unlock it later with
21
+ * `getWalletEncryptKey(wallet.credentialId, { prfSupported: wallet.prfSupported })`.
22
+ * On a device without WebAuthn PRF it throws with `code: "PRF_UNSUPPORTED"`
23
+ * (the original `PrfUnsupportedError` is the `cause`) instead of creating a
24
+ * custodial wallet.
25
+ *
26
+ * - Passkey only (`usePasskey: true`, no `encryptKey`): `authMethod: "passkey"`.
27
+ * Recommended for self-custodial apps; the passkey's platform sync (iCloud
28
+ * Keychain, Google Password Manager) is the recovery path.
29
+ * - Passkey + PIN (`usePasskey: true` and `encryptKey`): `authMethod: "passkey+pin"`.
30
+ * The private key is encrypted twice, once with the passkey key (primary)
31
+ * and once with the PIN (backup). The backup is only as strong as the PIN,
32
+ * which can be brute-forced offline against the stored ciphertext.
33
+ * - PIN only (`encryptKey`, no `usePasskey`): `authMethod: "pin"`. Legacy.
34
+ *
35
+ * The passkey's user name (shown by the OS passkey picker) is `externalUserId`.
20
36
  *
21
37
  * @example
22
38
  * ```tsx
23
- * // Passkey + PIN (recommended)
39
+ * // Passkey only (recommended)
40
+ * await createWalletAsync({
41
+ * params: {
42
+ * externalUserId: userId,
43
+ * chain: Chain.STARKNET,
44
+ * usePasskey: true, // Creates the passkey; its PRF output encrypts the key
45
+ * },
46
+ * bearerToken,
47
+ * });
48
+ *
49
+ * // Passkey + PIN backup
24
50
  * await createWalletAsync({
25
51
  * params: {
26
52
  * encryptKey: pin, // PIN backup
@@ -31,7 +57,7 @@ type CreateWalletInput = {
31
57
  * bearerToken,
32
58
  * });
33
59
  *
34
- * // PIN only (backward compatible)
60
+ * // PIN only (legacy)
35
61
  * await createWalletAsync({
36
62
  * params: {
37
63
  * encryptKey: pin,
package/dist/index.d.mts CHANGED
@@ -4,8 +4,8 @@ import { ChipiSDK, NewOwnerInput } from '@chipi-stack/backend';
4
4
  import { ChipiSDKConfig, WalletType } from '@chipi-stack/types';
5
5
  export * from '@chipi-stack/types';
6
6
  export { Chain, ChainToken } from '@chipi-stack/types';
7
- import { C as ChipiWindowObjectDeps, U as UseChipiWalletObjectConfig } from './index-B8OIdrOX.mjs';
8
- export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, g as ChipiWalletData, a2 as PrivacyConfig, a3 as PrivacyKeys, a6 as PrivacyLedgerEvent, a4 as PrivacyStep, a7 as PrivateBalanceInput, R as RegisterSessionConfig, S as SessionState, k as SessionWallet, a5 as ShieldHookInput, Y as ThresholdSignState, i as UseChipiSessionConfig, j as UseChipiSessionReturn, e as UseChipiWalletConfig, f as UseChipiWalletReturn, T as UseGuardianRecoveryReturn, P as UseShhhSignerReturn, X as UseThresholdSignOptions, W as UseThresholdSignReturn, p as UseTransferConfig, M as UseX402PaymentConfig, N as UseX402PaymentReturn, a0 as derivePrivacyAccount, a1 as netPrivateBalance, H as useAddSessionKeyToContract, q as useApprove, A as useCallAnyContract, h as useChipiSession, d as useChipiWallet, D as useChipiWalletObject, G as useCreateSessionKey, u as useCreateWallet, K as useExecuteWithSession, J as useGetSessionData, z as useGetSku, y as useGetSkuList, x as useGetSkuPurchase, F as useGetTokenBalance, s as useGetTransaction, r as useGetTransactionList, t as useGetTransactionStatus, c as useGetWallet, Q as useGuardianRecovery, l as useMigrateWalletToPasskey, n as useMigrateWalletToShhh, $ as usePrivateBalance, w as usePurchaseSku, E as useRecordSendTransaction, I as useRevokeSessionKey, O as useShhhSigner, Z as useShield, B as useSignTypedData, v as useSyncOnChainTransfers, V as useThresholdSign, o as useTransfer, _ as useUnshield, m as useUpdateWalletEncryption, L as useX402Payment } from './index-B8OIdrOX.mjs';
7
+ import { C as ChipiWindowObjectDeps, U as UseChipiWalletObjectConfig } from './index-gNLTF6ix.mjs';
8
+ export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, g as ChipiWalletData, a2 as PrivacyConfig, a3 as PrivacyKeys, a6 as PrivacyLedgerEvent, a4 as PrivacyStep, a7 as PrivateBalanceInput, R as RegisterSessionConfig, S as SessionState, k as SessionWallet, a5 as ShieldHookInput, Y as ThresholdSignState, i as UseChipiSessionConfig, j as UseChipiSessionReturn, e as UseChipiWalletConfig, f as UseChipiWalletReturn, T as UseGuardianRecoveryReturn, P as UseShhhSignerReturn, X as UseThresholdSignOptions, W as UseThresholdSignReturn, p as UseTransferConfig, M as UseX402PaymentConfig, N as UseX402PaymentReturn, a0 as derivePrivacyAccount, a1 as netPrivateBalance, H as useAddSessionKeyToContract, q as useApprove, A as useCallAnyContract, h as useChipiSession, d as useChipiWallet, D as useChipiWalletObject, G as useCreateSessionKey, u as useCreateWallet, K as useExecuteWithSession, J as useGetSessionData, z as useGetSku, y as useGetSkuList, x as useGetSkuPurchase, F as useGetTokenBalance, s as useGetTransaction, r as useGetTransactionList, t as useGetTransactionStatus, c as useGetWallet, Q as useGuardianRecovery, l as useMigrateWalletToPasskey, n as useMigrateWalletToShhh, $ as usePrivateBalance, w as usePurchaseSku, E as useRecordSendTransaction, I as useRevokeSessionKey, O as useShhhSigner, Z as useShield, B as useSignTypedData, v as useSyncOnChainTransfers, V as useThresholdSign, o as useTransfer, _ as useUnshield, m as useUpdateWalletEncryption, L as useX402Payment } from './index-gNLTF6ix.mjs';
9
9
  import { StarknetWindowObject } from '@starknet-io/types-js';
10
10
  import '@tanstack/react-query';
11
11
  import 'starknet';
package/dist/index.d.ts CHANGED
@@ -4,8 +4,8 @@ import { ChipiSDK, NewOwnerInput } from '@chipi-stack/backend';
4
4
  import { ChipiSDKConfig, WalletType } from '@chipi-stack/types';
5
5
  export * from '@chipi-stack/types';
6
6
  export { Chain, ChainToken } from '@chipi-stack/types';
7
- import { C as ChipiWindowObjectDeps, U as UseChipiWalletObjectConfig } from './index-B8OIdrOX.js';
8
- export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, g as ChipiWalletData, a2 as PrivacyConfig, a3 as PrivacyKeys, a6 as PrivacyLedgerEvent, a4 as PrivacyStep, a7 as PrivateBalanceInput, R as RegisterSessionConfig, S as SessionState, k as SessionWallet, a5 as ShieldHookInput, Y as ThresholdSignState, i as UseChipiSessionConfig, j as UseChipiSessionReturn, e as UseChipiWalletConfig, f as UseChipiWalletReturn, T as UseGuardianRecoveryReturn, P as UseShhhSignerReturn, X as UseThresholdSignOptions, W as UseThresholdSignReturn, p as UseTransferConfig, M as UseX402PaymentConfig, N as UseX402PaymentReturn, a0 as derivePrivacyAccount, a1 as netPrivateBalance, H as useAddSessionKeyToContract, q as useApprove, A as useCallAnyContract, h as useChipiSession, d as useChipiWallet, D as useChipiWalletObject, G as useCreateSessionKey, u as useCreateWallet, K as useExecuteWithSession, J as useGetSessionData, z as useGetSku, y as useGetSkuList, x as useGetSkuPurchase, F as useGetTokenBalance, s as useGetTransaction, r as useGetTransactionList, t as useGetTransactionStatus, c as useGetWallet, Q as useGuardianRecovery, l as useMigrateWalletToPasskey, n as useMigrateWalletToShhh, $ as usePrivateBalance, w as usePurchaseSku, E as useRecordSendTransaction, I as useRevokeSessionKey, O as useShhhSigner, Z as useShield, B as useSignTypedData, v as useSyncOnChainTransfers, V as useThresholdSign, o as useTransfer, _ as useUnshield, m as useUpdateWalletEncryption, L as useX402Payment } from './index-B8OIdrOX.js';
7
+ import { C as ChipiWindowObjectDeps, U as UseChipiWalletObjectConfig } from './index-gNLTF6ix.js';
8
+ export { a as ChipiApprovalRequest, b as ChipiSessionPolicy, g as ChipiWalletData, a2 as PrivacyConfig, a3 as PrivacyKeys, a6 as PrivacyLedgerEvent, a4 as PrivacyStep, a7 as PrivateBalanceInput, R as RegisterSessionConfig, S as SessionState, k as SessionWallet, a5 as ShieldHookInput, Y as ThresholdSignState, i as UseChipiSessionConfig, j as UseChipiSessionReturn, e as UseChipiWalletConfig, f as UseChipiWalletReturn, T as UseGuardianRecoveryReturn, P as UseShhhSignerReturn, X as UseThresholdSignOptions, W as UseThresholdSignReturn, p as UseTransferConfig, M as UseX402PaymentConfig, N as UseX402PaymentReturn, a0 as derivePrivacyAccount, a1 as netPrivateBalance, H as useAddSessionKeyToContract, q as useApprove, A as useCallAnyContract, h as useChipiSession, d as useChipiWallet, D as useChipiWalletObject, G as useCreateSessionKey, u as useCreateWallet, K as useExecuteWithSession, J as useGetSessionData, z as useGetSku, y as useGetSkuList, x as useGetSkuPurchase, F as useGetTokenBalance, s as useGetTransaction, r as useGetTransactionList, t as useGetTransactionStatus, c as useGetWallet, Q as useGuardianRecovery, l as useMigrateWalletToPasskey, n as useMigrateWalletToShhh, $ as usePrivateBalance, w as usePurchaseSku, E as useRecordSendTransaction, I as useRevokeSessionKey, O as useShhhSigner, Z as useShield, B as useSignTypedData, v as useSyncOnChainTransfers, V as useThresholdSign, o as useTransfer, _ as useUnshield, m as useUpdateWalletEncryption, L as useX402Payment } from './index-gNLTF6ix.js';
9
9
  import { StarknetWindowObject } from '@starknet-io/types-js';
10
10
  import '@tanstack/react-query';
11
11
  import 'starknet';