Crates.io | deno_crypto |
lib.rs | deno_crypto |
version | 0.191.0 |
source | src |
created_at | 2020-10-14 14:56:09.501662 |
updated_at | 2024-11-10 04:51:26.925116 |
description | Web Cryptography API implementation for Deno |
homepage | |
repository | https://github.com/denoland/deno |
max_upload_size | |
id | 299659 |
size | 261,759 |
This crate implements the Web Cryptography API.
Spec: https://www.w3.org/TR/WebCryptoAPI/
From javascript, include the extension's source, and assign CryptoKey
,
crypto
, Crypto
, and SubtleCrypto
to the global scope:
import * as crypto from "ext:deno_crypto/00_crypto.js";
Object.defineProperty(globalThis, "CryptoKey", {
value: crypto.CryptoKey,
enumerable: false,
configurable: true,
writable: true,
});
Object.defineProperty(globalThis, "crypto", {
value: crypto.crypto,
enumerable: false,
configurable: true,
writable: false,
});
Object.defineProperty(globalThis, "Crypto", {
value: crypto.Crypto,
enumerable: false,
configurable: true,
writable: true,
});
Object.defineProperty(globalThis, "SubtleCrypto", {
value: crypto.SubtleCrypto,
enumerable: false,
configurable: true,
writable: true,
});
Then from rust, provide:
deno_crypto::deno_crypto::init_ops_and_esm(Option<u64>)
in the extensions
field of your RuntimeOptions
Where the Option<u64>
represents an optional seed for initialization.
deno_webidl
cratedeno_web
crateFollowing ops are provided, which can be accessed through Deno.ops
: