Skip to content

Instantly share code, notes, and snippets.

@mstorus
mstorus / cryptoSign.js
Created February 27, 2021 07:03
use browser subtle crypto to sign some text with hmac-sha1
async function cryptoSign(message) {
const key = await window.crypto.subtle.generateKey(
{
name: "HMAC",
hash: { name: "SHA-512" },
},
true,
["sign", "verify"]
);
const encodedText = new TextEncoder().encode(message);

Keybase proof

I hereby claim:

  • I am mstorus on github.
  • I am markstorus (https://keybase.io/markstorus) on keybase.
  • I have a public key ASBS0bw3m0zoSXmMnzHIMumV5KWRnNdZat4Qk1QsDuaBRQo

To claim this, I am signing this object:

/*
Fit To Artboard
a script for Adobe Illustrator (only tested in CS6)
by Ruandre Janse Van Rensburg