Back to Content

Crypto

files/en-us/web/api/crypto/index.md

latest1.4 KB
Original Source

{{APIRef("Web Crypto API")}}{{AvailableInWorkers}}

The Crypto interface represents basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives.

The Crypto is available in windows using the {{domxref("Window.crypto")}} property and in workers using the {{domxref("WorkerGlobalScope.crypto")}} property.

Instance properties

  • {{domxref("Crypto.subtle")}} {{ReadOnlyInline}} {{SecureContext_inline}}
    • : Returns a {{domxref("SubtleCrypto")}} object providing access to common cryptographic primitives, like hashing, signing, encryption, or decryption.

Instance methods

  • {{domxref("Crypto.getRandomValues()")}}
    • : Fills the passed {{ jsxref("TypedArray") }} with cryptographically sound random values.
  • {{domxref("Crypto.randomUUID()")}} {{SecureContext_inline}}
    • : Returns a randomly generated, 36 character long v4 UUID.

Specifications

{{Specifications}}

Browser compatibility

{{Compat}}

See also