beanB
Deno3y ago
bean

Issues with Crypto Subtle Digest ext:deno_crypto/00_crypto.js

Currently we are using
deno_core v0.200.0
deno_runtime v0.123.0
when attempting to invoke
crypto.subtle.digest
the following error is reported
SHA-256 TypeError: Error parsing args at position 1: serde_v8 error: invalid type; expected: object, got: string

example for reproduction
async function main() {
  const encoder = new TextEncoder();
  const data = encoder.encode('Hello, World!');
  const hashed = await crypto.subtle.digest('SHA-256', data);
  console.log(new Uint8Array(hashed));
}

According to the api docs either a string or enum should be supported as the first param.
Was this page helpful?