Skip to main content
Home
This package has been archived, and as such it is read-only.

Platform-agnostic security tokens (PASETO), v4 only.

This package works with Cloudflare Workers, Node.js, Deno, Bun, Browsers
This package works with Cloudflare Workers
This package works with Node.js
This package works with Deno
This package works with Bun
This package works with Browsers
JSR Score
100%
Published
2 months ago (0.2.0)

Platform-agnostic security tokens (PASETO), v4 only.

Examples

Local encryption and decryption

import { assert, assertEquals } from "@std/assert";

const key = set_use("local", crypto.getRandomValues(new Uint8Array(32)));
const body = crypto.getRandomValues(new Uint8Array(100));

const token = en_local(key, body);
assert(token);
assertEquals(de_local(key, token)?.body, body);

Public signing and verification

import { assert, assertEquals } from "@std/assert";
import { generate } from "@libn/25519";

const key = set_use("secret", crypto.getRandomValues(new Uint8Array(32)));
const body = crypto.getRandomValues(new Uint8Array(100));

const token = en_public(key, body);
assert(token);
assertEquals(de_public(set_use("public", generate(key)), token)?.body, body);

New Ticket: Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@libn/paseto

Import symbol

import * as paseto from "@libn/paseto";
or

Import directly with a jsr specifier

import * as paseto from "jsr:@libn/paseto";

Add Package

pnpm i jsr:@libn/paseto
or (using pnpm 10.8 or older)
pnpm dlx jsr add @libn/paseto

Import symbol

import * as paseto from "@libn/paseto";

Add Package

yarn add jsr:@libn/paseto
or (using Yarn 4.8 or older)
yarn dlx jsr add @libn/paseto

Import symbol

import * as paseto from "@libn/paseto";

Add Package

vlt install jsr:@libn/paseto

Import symbol

import * as paseto from "@libn/paseto";

Add Package

npx jsr add @libn/paseto

Import symbol

import * as paseto from "@libn/paseto";

Add Package

bunx jsr add @libn/paseto

Import symbol

import * as paseto from "@libn/paseto";