UNPKG

serverless-spy

Version:

CDK-based library for writing elegant integration tests on AWS serverless architecture and an additional web console to monitor events in real time.

27 lines 933 B
import { Sha256 as WebCryptoSha256 } from "./webCryptoSha256"; import { Sha256 as JsSha256 } from "@aws-crypto/sha256-js"; import { supportsWebCrypto } from "@aws-crypto/supports-web-crypto"; import { locateWindow } from "@aws-sdk/util-locate-window"; import { convertToBuffer } from "@aws-crypto/util"; var Sha256 = /** @class */ (function () { function Sha256(secret) { if (supportsWebCrypto(locateWindow())) { this.hash = new WebCryptoSha256(secret); } else { this.hash = new JsSha256(secret); } } Sha256.prototype.update = function (data, encoding) { this.hash.update(convertToBuffer(data)); }; Sha256.prototype.digest = function () { return this.hash.digest(); }; Sha256.prototype.reset = function () { this.hash.reset(); }; return Sha256; }()); export { Sha256 }; //# sourceMappingURL=crossPlatformSha256.js.map