@coinmeca/wallet-sdk
Version:
3 lines (2 loc) • 2.97 kB
JavaScript
import{parse as t,decrypt as e,encrypt as s,format as i}from"./utils.js";import"crypto-js";import"ethereum-cryptography/utils";const o=n;function r(){const t=["storageCleared","1829074NgQEis","2YSnRRZ","344841ZPHgps","removeItem","ready","5990pWsegg","coinmeca:wallet:userId","setItem","beforeunload","35XEiiCG","emit","remove","salt","set","load","37032fXVUbh","64271nDqYhU","1320zaeSOS","6HmwEVr","361480rSNxLt","6579tqpuGe","codename","8IAiUqh","object","getItem","addEventListener","secure","1744555FHiAxW"];return(r=function(){return t})()}!function(){const t=n,e=r();for(;;)try{if(250340===-parseInt(t(276))/1*(parseInt(t(290))/2)+-parseInt(t(291))/3*(parseInt(t(282))/4)+-parseInt(t(287))/5*(parseInt(t(278))/6)+-parseInt(t(298))/7*(-parseInt(t(279))/8)+-parseInt(t(280))/9*(-parseInt(t(294))/10)+parseInt(t(277))/11*(parseInt(t(275))/12)+-parseInt(t(289))/13)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();let a=null;function n(t,e){const s=r();return(n=function(t,e){return s[t-=274]})(t,e)}const h=(o={},r)=>({set:(t,e)=>{const a=n,h=s(t=(r?.codename||"")+":"+t,r?.[a(301)]);h&&(o[h]=s(i(e),r?.[a(301)]),r?.emit?.(t,e))},get:i=>{const a=n;return t(e(o?.[s((r?.[a(281)]||"")+":"+i,r?.salt)],r?.[a(301)]))},remove:t=>{const e=n;delete o?.[s((r?.[e(281)]||"")+":"+t,r?.[e(301)])]},clear:()=>{o={}}});class c{#t={};#e;#s;#i;#o;#r;constructor(t,e,s){const i=n;this.#e=t,this.#i=e,this.#s=s?.[i(281)],this.#o=s?.[i(301)],this.#r=s?.[i(299)],this.#a(this.#e?.getItem(this.#i)||{}),window[i(285)](i(297),(()=>this[i(293)]())),window.addEventListener(i(274),(()=>this.#a(this.#e?.[i(284)](this.#i)))),window[i(285)]("storage",(t=>{const e=i,{key:s,newValue:o}=t;t.storageArea===this.#e&&s===this.#i?this.#a(o):this[e(293)]()}))}#n(t){const e=n;return!!t&&typeof t===e(283)&&!!t?.[e(295)]}#a(s,i){i&&i!==this.#i||(s=t(e(s,this.#s)),this.#n(s)&&(this.#t=s))}[o(293)](){const t=o;this.#i&&this.#e?.[t(296)](this.#i,s(i(this.#t),this.#s))}[o(302)](t,e){t=this.#s+":"+t;const o=s(t,this.#o);o&&(this.#t[o]=s(i(e),this.#o),this.#e?.setItem(this.#i,s(i(this.#t),this.#s)),this.#r?.("storageUpdated",{key:t,value:e}))}get(i){return t(e(this.#t?.[s(this.#s+":"+i,this.#o)],this.#o))}[o(300)](t){const e=o;delete this.#t?.[s(this.#s+":"+t,this.#o)],this.#e?.[e(296)](this.#i,s(i(this.#t),this.#s))}clear(){const t=o;this.#t={},this.#e?.[t(292)](this.#i),this.#r?.(t(288))}import(t){this.#t=t}export(){return this.#t}[o(286)](o){return{set:(t,e)=>{const r=n;t=this.#s+":"+t;const a=s(t,o);a&&(this.#t[a]=s(i(e),o),this.#e?.[r(296)](this.#i,s(i(this.#t),this.#s)),this.#r?.(t,e))},get:i=>t(e(this.#t?.[s(this.#s+":"+i,o)],o)),remove:t=>{const e=n;delete this.#t?.[s(this.#s+":"+t,o)],this.#e?.[e(296)](this.#i,s(i(this.#t),this.#s))},clear:()=>{const t=n;this.#t={},this.#e?.[t(292)](this.#i),this.#r?.(t(288))}}}}function g(t,...e){return a||(a=new c(t,...e)),a}export{c as CoinmecaSecureStorage,g as getSecureStorage,h as storage};
//# sourceMappingURL=storage.js.map