aboutsummaryrefslogtreecommitdiff
path: root/src/node-fallbacks/crypto.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/node-fallbacks/crypto.js')
-rw-r--r--src/node-fallbacks/crypto.js33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/node-fallbacks/crypto.js b/src/node-fallbacks/crypto.js
index 8c83b6c87..65ae2f5b3 100644
--- a/src/node-fallbacks/crypto.js
+++ b/src/node-fallbacks/crypto.js
@@ -1,4 +1,5 @@
export * from "crypto-browserify";
+import * as cryptoBrowserify from "crypto-browserify";
export var DEFAULT_ENCODING = "buffer";
@@ -11,6 +12,27 @@ export const randomUUID = () => {
return crypto.randomUUID();
};
+const harcoded_curves = [
+ "p192",
+ "p224",
+ "p256",
+ "p384",
+ "p521",
+ "curve25519",
+ "ed25519",
+ "secp256k1",
+ "secp224r1",
+ "prime256v1",
+ "prime192v1",
+ "ed25519",
+ "secp384r1",
+ "secp521r1",
+];
+
+export function getCurves() {
+ return harcoded_curves;
+}
+
export const timingSafeEqual =
"timingSafeEqual" in crypto
? (a, b) => {
@@ -79,3 +101,14 @@ if (timingSafeEqual) {
}
export const webcrypto = crypto;
+
+export default {
+ ...cryptoBrowserify,
+ getRandomValues,
+ randomUUID,
+ timingSafeEqual,
+ scryptSync,
+ scrypt,
+ webcrypto,
+ getCurves,
+};