@chipi-stack/chipi-react 14.2.0 → 14.2.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.
- package/dist/hooks.js +18 -0
- package/dist/hooks.js.map +1 -1
- package/dist/hooks.mjs +18 -0
- package/dist/hooks.mjs.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +18 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -596,6 +596,7 @@ function useChipiSession(config) {
|
|
|
596
596
|
}
|
|
597
597
|
function useMigrateWalletToPasskey() {
|
|
598
598
|
const { chipiSDK } = useChipiContext();
|
|
599
|
+
const queryClient = reactQuery.useQueryClient();
|
|
599
600
|
const mutation = reactQuery.useMutation({
|
|
600
601
|
mutationFn: async (input) => {
|
|
601
602
|
const { wallet, oldEncryptKey, externalUserId, bearerToken } = input;
|
|
@@ -617,10 +618,27 @@ function useMigrateWalletToPasskey() {
|
|
|
617
618
|
decryptedPrivateKey,
|
|
618
619
|
passkeyResult.encryptKey
|
|
619
620
|
);
|
|
621
|
+
const updateResult = await chipiSDK.wallets.updateWalletEncryption(
|
|
622
|
+
{
|
|
623
|
+
externalUserId,
|
|
624
|
+
newEncryptedPrivateKey,
|
|
625
|
+
publicKey: wallet.publicKey
|
|
626
|
+
},
|
|
627
|
+
bearerToken
|
|
628
|
+
);
|
|
629
|
+
if (updateResult?.success === false) {
|
|
630
|
+
throw new Error("Backend rejected wallet encryption update");
|
|
631
|
+
}
|
|
620
632
|
const updatedWallet = {
|
|
621
633
|
...wallet,
|
|
622
634
|
encryptedPrivateKey: newEncryptedPrivateKey
|
|
623
635
|
};
|
|
636
|
+
queryClient.invalidateQueries({
|
|
637
|
+
queryKey: ["chipi-wallet", externalUserId]
|
|
638
|
+
});
|
|
639
|
+
queryClient.invalidateQueries({
|
|
640
|
+
queryKey: ["wallet", externalUserId]
|
|
641
|
+
});
|
|
624
642
|
return {
|
|
625
643
|
success: true,
|
|
626
644
|
wallet: updatedWallet,
|