Skip to main content
Module

x/jose/runtime/digest.ts

"JSON Web Almost Everything" - JWA, JWS, JWE, JWT, JWK, JWKS with no dependencies using runtime's native crypto in Node.js, Browser, Cloudflare Workers, Electron, and Deno.
Extremely Popular
Go to Latest
File
import crypto from './webcrypto.ts'import type { DigestFunction } from './interfaces.d.ts'
const digest: DigestFunction = async ( algorithm: 'sha256' | 'sha384' | 'sha512', data: Uint8Array,): Promise<Uint8Array> => { const subtleDigest = `SHA-${algorithm.slice(-3)}` return new Uint8Array(await crypto.subtle.digest(subtleDigest, data))}export default digest