Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

fix: remove iso-random-stream dependency #262

Merged
merged 1 commit into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/ed25519/compat.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ const forge = require('node-forge/lib/forge')
* function because key generation is deterministic for a given seed.
*/

const randomBytes = require('iso-random-stream/src/random')
const { concat } = require('uint8arrays/concat')
const { fromString } = require('uint8arrays/from-string')

const native = require('ed25519')
const noble = require('@noble/ed25519')
const { randomBytes } = noble.utils
const { subtle } = require('crypto').webcrypto
require('node-forge/lib/ed25519')
const stable = require('@stablelib/ed25519')
Expand Down
2 changes: 1 addition & 1 deletion benchmark/ed25519/index.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
// @ts-expect-error types are missing
const forge = require('node-forge/lib/forge')
const Benchmark = require('benchmark')
const randomBytes = require('iso-random-stream/src/random')
const native = require('ed25519')
const noble = require('@noble/ed25519')
const { randomBytes } = noble.utils
const { subtle } = require('crypto').webcrypto
require('node-forge/lib/ed25519')
const stable = require('@stablelib/ed25519')
Expand Down
1 change: 0 additions & 1 deletion benchmark/ed25519/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"benchmark": "^2.1.4",
"ed25519": "^0.0.5",
"ed25519-wasm-pro": "^1.1.1",
"iso-random-stream": "^2.0.0",
"node-forge": "^1.0.0",
"supercop.wasm": "^5.0.1"
}
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,6 @@
"@noble/ed25519": "^1.6.0",
"@noble/secp256k1": "^1.5.4",
"err-code": "^3.0.1",
"iso-random-stream": "^2.0.0",
"multiformats": "^9.4.5",
"node-forge": "^1.1.0",
"protons-runtime": "^1.0.4",
Expand Down
4 changes: 2 additions & 2 deletions src/random-bytes.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import isoRandomBytes from 'iso-random-stream/src/random.js'
import { utils } from '@noble/secp256k1'
import errcode from 'err-code'

export default function randomBytes (length: number): Uint8Array {
if (isNaN(length) || length <= 0) {
throw errcode(new Error('random bytes length must be a Number bigger than 0'), 'ERR_INVALID_LENGTH')
}
return isoRandomBytes(length)
return utils.randomBytes(length)
}