New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

paseto

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

paseto - npm Package Compare versions

Comparing version 3.1.2 to 3.1.3

15

package.json
{
"name": "paseto",
"version": "3.1.2",
"version": "3.1.3",
"description": "PASETO for Node.js with no dependencies",

@@ -31,4 +31,7 @@ "keywords": [

"scripts": {
"_format": "find lib types test -type f -name '*.ts' -o -name '*.mjs' -name '*.cjs' | xargs prettier",
"format": "npm run _format -- --write",
"format-check": "npm run _format -- --check",
"test": "ava",
"test-types": "tsc --project types",
"test-types": "tsd",
"watch": "ava --watch"

@@ -42,6 +45,8 @@ },

"devDependencies": {
"@types/node": "^16.4.0",
"ava": "^3.15.0",
"@types/node": "^16.18.25",
"ava": "^5.2.0",
"prettier": "^2.8.8",
"sinon": "^11.1.2",
"typescript": "^3.6.0"
"tsd": "^0.28.1",
"typescript": "^3.9.10"
},

@@ -48,0 +53,0 @@ "engines": {

/// <reference types="node" />
// TypeScript Version: 3.6
import { KeyObject, PrivateKeyInput, PublicKeyInput, JsonWebKeyInput } from 'crypto'
type JsonObject = { [Key in string]?: JsonValue }
type JsonArray = JsonValue[]
type JsonPrimitive = string | number | boolean | null
type JsonValue = JsonPrimitive | JsonObject | JsonArray
export interface ProduceOptions {

@@ -31,5 +35,5 @@ assertion?: string | Buffer

}
export interface CompleteResult {
export interface CompleteResult<T = Record<string, JsonValue | undefined>> {
footer?: Buffer
payload: Record<string, unknown>
payload: T
purpose: 'local' | 'public'

@@ -49,5 +53,5 @@ version: string

}
export interface DecodeResult {
export interface DecodeResult<T = Record<string, JsonValue | undefined>> {
footer?: Buffer
payload?: Record<string, unknown>
payload?: T
purpose: 'local' | 'public'

@@ -62,3 +66,3 @@ version: string

}
export function decode(token: string): DecodeResult
export function decode<T = Record<string, JsonValue | undefined>>(token: string): DecodeResult<T>
export namespace V1 {

@@ -75,12 +79,12 @@ function sign(

): Promise<string>
function verify(
function verify<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | PublicKeyInput | JsonWebKeyInput | string,
options?: Omit<ConsumeOptions<false>, 'assertion'>,
): Promise<Record<string, unknown>>
function verify(
): Promise<T>
function verify<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | PublicKeyInput | JsonWebKeyInput | string,
options?: Omit<ConsumeOptions<true>, 'assertion'>,
): Promise<CompleteResult>
): Promise<CompleteResult<T>>
function verify(

@@ -96,12 +100,12 @@ token: string,

): Promise<CompleteResultBuffer>
function decrypt(
function decrypt<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | string,
options?: Omit<ConsumeOptions<false>, 'assertion'>,
): Promise<Record<string, unknown>>
function decrypt(
): Promise<T>
function decrypt<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | string,
options?: Omit<ConsumeOptions<true>, 'assertion'>,
): Promise<CompleteResult>
): Promise<CompleteResult<T>>
function decrypt(

@@ -118,5 +122,11 @@ token: string,

function generateKey(purpose: 'local' | 'public'): Promise<KeyObject>
function generateKey(purpose: 'local' | 'public', options: { format: 'keyobject' }): Promise<KeyObject>
function generateKey(
purpose: 'local' | 'public',
options: { format: 'keyobject' },
): Promise<KeyObject>
function generateKey(purpose: 'local', options: { format: 'paserk' }): Promise<string>
function generateKey(purpose: 'public', options: { format: 'paserk' }): Promise<{ secretKey: string, publicKey: string }>
function generateKey(
purpose: 'public',
options: { format: 'paserk' },
): Promise<{ secretKey: string; publicKey: string }>
}

@@ -129,12 +139,12 @@ export namespace V2 {

): Promise<string>
function verify(
function verify<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | PublicKeyInput | JsonWebKeyInput | string,
options?: Omit<ConsumeOptions<false>, 'assertion'>,
): Promise<Record<string, unknown>>
function verify(
): Promise<T>
function verify<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | PublicKeyInput | JsonWebKeyInput | string,
options?: Omit<ConsumeOptions<true>, 'assertion'>,
): Promise<CompleteResult>
): Promise<CompleteResult<T>>
function verify(

@@ -152,3 +162,6 @@ token: string,

function generateKey(purpose: 'public', options: { format: 'keyobject' }): Promise<KeyObject>
function generateKey(purpose: 'public', options: { format: 'paserk' }): Promise<{ secretKey: string, publicKey: string }>
function generateKey(
purpose: 'public',
options: { format: 'paserk' },
): Promise<{ secretKey: string; publicKey: string }>
function bytesToKeyObject(bytes: Buffer): KeyObject

@@ -168,12 +181,12 @@ function keyObjectToBytes(keyObject: KeyObject): Buffer

): Promise<string>
function verify(
function verify<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | PublicKeyInput | JsonWebKeyInput | string,
options?: ConsumeOptions<false>,
): Promise<Record<string, unknown>>
function verify(
): Promise<T>
function verify<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | PublicKeyInput | JsonWebKeyInput | string,
options?: ConsumeOptions<true>,
): Promise<CompleteResult>
): Promise<CompleteResult<T>>
function verify(

@@ -189,12 +202,12 @@ token: string,

): Promise<CompleteResultBuffer>
function decrypt(
function decrypt<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | string,
options?: ConsumeOptions<false>,
): Promise<Record<string, unknown>>
function decrypt(
): Promise<T>
function decrypt<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | string,
options?: ConsumeOptions<true>,
): Promise<CompleteResult>
): Promise<CompleteResult<T>>
function decrypt(

@@ -211,5 +224,11 @@ token: string,

function generateKey(purpose: 'local' | 'public'): Promise<KeyObject>
function generateKey(purpose: 'local' | 'public', options: { format: 'keyobject' }): Promise<KeyObject>
function generateKey(
purpose: 'local' | 'public',
options: { format: 'keyobject' },
): Promise<KeyObject>
function generateKey(purpose: 'local', options: { format: 'paserk' }): Promise<string>
function generateKey(purpose: 'public', options: { format: 'paserk' }): Promise<{ secretKey: string, publicKey: string }>
function generateKey(
purpose: 'public',
options: { format: 'paserk' },
): Promise<{ secretKey: string; publicKey: string }>
function bytesToKeyObject(bytes: Buffer): KeyObject

@@ -224,12 +243,12 @@ function keyObjectToBytes(keyObject: KeyObject): Buffer

): Promise<string>
function verify(
function verify<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | PublicKeyInput | JsonWebKeyInput | string,
options?: ConsumeOptions<false>,
): Promise<Record<string, unknown>>
function verify(
): Promise<T>
function verify<T = Record<string, JsonValue | undefined>>(
token: string,
key: KeyObject | Buffer | PublicKeyInput | JsonWebKeyInput | string,
options?: ConsumeOptions<true>,
): Promise<CompleteResult>
): Promise<CompleteResult<T>>
function verify(

@@ -247,3 +266,6 @@ token: string,

function generateKey(purpose: 'public', options: { format: 'keyobject' }): Promise<KeyObject>
function generateKey(purpose: 'public', options: { format: 'paserk' }): Promise<{ secretKey: string, publicKey: string }>
function generateKey(
purpose: 'public',
options: { format: 'paserk' },
): Promise<{ secretKey: string; publicKey: string }>
function bytesToKeyObject(bytes: Buffer): KeyObject

@@ -250,0 +272,0 @@ function keyObjectToBytes(keyObject: KeyObject): Buffer

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc