Skip to content
Sign UpLog In

replidentity-lib

RayhanADev
RayhanADev
1.6K followers
Made with
NodeJS Package Template
NodeJS Package Template
Published on Sep 15, 2022
  • #replidentity
  • #replit
  • #replitapi
  • #replitauth

Repl Identity (for Typescript/Javascript!)

Install

# with NPM $ npm install replidentity # with Yarn $ yarn add replidentity

Usage

import * as replidentity from 'replidentity'; async function main() { let audience = 'another-cool-repl-id'; const identityToken = await replidentity.CreateIdentityTokenAddressedTo(audience); const parsedIdentity = await replidentity.VerifyIdentity( identityToken, audience, replidentity.ReadPublicKeyFromEnv, ); console.log(`The identity token (${identityToken.length} bytes) is:`); console.log(` repl id: ${parsedIdentity.replid} user: ${parsedIdentity.user} slug: ${parsedIdentity.slug} audience: ${parsedIdentity.aud} ephemeral: ${parsedIdentity.ephemeral} origin: ${parsedIdentity.originReplid}`); } main();

For more information, visit the blog post!

Loading comments...