From 4b56537ea9d5c3e5f60ca817ed00c55dcbb2131c Mon Sep 17 00:00:00 2001 From: Divy Srivastava Date: Fri, 26 Feb 2021 22:36:26 +0530 Subject: chore: move crypto types to op_crates/crypto (#9609) --- op_crates/crypto/lib.deno_crypto.d.ts | 26 ++++++++++++++++++++++++++ op_crates/crypto/lib.rs | 5 +++++ 2 files changed, 31 insertions(+) create mode 100644 op_crates/crypto/lib.deno_crypto.d.ts (limited to 'op_crates') diff --git a/op_crates/crypto/lib.deno_crypto.d.ts b/op_crates/crypto/lib.deno_crypto.d.ts new file mode 100644 index 000000000..a00757e71 --- /dev/null +++ b/op_crates/crypto/lib.deno_crypto.d.ts @@ -0,0 +1,26 @@ +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. + +/// +/// + +declare var crypto: Crypto; + +declare interface Crypto { + readonly subtle: null; + getRandomValues< + T extends + | Int8Array + | Int16Array + | Int32Array + | Uint8Array + | Uint16Array + | Uint32Array + | Uint8ClampedArray + | Float32Array + | Float64Array + | DataView + | null, + >( + array: T, + ): T; +} diff --git a/op_crates/crypto/lib.rs b/op_crates/crypto/lib.rs index 61290080d..b8fe3fefb 100644 --- a/op_crates/crypto/lib.rs +++ b/op_crates/crypto/lib.rs @@ -11,6 +11,7 @@ use deno_core::ZeroCopyBuf; use rand::rngs::StdRng; use rand::thread_rng; use rand::Rng; +use std::path::PathBuf; pub use rand; // Re-export rand @@ -41,3 +42,7 @@ pub fn op_crypto_get_random_values( Ok(json!({})) } + +pub fn get_declaration() -> PathBuf { + PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("lib.deno_crypto.d.ts") +} -- cgit v1.2.3