# safe-id

> Secure and URL safe id for Browser, Node.js, and ReactNative written in TypeScript.

Latest version **0.2.3** (published 2020-11-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install safe-id
pnpm add safe-id
yarn add safe-id
bun add safe-id
```

## Health

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

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.3 |
| Published | 2020-11-02 |
| First published | 2020-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 6.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Yuhsak Inoue |
| Maintainers | yuhsak |

## Links

- npm: https://www.npmjs.com/package/safe-id
- Repository: https://github.com/Yuhsak/safe-id
- Homepage: https://github.com/Yuhsak/safe-id#readme
- Issues: https://github.com/Yuhsak/safe-id/issues
- npm.io page: https://npm.io/package/safe-id

## Dependencies (1)

- [secure-id](https://npm.io/package/secure-id.md) ^0.2.2

## Recent versions

- 0.2.3 (latest) — 2020-11-02
- 0.2.2 — 2020-11-02
- 0.2.1 — 2020-11-02
- 0.2.0 — 2020-11-02
- 0.1.3 — 2020-11-02
- 0.1.2 — 2020-11-02
- 0.1.1 — 2020-11-02
- 0.1.0 — 2020-11-02

## README

# safe-id

Secure and URL safe id for Browser, Node.js, and ReactNative written in TypeScript.

## Install

```sh
npm install safe-id
```

## Usage

```ts
/** simple usage */
import {safeid, validate} from 'safe-id'

// 'r2Uv0BdF_jrSrYTQWk6mn', 'E-sQInvR5SAqCi5EJY1AM', 'e70oGrYqbgJE-7KvnzAzc' etc
const id = safeid()

// true
validate(id)
validate('a'.repeat(21))

// false
validate('a'.repeat(20)) //invalid length
validate('@'.repeat(21)) //invalid characters
```

```ts
/** create custom-length id generator */
import {create} from 'safe-id'

const {generate, validate} = create(12)

// 'mkgy78-a4_'
const cid = generate()

// true
validate(cid)
validate('a'.repeat(12))

// false
validate('a'.repeat(21)) //invalid length
```

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