@xylabs/crypto
Advanced tools
Comparing version 2.12.13 to 2.12.14
@@ -0,1 +1,2 @@ | ||
// src/browser/Crypto.ts | ||
import Crypto from "crypto-js"; | ||
@@ -2,0 +3,0 @@ export { |
@@ -1,9 +0,12 @@ | ||
import { Crypto } from "./Crypto"; | ||
const isBrowser = () => { | ||
// src/browser/Crypto.ts | ||
import Crypto from "crypto-js"; | ||
// src/browser/cryptoPolyfill.ts | ||
var isBrowser = () => { | ||
return typeof window !== "undefined" && typeof window?.document !== "undefined"; | ||
}; | ||
const isWebworker = () => { | ||
var isWebworker = () => { | ||
return typeof self === "object" && self.constructor?.name === "DedicatedWorkerGlobalScope"; | ||
}; | ||
const cryptoPolyfill = () => { | ||
var cryptoPolyfill = () => { | ||
const global = isBrowser() ? window : isWebworker() ? self : void 0; | ||
@@ -10,0 +13,0 @@ if (global) { |
@@ -1,3 +0,25 @@ | ||
export * from "./Crypto"; | ||
export * from "./cryptoPolyfill"; | ||
// src/browser/Crypto.ts | ||
import Crypto from "crypto-js"; | ||
// src/browser/cryptoPolyfill.ts | ||
var isBrowser = () => { | ||
return typeof window !== "undefined" && typeof window?.document !== "undefined"; | ||
}; | ||
var isWebworker = () => { | ||
return typeof self === "object" && self.constructor?.name === "DedicatedWorkerGlobalScope"; | ||
}; | ||
var cryptoPolyfill = () => { | ||
const global = isBrowser() ? window : isWebworker() ? self : void 0; | ||
if (global) { | ||
if (global.Crypto === void 0) { | ||
global.Crypto = Crypto; | ||
} else { | ||
global.Crypto = { ...Crypto, ...global.Crypto }; | ||
} | ||
} | ||
}; | ||
export { | ||
Crypto, | ||
cryptoPolyfill | ||
}; | ||
//# sourceMappingURL=index.js.map |
@@ -57,6 +57,6 @@ { | ||
"@types/crypto-js": "^4.1.2", | ||
"@types/node": "^20.7.0", | ||
"@xylabs/ts-scripts-yarn3": "^3.0.78", | ||
"@xylabs/tsconfig": "^3.0.78", | ||
"@xylabs/tsconfig-dom": "^3.0.78", | ||
"@types/node": "^20.7.1", | ||
"@xylabs/ts-scripts-yarn3": "^3.0.79", | ||
"@xylabs/tsconfig": "^3.0.79", | ||
"@xylabs/tsconfig-dom": "^3.0.79", | ||
"typescript": "^5.2.2" | ||
@@ -72,3 +72,3 @@ }, | ||
"sideEffects": false, | ||
"version": "2.12.13", | ||
"version": "2.12.14", | ||
"xy": { | ||
@@ -75,0 +75,0 @@ "compile": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
43295
405