@tmawallet/sdk
Version:
TMA Wallet SDK
23 lines • 830 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.hmacSha256 = void 0;
const js_sha256_1 = require("js-sha256");
const hmacSha256 = async (data, key) => {
// const importedKey = await crypto.subtle.importKey(
// 'raw', // raw format of the key - should be Uint8Array
// key,
// {
// // algorithm details
// name: 'HMAC',
// hash: { name: 'SHA-256' },
// },
// false, // export = false
// ['sign', 'verify'], // what this key can do
// );
// const signature = await crypto.subtle.sign('HMAC', importedKey, data);
// return new Uint8Array(signature);
const signature = js_sha256_1.sha256.hmac.arrayBuffer(key, data);
return new Uint8Array(signature);
};
exports.hmacSha256 = hmacSha256;
//# sourceMappingURL=hmacSha256.js.map