# randombytes-pure

> JS-only implementation of randomBytes, intended for use with React Native and other limited runtimes

Latest version **4.1.0** (published 2020-07-15) · ISC license · 0 weekly downloads

## Install

```sh
npm install randombytes-pure
pnpm add randombytes-pure
yarn add randombytes-pure
bun add randombytes-pure
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 4.1.0 |
| Published | 2020-07-15 |
| First published | 2020-07-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 374.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | RobertFischer |
| Maintainers | robertfischer |
| Keywords | react-native, browser, randomBytes, rng, ios, android, mobile, web, sjcl |

## Links

- npm: https://www.npmjs.com/package/randombytes-pure
- Repository: https://github.com/RobertFischer/randombytes-pure
- Homepage: https://github.com/RobertFischer/randombytes-pure#readme
- Issues: https://github.com/RobertFischer/randombytes-pure/issues
- npm.io page: https://npm.io/package/randombytes-pure

## Dependencies (2)

- [sjcl](https://npm.io/package/sjcl.md) ^1.0.8
- [buffer](https://npm.io/package/buffer.md) ^5.6.0

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 4.1.0 (latest) — 2020-07-15

## README

<!-- @format -->

![Validate code on push](https://github.com/RobertFischer/react-native-randombytes/workflows/Validate%20code%20on%20push/badge.svg)

# RandomBytes-Pure

## Motivation

This is a fork of [`react-native-randombytes`](https://www.npmjs.com/package/react-native-randombytes), and is a superset of its exposed `randomBytes` API.
You probably want to use that library if you're comfortable/capable of using
[`react-native link`](https://reactnative.dev/docs/linking-libraries-ios#automatic-linking). If, however, you're using the
[Expo "Managed Workflow"](https://docs.expo.io/introduction/managed-vs-bare/#managed-workflow) or otherwise don't want to mess around with native dependencies, then this library is
the one for you.

## Implementation Overview

This library uses the [SJCL](https://bitwiseshiftleft.github.io/sjcl/) pseudo-random generator. That library is small, fast, and memory-efficient.

## Usage

```js
import randomBytes from "randombytes-pure";

const rand = randomBytes(4);
```

That is it. Now `rand` is a [`Buffer`](https://www.npmjs.com/package/buffer) with 4 pseudo-random bytes. Enjoy.

## Installation

```bash
yarn add randombytes-pure
```

If you want to use this module anywhere you might otherwise use `react-native-randombytes`, _AND_ you are using [`yarn`](https://classic.yarnpkg.com/) or some other build tool that supports `"resolutions"` in `package.json`, then just add this to your `package.json`:

```json
"resolutions": {
	"react-native-randombytes": "randombytes-pure"
}
```

## Versioning

This library follows semver using [Semantic Release](https://semantic-release.gitbook.io/semantic-release/) and [Conventional Commits](https://www.conventionalcommits.org/).

---
_Source: https://npm.io/package/randombytes-pure · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
