hscrypt
Version:
Encrypt Javascript bundles (at build time), inject+decrypt them into pages later (in the browser)
20 lines • 871 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.clearCachedDecryptionKey = exports.getCachedDecryptionKey = exports.getLocalStorageKey = exports.LOCALSTORAGE_PREFIX = void 0;
exports.LOCALSTORAGE_PREFIX = "hscrypt.secret:";
function getLocalStorageKey() {
const path = window.location.pathname;
return `${exports.LOCALSTORAGE_PREFIX}${path}`;
}
exports.getLocalStorageKey = getLocalStorageKey;
function getCachedDecryptionKey() {
const localStorageKey = getLocalStorageKey();
return localStorage.getItem(localStorageKey);
}
exports.getCachedDecryptionKey = getCachedDecryptionKey;
function clearCachedDecryptionKey() {
const localStorageKey = getLocalStorageKey();
return localStorage.removeItem(localStorageKey);
}
exports.clearCachedDecryptionKey = clearCachedDecryptionKey;
//# sourceMappingURL=cache.js.map