{"version":3,"file":"cryptoUtils-browser.mjs","sourceRoot":"","sources":["../../../src/credential/cryptoUtils-browser.mts"],"names":[],"mappings":"AAAA,uCAAuC;AACvC,kCAAkC;AAElC,2BAA2B;AAE3B,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAE1F,MAAM,YAAY,GAAG,UAAU,CAAC,MAAM,CAAC,MAAM,CAAC;AAE9C,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,OAAe,EAAmB,EAAE;IAChE,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IACxD,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,MAAc,EAAE,OAAe,EAAmB,EAAE;IAChF,MAAM,YAAY,GAAqB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC;IACnF,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAChD,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACjG,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IACnF,OAAO,YAAY,CAAC,SAAS,CAAC,CAAC;AACjC,CAAC,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\n/// <reference lib=\"dom\" />\n\nimport { encodeBase64, encodeUTF8, encodeUTF8fromBase64 } from \"./encodeUtils.browser.js\";\n\nconst subtleCrypto = globalThis.crypto.subtle;\n\nexport const shaHash = async (content: string): Promise<string> => {\n  const data = encodeUTF8(content);\n  const hash = await subtleCrypto.digest(\"SHA-256\", data);\n  return encodeBase64(hash);\n};\n\nexport const shaHMAC = async (secret: string, content: string): Promise<string> => {\n  const importParams: HmacImportParams = { name: \"HMAC\", hash: { name: \"SHA-256\" } };\n  const encodedMessage = encodeUTF8(content);\n  const encodedKey = encodeUTF8fromBase64(secret);\n  const cryptoKey = await subtleCrypto.importKey(\"raw\", encodedKey, importParams, false, [\"sign\"]);\n  const signature = await subtleCrypto.sign(importParams, cryptoKey, encodedMessage);\n  return encodeBase64(signature);\n};\n"]}