UNPKG

antelope-webauthn

Version:

A WebAuthn.io crypto utility for generating signatures, creating public keys, and verifying them, designed for Antelope-based blockchains such as Vaulta, WAX, and other related platforms. This package provides convenient tools to handle key pair generatio

11 lines (10 loc) 411 B
export default async function sha256(data) { if (!(data instanceof Uint8Array)) throw new TypeError("Expected Uint8Array input data."); if (typeof window == "undefined") { const { createHash } = await import("crypto"); return new Uint8Array(createHash("sha256").update(data).digest()); } else return new Uint8Array(await crypto.subtle.digest("SHA-256", data)); }