Typescript/Node.js port of go-replidentity

Overview

Repl Identity

(for Typescript/Javascript!)

From go-replidentity

Repl Identity stores a REPL_IDENTITY token in every Repl automatically. This token is a signed PASETO that includes verifiable repl identity data (such as the user in the repl, and the repl ID).

WARNING: in their current form, these tokens are very forwardable! You should only send these tokens to repls that you trust, or between repls that you own.

This package provides the necessary code to verify these tokens.

Check the example at tests/identity.test.js for an example usage. You can also see this in action at https://replit.com/@RayhanADev/replidentity-lib. If you are logged in to Replit, you'll see your username when you click "Run" on the Cover Page - that's Repl Identity at work.

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!

You might also like...

Unofficial port of the Sentry SDK for JavaScript to Deno.

Sentry_deno This is an unofficial port of the Sentry SDK (@sentry/browser) to Deno. import * as Sentry from "https://deno.land/x/sentry_deno/main.ts";

Aug 11, 2022

Deno port of Gnome libraries (such as Gtk).

Deno GI Deno port of Gnome libraries (such as Gtk). Early Stage and Unstable Usage You must specify --allow-ffi and --unstable flags to run your progr

Dec 24, 2022

Minecraft modpack that port Create: Above and Beyond to Fabric Toolchain.

Minecraft modpack that port Create: Above and Beyond to Fabric Toolchain.

English Cabricality Create: Above and Beyond but for Fabric 1.18.2 using Create 0.5. Cabricality aims to port the CAB experience to Fabric, but not 1:

Dec 23, 2022

🦕 Deno port of Microsoft/vscode-textmate: A library that helps tokenize text using TextMate grammars.

TextMate A library that helps tokenize text using TextMate grammars. Deno port of Microsoft/vscode-textmate. See original license here. An interpreter

Sep 13, 2022

Node-cli-starter - Basic starter kit for building Node CLI applications with TypeScript.

node-cli-starter Minimal starter kit for building Node CLI applications with TypeScript. Getting Started To get started clone repo locally and run npm

May 17, 2022

Node 18's node:test, as a node module

node-core-test This is a user-land port of node:test, the experimental test runner introduced in Node.js 18. This module makes it available in Node.js

Dec 15, 2022

:books: The definitive guide to TypeScript and possibly the best TypeScript book :book:. Free and Open Source 🌹

TypeScript Deep Dive I've been looking at the issues that turn up commonly when people start using TypeScript. This is based on the lessons from Stack

Jan 4, 2023

Variant types in Roblox TypeScript - Ported from Vanilla TypeScript

Variant types in Roblox TypeScript - Ported from Vanilla TypeScript

Variant (for Roblox) This is a roblox typescript variant (heh, pun) of Variant. See the Variant documentation on how to use Variant. A variant type is

Jun 3, 2022

A Lua plugin, written in TypeScript, to write TypeScript (Lua optional).

typescript.nvim A minimal typescript-language-server integration plugin to set up the language server via nvim-lspconfig and add commands for convenie

Dec 29, 2022
Owner
Ray
Teen Fullstack Dev && Software Engineer | Community Moderator @replit
Ray
Grm is an improved Deno port of GramJS, written in TypeScript

Grm is an improved Deno port of GramJS, written in TypeScript. GramJS is a popular MTProto API Telegram client library written in JavaScript for Node.js and browsers, with its core being based on Telethon.

Dunkan 26 Dec 31, 2022
Live port of Lark's standalone parser to Javascript

Lark.js Generate LALR(1) parsers in Javascript Lark is a popular parsing toolkit for Python. This project is a live port of the Lark standalone parser

Lark - Parsing Library & Toolkit 51 Nov 19, 2022
fxDeviantArt.js - a port of fxDeviantArt to JavaScript

fxDeviantArt.js This is a port of fxDeviantArt to JavaScript. Written in TypeScript and compiled to a JS file. Original code is written by Robin Unive

Doruk 2 Feb 18, 2022
A port of bitcoin-core that will (over time) become TS friendly.

bitcoin-core A modern Bitcoin Core REST and RPC client to execute administrative tasks, multiwallet operations and queries about network and the block

null 6 Nov 22, 2022
AFrame port of Lamina (https://github.com/pmndrs/lamina)

AFrame-Lamina Automated port of Lamina to AFrame <a-lamina geometry="" material="shader:lamina;color:white;lighting:phong;" position="-1 0.5 -3" rotat

Ada Rose Cannon 4 Apr 6, 2022
Port Scanner with Javascript (NodeJs)

port-scanner Installation npm install pscanner example: const portScan = require("pscanner"); const main = async () => { const isOpen = await port

Pesar 45 Oct 14, 2022
Fluent for Deno. Port of @the-moebius/fluent.

Fluent for Deno [better_fluent] Deno port of the-moebius/fluent Better Fluent integration for TypeScript/JavaScript. See the original repository for m

Dunkan 5 May 29, 2022
The Javascript and canvas port of MarkovJunior : A Probabilistic Programming Language.

MarkovJunior.js MarkovJunior is a probabilistic programming language where programs are combinations of rewrite rules and inference is performed via c

nullday 17 Nov 15, 2022
A multifunctional Telegram based Android RAT without port forwarding.

DOGERAT A multifunctional Telegram based Android RAT without port forwarding. Features Read all the files of Internal Storage Delete files or folder f

shiva yadav 268 Jan 1, 2023
Improved Deno port of GramJS — a MTProto API Telegram client library.

Warning Considered as unstable. But, most of the commonly used features are working as expected. Grm Grm is an improved Deno port of GramJS, written i

Dunkan 26 Dec 31, 2022