@coinmeca/wallet-sdk
Version:
3 lines (2 loc) • 2.62 kB
JavaScript
import{parse as t,decrypt as e,encrypt as s,format as o}from"./utils.js";import"crypto-js";import"ethereum-cryptography/utils";const i=r;function r(t,e){const s=h();return(r=function(t,e){return s[t-=253]})(t,e)}!function(){const t=r,e=h();for(;;)try{if(697301===parseInt(t(262))/1+parseInt(t(256))/2+parseInt(t(254))/3+parseInt(t(275))/4+-parseInt(t(259))/5+-parseInt(t(265))/6*(-parseInt(t(260))/7)+-parseInt(t(258))/8)break;e.push(e.shift())}catch(t){e.push(e.shift())}}();const a=(i={},a)=>({set:(t,e)=>{const n=r;t=(a?.[n(264)]||"")+":"+t;const h=s(t,a?.[n(269)]);h&&(i[h]=s(o(e),a?.[n(269)]),a?.[n(255)]?.(t,e))},get:o=>{const n=r;return t(e(i?.[s((a?.[n(264)]||"")+":"+o,a?.[n(269)])],a?.[n(269)]))},remove:t=>{delete i?.[s((a?.codename||"")+":"+t,a?.salt)]},clear:()=>{i={}}});class n{#t={};#e;#s;#o;#i;#r;constructor(i,a,n){const h=r;if(this.#e=i,this.#o=a,this.#s=n?.[h(264)],this.#i=n?.[h(269)],this.#r=n?.[h(255)],i){this.#t=t(e(this.#e?.getItem(this.#o),this.#s))||{};const r=s=>{if(s.storageArea===i){const{key:o,newValue:i}=s;if(o===this.#o){const s=t(e(i,this.#s));this.#t="object"==typeof s?s:{}}}};window[h(263)]("load",(()=>{const s=h,o=t(e(this.#e?.[s(268)](this.#o),this.#s));this.#t=typeof o===s(270)?o:{}})),window.addEventListener(h(272),(()=>this.#e?.[h(273)](this.#o,s(o(this.#t),this.#s)))),window[h(263)]("storage",r)}}set(t,e){const i=r;t=this.#s+":"+t;const a=s(t,this.#i);a&&(this.#t[a]=s(o(e),this.#i),this.#e?.[i(273)](this.#o,s(o(this.#t),this.#s)),this.#r?.("storageUpdated",{key:t,value:e}))}get(o){return t(e(this.#t?.[s(this.#s+":"+o,this.#i)],this.#i))}[i(257)](t){delete this.#t?.[s(this.#s+":"+t,this.#i)],this.#e?.setItem(this.#o,s(o(this.#t),this.#s))}[i(267)](){const t=i;this.#t={},this.#e?.[t(261)](this.#o),this.#r?.(t(253))}[i(271)](t){this.#t=t}[i(274)](){return this.#t}[i(266)](i){return{set:(t,e)=>{t=this.#s+":"+t;const r=s(t,i);r&&(this.#t[r]=s(o(e),i),this.#e?.setItem(this.#o,s(o(this.#t),this.#s)),this.#r?.(t,e))},get:o=>t(e(this.#t?.[s(this.#s+":"+o,i)],i)),remove:t=>{delete this.#t?.[s(this.#s+":"+t,i)],this.#e?.setItem(this.#o,s(o(this.#t),this.#s))},clear:()=>{const t=r;this.#t={},this.#e?.[t(261)](this.#o),this.#r?.(t(253))}}}}function h(){const t=["export","2196428YZvwGA","storageCleared","3957756GCYPZT","emit","2532158drzkGJ","remove","24706008esyUCr","5825250poYnld","21vhgvLz","removeItem","1118136UkPgne","addEventListener","codename","1396056JxkHDE","secure","clear","getItem","salt","object","import","beforeunload","setItem"];return(h=function(){return t})()}export{n as CoinmecaSecureStorage,a as storage};
//# sourceMappingURL=storage.js.map