@credo-ts/core
Version:
<p align="center"> <br /> <img alt="Credo Logo" src="https://github.com/openwallet-foundation/credo-ts/blob/c7886cb8377ceb8ee4efe8d264211e561a75072d/images/credo-logo.png" height="250px" /> </p> <h1 align="center"><b>Credo - Core</b></h1
21 lines (20 loc) • 693 B
JavaScript
import { Sha256 } from "../../hashes/Sha256.mjs";
import "../../hashes/index.mjs";
import * as core from "webcrypto-core";
//#region src/crypto/webcrypto/providers/CredoSha256Provider.ts
var CredoSha256Provider = class extends core.ProviderCrypto {
constructor(..._args) {
super(..._args);
this.name = "SHA-256";
this.usages = [];
}
async onDigest(algorithm, data) {
switch (algorithm.name.toUpperCase()) {
case "SHA-256": return new Sha256().hash(new Uint8Array(data)).buffer;
default: throw new Error(`Hashing algorithm: ${JSON.stringify(algorithm)} is not supported`);
}
}
};
//#endregion
export { CredoSha256Provider };
//# sourceMappingURL=CredoSha256Provider.mjs.map