2.0.2 • Published 26 days ago

replit-identity v2.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
26 days ago

Replit Identity

Supports TypeScript

Create and verify Replit Identity tokens.

NPM Version NPM Install Size NPM Downloads

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

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:

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,
  }
}
2.0.2

26 days ago

2.0.1

1 month ago

1.2.8

1 month ago

1.2.7

1 month ago

2.0.0

1 month ago

1.2.9

1 month ago

1.2.6

7 months ago

1.2.5

7 months ago

1.2.4

7 months ago

1.2.3

7 months ago

1.2.2

7 months ago

1.2.0

8 months ago

1.1.1

9 months ago

1.1.0

9 months ago

1.1.7

8 months ago

1.1.6

8 months ago

1.1.5

8 months ago

1.1.4

8 months ago

1.1.3

9 months ago

1.2.1

8 months ago

1.1.2

9 months ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago