1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-01 16:51:13 -05:00
denoland-deno/ext/crypto
denobot 99c2aa5730
2.0.1 (#26335)
Bumped versions for 2.0.1

Co-authored-by: bartlomieju <bartlomieju@users.noreply.github.com>
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
2024-10-17 00:42:35 +02:00
..
00_crypto.js feat(ext/crypto): X448 support (#26043) 2024-10-07 12:04:40 +01:00
Cargo.toml 2.0.1 (#26335) 2024-10-17 00:42:35 +02:00
decrypt.rs chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
ed25519.rs chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
encrypt.rs chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
export_key.rs feat(ext/crypto): import and export p521 keys (#25789) 2024-09-23 19:40:36 +05:30
generate_key.rs feat(ext/crypto): initial support for p521 in generateKey and importKey (#21815) 2024-01-06 16:48:31 +05:30
import_key.rs feat(ext/crypto): import and export p521 keys (#25789) 2024-09-23 19:40:36 +05:30
key.rs chore: update copyright to 2024 (#21753) 2024-01-01 19:58:21 +00:00
lib.deno_crypto.d.ts chore: add code generation for @types/deno (#25545) 2024-09-23 19:18:52 +00:00
lib.rs feat(ext/crypto): X448 support (#26043) 2024-10-07 12:04:40 +01:00
README.md docs: Add documentation to a subset of available extensions (#24138) 2024-06-18 00:07:48 +02:00
shared.rs feat(ext/crypto): import and export p521 keys (#25789) 2024-09-23 19:40:36 +05:30
x448.rs feat(ext/crypto): X448 support (#26043) 2024-10-07 12:04:40 +01:00
x25519.rs fix(ext/crypto): fix identity test for x25519 derive bits (#26011) 2024-10-03 16:46:48 +05:30

deno_crypto

This crate implements the Web Cryptography API.

Spec: https://www.w3.org/TR/WebCryptoAPI/

Usage Example

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.

Dependencies

  • deno_webidl: Provided by the deno_webidl crate
  • deno_web: Provided by the deno_web crate

Provided ops

Following ops are provided, which can be accessed through Deno.ops:

  • op_crypto_get_random_values
  • op_crypto_generate_key
  • op_crypto_sign_key
  • op_crypto_verify_key
  • op_crypto_derive_bits
  • op_crypto_import_key
  • op_crypto_export_key
  • op_crypto_encrypt
  • op_crypto_decrypt
  • op_crypto_subtle_digest
  • op_crypto_random_uuid
  • op_crypto_wrap_key
  • op_crypto_unwrap_key
  • op_crypto_base64url_decode
  • op_crypto_base64url_encode
  • x25519::op_crypto_generate_x25519_keypair
  • x25519::op_crypto_derive_bits_x25519
  • x25519::op_crypto_import_spki_x25519
  • x25519::op_crypto_import_pkcs8_x25519
  • ed25519::op_crypto_generate_ed25519_keypair
  • ed25519::op_crypto_import_spki_ed25519
  • ed25519::op_crypto_import_pkcs8_ed25519
  • ed25519::op_crypto_sign_ed25519
  • ed25519::op_crypto_verify_ed25519
  • ed25519::op_crypto_export_spki_ed25519
  • ed25519::op_crypto_export_pkcs8_ed25519
  • ed25519::op_crypto_jwk_x_ed25519
  • x25519::op_crypto_export_spki_x25519
  • x25519::op_crypto_export_pkcs8_x25519