Files
NapCatQQ/.pnpm-store/v3/files/c1/6886efe0195a2ff0ea4e9415a5effd7c2ff957a90953459b46136beaefc50201d6e1660563d2f26350c32ab8fa08d8144b520721bd6f43178b81a5e21f377f
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

18 lines
735 B
Plaintext

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.digest = digest;
const mapCoseAlgToWebCryptoAlg_js_1 = require("./mapCoseAlgToWebCryptoAlg.js");
const getWebCrypto_js_1 = require("./getWebCrypto.js");
/**
* Generate a digest of the provided data.
*
* @param data The data to generate a digest of
* @param algorithm A COSE algorithm ID that maps to a desired SHA algorithm
*/
async function digest(data, algorithm) {
const WebCrypto = await (0, getWebCrypto_js_1.getWebCrypto)();
const subtleAlgorithm = (0, mapCoseAlgToWebCryptoAlg_js_1.mapCoseAlgToWebCryptoAlg)(algorithm);
const hashed = await WebCrypto.subtle.digest(subtleAlgorithm, data);
return new Uint8Array(hashed);
}