* rewrite

* testing worklflow

* sprcify version

* config stuff

* add hash as buffer

* delete docs

* use typedarray everywhere and docs

* readme

* aes

* cleanup

* rsa

* testing with playwright

* fix playwright

* readme

* docs

* update deps

* use headless

* add prepublish

* build pipeline

* move types up

* move types up

* add types legacy

* packaging

* versions bump

* cleanup

* maybe this time

* drop support for commonjs

* version bump

* cleanup
This commit is contained in:
2022-10-18 15:53:43 +02:00
committed by GitHub
parent f1f5e44b54
commit 56a8103582
58 changed files with 2701 additions and 4705 deletions

11
src/crypto/random.ts Normal file
View File

@@ -0,0 +1,11 @@
import { type TypedArray } from '../utils/base.js'
import { getCrypto } from './crypto.js'
export async function getRandomBytes(bytes: number): Promise<TypedArray> {
if (bytes <= 0) throw new Error('Invalid number of bytes')
const buffer = new Uint8Array(bytes)
const crypto = await getCrypto()
crypto.getRandomValues(buffer)
return buffer
}