ts-mls
Version:
[](https://github.com/LukaJCB/ts-mls/actions/workflows/ci.yml) [](https://badge.fury.io/js/ts-mls) [ {
return {
async digest(data) {
const result = await sc.digest(h, toBufferSource(data));
return new Uint8Array(result);
},
async mac(key, data) {
const result = await sc.sign("HMAC", await importMacKey(key, h), toBufferSource(data));
return new Uint8Array(result);
},
async verifyMac(key, mac, data) {
return sc.verify("HMAC", await importMacKey(key, h), toBufferSource(mac), toBufferSource(data));
},
};
}
function importMacKey(rawKey, h) {
return crypto.subtle.importKey("raw", toBufferSource(rawKey), {
name: "HMAC",
hash: { name: h },
}, false, ["sign", "verify"]);
}
//# sourceMappingURL=makeHashImpl.js.map