@shogun-sdk/accounts
Version:
Shogun with Turnkey: configs, encryption, authentication with Telegram/Turnkey OIDC, etc.
21 lines • 754 B
JavaScript
import { lowercase } from '@shogun-sdk/money-legos';
export function handleDecryptionError(errors) {
// Check if errors is an array
if (!Array.isArray(errors)) {
console.error('Expected array of errors');
return;
}
// Look for decryption error
const hasDecryptionError = errors.some((error) => lowercase(error.errorMessage).includes(lowercase('decryption failed: M')));
if (hasDecryptionError) {
// Clear localStorage
localStorage.clear();
// Clear sessionStorage
sessionStorage.clear();
// Log the action
console.log('Cleared storage due to decryption error');
// Reload the window
window.location.reload();
}
}
//# sourceMappingURL=error.js.map