expo-crypto-universal
Version:
Universal crypto implementation for Expo that works across all platforms including web
22 lines (21 loc) • 760 B
JavaScript
var r = Object.defineProperty;
var s = (t, e, n) => e in t ? r(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
var o = (t, e, n) => s(t, typeof e != "symbol" ? e + "" : e, n);
class d {
constructor() {
/**
* Generates random bytes of specified size.
* @param size - The number of random bytes to generate. Defaults to 32 if not specified.
* @returns Uint8Array containing random bytes.
*/
o(this, "getRandomBytes", (e = 32) => this.getRandomValues(new Uint8Array(e)));
}
}
const i = () => {
var t;
return typeof window < "u" && typeof ((t = window == null ? void 0 : window.crypto) == null ? void 0 : t.getRandomValues) == "function";
};
export {
d as AbstractCryptoModule,
i as isWeb
};