mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
AuditService (#2)
* Add AuditService. * Change sha1 to use Webcrypto. * Add interface for AuditService. * Move PwnedPasswodsApi constant outside class. * Change FromBufferToHex implementation to simpler code. * Use correct string to array function. * Change auditService interface to abstract class. Add missing type to utils.
This commit is contained in:
committed by
Kyle Spearrin
parent
ab00dfd399
commit
1aabb42e47
@@ -452,6 +452,17 @@ export class CryptoService implements CryptoServiceAbstraction {
|
||||
return b64DecValue;
|
||||
}
|
||||
|
||||
async sha1(password: string): Promise<string> {
|
||||
const hash = await Crypto.subtle.digest(
|
||||
{
|
||||
name: 'SHA-1',
|
||||
},
|
||||
UtilsService.fromUtf8ToArray(password),
|
||||
);
|
||||
|
||||
return UtilsService.fromBufferToHex(hash);
|
||||
}
|
||||
|
||||
// Helpers
|
||||
|
||||
private async aesEncrypt(plainValue: ArrayBuffer, key: SymmetricCryptoKey): Promise<EncryptedObject> {
|
||||
|
||||
Reference in New Issue
Block a user