{"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,MAAM,GAAG,MAAC,UAAkB,aAAlB,UAAU,uBAAV,UAAU,CAAU,MAAM,0CAAE,MAAsB,CAAC;AAEnE,MAAM,CAAC,MAAM,OAAO,GAAG,KAAK,EAAE,OAAe,EAAmB,EAAE;IAChE,MAAM,IAAI,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IACjC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAClD,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,MAAM,GAAG,MAAM,CAAC;IACtB,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3F,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;IAC7E,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 subtle = (globalThis as any)?.crypto?.subtle as SubtleCrypto;\n\nexport const shaHash = async (content: string): Promise<string> => {\n  const data = encodeUTF8(content);\n  const hash = await subtle.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 crypto = subtle;\n  const cryptoKey = await crypto.importKey(\"raw\", encodedKey, importParams, false, [\"sign\"]);\n  const signature = await crypto.sign(importParams, cryptoKey, encodedMessage);\n  return encodeBase64(signature);\n};\n"]}