@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/hooks.mjs
CHANGED
|
@@ -553,6 +553,7 @@ function useChipiSession(config) {
|
|
|
553
553
|
}
|
|
554
554
|
function useMigrateWalletToPasskey() {
|
|
555
555
|
const { chipiSDK } = useChipiContext();
|
|
556
|
+
const queryClient = useQueryClient();
|
|
556
557
|
const mutation = useMutation({
|
|
557
558
|
mutationFn: async (input) => {
|
|
558
559
|
const { wallet, oldEncryptKey, externalUserId, bearerToken } = input;
|
|
@@ -574,10 +575,27 @@ function useMigrateWalletToPasskey() {
|
|
|
574
575
|
decryptedPrivateKey,
|
|
575
576
|
passkeyResult.encryptKey
|
|
576
577
|
);
|
|
578
|
+
const updateResult = await chipiSDK.wallets.updateWalletEncryption(
|
|
579
|
+
{
|
|
580
|
+
externalUserId,
|
|
581
|
+
newEncryptedPrivateKey,
|
|
582
|
+
publicKey: wallet.publicKey
|
|
583
|
+
},
|
|
584
|
+
bearerToken
|
|
585
|
+
);
|
|
586
|
+
if (updateResult?.success === false) {
|
|
587
|
+
throw new Error("Backend rejected wallet encryption update");
|
|
588
|
+
}
|
|
577
589
|
const updatedWallet = {
|
|
578
590
|
...wallet,
|
|
579
591
|
encryptedPrivateKey: newEncryptedPrivateKey
|
|
580
592
|
};
|
|
593
|
+
queryClient.invalidateQueries({
|
|
594
|
+
queryKey: ["chipi-wallet", externalUserId]
|
|
595
|
+
});
|
|
596
|
+
queryClient.invalidateQueries({
|
|
597
|
+
queryKey: ["wallet", externalUserId]
|
|
598
|
+
});
|
|
581
599
|
return {
|
|
582
600
|
success: true,
|
|
583
601
|
wallet: updatedWallet,
|