UNPKG

@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

1 lines • 1.1 kB
{"version":3,"file":"CredoSha1Provider.mjs","names":[],"sources":["../../../../src/crypto/webcrypto/providers/CredoSha1Provider.ts"],"sourcesContent":["import * as core from 'webcrypto-core'\nimport { Sha1 } from '../../hashes'\nimport type { HashAlgorithm } from '../types'\n\nexport class CredoSha1Provider extends core.ProviderCrypto {\n public name = 'SHA-1'\n public usages = []\n\n public override async onDigest(algorithm: HashAlgorithm, data: ArrayBuffer): Promise<ArrayBuffer> {\n switch (algorithm.name.toUpperCase()) {\n case 'SHA-1': {\n const hash = new Sha1().hash(new Uint8Array(data))\n return hash.buffer as ArrayBuffer\n }\n default:\n throw new Error(`Hashing algorithm: ${JSON.stringify(algorithm)} is not supported`)\n }\n }\n}\n"],"mappings":";;;;AAIA,IAAa,oBAAb,cAAuC,KAAK,eAAe;;;EACzD,KAAO,OAAO;EACd,KAAO,SAAS,CAAC;;CAEjB,MAAsB,SAAS,WAA0B,MAAyC;EAChG,QAAQ,UAAU,KAAK,YAAY,GAAnC;GACE,KAAK,SAEH,OADa,IAAI,KAAK,CAAC,CAAC,KAAK,IAAI,WAAW,IAAI,CACtC,CAAC,CAAC;GAEd,SACE,MAAM,IAAI,MAAM,sBAAsB,KAAK,UAAU,SAAS,EAAE,kBAAkB;EACtF;CACF;AACF"}