# replit-identity

> A simple package to interact with the Replit CLI's identity command.

Latest version **2.0.2** (published 2024-04-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install replit-identity
pnpm add replit-identity
yarn add replit-identity
bun add replit-identity
```

## 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 | 2.0.2 |
| Published | 2024-04-16 |
| First published | 2023-01-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 6.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | 7hemech |
| Maintainers | 7hemech |
| Keywords | repl, replit, identity |

## Links

- npm: https://www.npmjs.com/package/replit-identity
- Repository: https://github.com/7heMech/Replit-Identity
- Homepage: https://github.com/7heMech/Replit-Identity#readme
- Issues: https://github.com/7heMech/Replit-Identity/issues
- npm.io page: https://npm.io/package/replit-identity

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2024-04-16
- 2.0.1 — 2024-04-03
- 2.0.0 — 2024-04-02
- 1.2.9 — 2024-04-02
- 1.2.8 — 2024-04-02
- 1.2.7 — 2024-04-01
- 1.2.6 — 2023-10-20
- 1.2.5 — 2023-10-20
- 1.2.4 — 2023-10-15
- 1.2.3 — 2023-10-04
- 1.2.2 — 2023-10-01
- 1.2.1 — 2023-09-14
- 1.2.0 — 2023-09-14
- 1.1.7 — 2023-09-14
- 1.1.6 — 2023-09-14
- … 9 more at https://npm.io/package/replit-identity/versions

## README

## Replit Identity
**Supports TypeScript**

Create and verify Replit Identity tokens.

[![NPM Version][npm-version-image]][npm-url]
[![NPM Install Size][npm-install-size-image]][npm-install-size-url]
[![NPM Downloads][npm-downloads-image]][npm-downloads-url]
```js
const { create, verify } = require('replit-identity');

const audience = 'target-repl-id';
const token = await create(audience);

const info = await verify(token, audience);
console.log(info);
```
### Installation
```bash
npm install replit-identity
```
**Important:** This package can only be used within a Replit environment.
### API
The `replit-identity` module exports the following functions:

**create**

Creates a new identity token.
* **param:** `audience` (string): The target audience for the token.
* **returns:** A Promise resolving to the string token, or null on error.

**verify**

Verifies an existing identity token.
* **param:** `token` (string): The token to verify.
* **param:** `audience` (string): The audience to verify against.
* **returns:** A Promise resolving to an object containing token information, or null if the token is invalid.

Example return value:
```js
const info = {
  slug: "repl-name", 
  replId: "unique-repl-id",
  audience: "target-repl-id", 
  username: "jane_doe" ,
  userId: 12345,
  runtime: {
    // Based on Replit environment:
    interactive: {
      cluster: 'example-cluster',
      subcluster: 'example-subcluster'
    },
    // Or:
    hosting: {
      cluster: 'example-cluster',
      subcluster: 'example-subcluster'
    },
    // Or (if in deployment):
    deployment: true,
  }
}
```

[npm-downloads-image]: https://badgen.net/npm/dm/replit-identity
[npm-downloads-url]: https://npmcharts.com/compare/replit-identity?minimal=true
[npm-install-size-image]: https://badgen.net/packagephobia/install/replit-identity
[npm-install-size-url]: https://packagephobia.com/result?p=replit-identity
[npm-url]: https://npmjs.org/package/replit-identity
[npm-version-image]: https://badgen.net/npm/v/replit-identity

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