@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.mjs
CHANGED
|
@@ -591,6 +591,7 @@ function useChipiSession(config) {
|
|
|
591
591
|
}
|
|
592
592
|
function useMigrateWalletToPasskey() {
|
|
593
593
|
const { chipiSDK } = useChipiContext();
|
|
594
|
+
const queryClient = useQueryClient();
|
|
594
595
|
const mutation = useMutation({
|
|
595
596
|
mutationFn: async (input) => {
|
|
596
597
|
const { wallet, oldEncryptKey, externalUserId, bearerToken } = input;
|
|
@@ -612,10 +613,27 @@ function useMigrateWalletToPasskey() {
|
|
|
612
613
|
decryptedPrivateKey,
|
|
613
614
|
passkeyResult.encryptKey
|
|
614
615
|
);
|
|
616
|
+
const updateResult = await chipiSDK.wallets.updateWalletEncryption(
|
|
617
|
+
{
|
|
618
|
+
externalUserId,
|
|
619
|
+
newEncryptedPrivateKey,
|
|
620
|
+
publicKey: wallet.publicKey
|
|
621
|
+
},
|
|
622
|
+
bearerToken
|
|
623
|
+
);
|
|
624
|
+
if (updateResult?.success === false) {
|
|
625
|
+
throw new Error("Backend rejected wallet encryption update");
|
|
626
|
+
}
|
|
615
627
|
const updatedWallet = {
|
|
616
628
|
...wallet,
|
|
617
629
|
encryptedPrivateKey: newEncryptedPrivateKey
|
|
618
630
|
};
|
|
631
|
+
queryClient.invalidateQueries({
|
|
632
|
+
queryKey: ["chipi-wallet", externalUserId]
|
|
633
|
+
});
|
|
634
|
+
queryClient.invalidateQueries({
|
|
635
|
+
queryKey: ["wallet", externalUserId]
|
|
636
|
+
});
|
|
619
637
|
return {
|
|
620
638
|
success: true,
|
|
621
639
|
wallet: updatedWallet,
|