This repository has been archived on 2023-04-04. You can view files and clone it, but cannot push or open issues or pull requests.
webcrypto/src/crypto.ts

16 lines
366 B
TypeScript
Raw Normal View History

2019-01-25 10:43:13 +00:00
import crypto from "crypto";
import * as core from "webcrypto-core";
import { SubtleCrypto } from "./subtle";
export class Crypto extends core.Crypto {
2019-01-25 10:43:13 +00:00
public subtle = new SubtleCrypto();
public getRandomValues<T extends ArrayBufferView>(array: T): T {
const buffer = Buffer.from(array.buffer);
crypto.randomFillSync(buffer);
return array;
}
}