Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@withdouble/lucipher

Package Overview
Dependencies
Maintainers
8
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@withdouble/lucipher - npm Package Compare versions

Comparing version 2.0.2 to 2.0.3

26

dist/commonjs/abstract-jwt.js

@@ -23,4 +23,15 @@ "use strict";

const payload = { data };
const { keyid, expiresIn, notBefore, audience, subject, issuer, jwtid, mutatePayload, noTimestamp, header, encoding, } = this.defaultOptions || {};
const signOptions = {
...this.defaultOptions,
keyid,
expiresIn,
notBefore,
audience,
subject,
issuer,
jwtid,
mutatePayload,
noTimestamp,
header,
encoding,
...options,

@@ -32,4 +43,15 @@ algorithm: this.algorithm,

verify(message, options) {
const { audience, clockTimestamp, clockTolerance, complete, issuer, ignoreExpiration, ignoreNotBefore, jwtid, nonce, subject, maxAge, } = this.defaultOptions || {};
const verifyOptions = {
...this.defaultOptions,
audience,
clockTimestamp,
clockTolerance,
complete,
issuer,
ignoreExpiration,
ignoreNotBefore,
jwtid,
nonce,
subject,
maxAge,
...options,

@@ -36,0 +58,0 @@ algorithms: [this.algorithm],

5

dist/commonjs/authentication.d.ts
/// <reference types="node" />
import { HexBase64BinaryEncoding, Utf8AsciiLatin1Encoding } from 'crypto';
export declare type Encoding = Utf8AsciiLatin1Encoding | HexBase64BinaryEncoding | 'buffer' | undefined;
export declare type StringEncoding = Utf8AsciiLatin1Encoding | HexBase64BinaryEncoding;
export declare type Encoding = StringEncoding | 'buffer' | undefined;
interface Props {

@@ -13,3 +14,3 @@ secret: Buffer;

toBuffer(obj: any): any;
hmac(message: string | Buffer, outputEncoding?: Encoding): any;
hmac(message: string | Buffer, outputEncoding?: Encoding): Buffer & string;
sign(message: any, authenticationMetas: any, outputEncoding?: Encoding): string | Buffer;

@@ -16,0 +17,0 @@ isValid(signature: string | Buffer, message: any, authenticationMetas: any): boolean | "";

@@ -6,2 +6,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.AsymmetricJwt = exports.SymmetricJwt = exports.SymmetricCipher = exports.Authentication = void 0;
const authentication_1 = __importDefault(require("./authentication"));

@@ -8,0 +9,0 @@ exports.Authentication = authentication_1.default;

/// <reference types="node" />
import Authentication, { Encoding } from './authentication';
import Authentication, { StringEncoding } from './authentication';
interface Props {

@@ -7,3 +7,3 @@ secret?: Buffer;

authenticationSecret?: Buffer;
outputEncoding?: Encoding;
outputEncoding?: StringEncoding;
}

@@ -13,3 +13,3 @@ export default class SymmetricCipher<TPayload, TAuthenticationMetas> {

authenticationSecret: Buffer;
outputEncoding: Encoding;
outputEncoding: StringEncoding | undefined;
authentication: Authentication;

@@ -16,0 +16,0 @@ constructor({ secret, encryptionSecret, authenticationSecret, outputEncoding }: Props);

@@ -57,3 +57,2 @@ "use strict";

decrypt(encryptedMessage, authenticationMetas) {
// @ts-ignore fuck typing definitions https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
const encrypted = Buffer.from(encryptedMessage, this.outputEncoding);

@@ -60,0 +59,0 @@ // Extract authentication and ciphertext Buffers

@@ -18,4 +18,15 @@ import jwt from 'jsonwebtoken';

const payload = { data };
const { keyid, expiresIn, notBefore, audience, subject, issuer, jwtid, mutatePayload, noTimestamp, header, encoding, } = this.defaultOptions || {};
const signOptions = {
...this.defaultOptions,
keyid,
expiresIn,
notBefore,
audience,
subject,
issuer,
jwtid,
mutatePayload,
noTimestamp,
header,
encoding,
...options,

@@ -27,4 +38,15 @@ algorithm: this.algorithm,

verify(message, options) {
const { audience, clockTimestamp, clockTolerance, complete, issuer, ignoreExpiration, ignoreNotBefore, jwtid, nonce, subject, maxAge, } = this.defaultOptions || {};
const verifyOptions = {
...this.defaultOptions,
audience,
clockTimestamp,
clockTolerance,
complete,
issuer,
ignoreExpiration,
ignoreNotBefore,
jwtid,
nonce,
subject,
maxAge,
...options,

@@ -31,0 +53,0 @@ algorithms: [this.algorithm],

/// <reference types="node" />
import { HexBase64BinaryEncoding, Utf8AsciiLatin1Encoding } from 'crypto';
export declare type Encoding = Utf8AsciiLatin1Encoding | HexBase64BinaryEncoding | 'buffer' | undefined;
export declare type StringEncoding = Utf8AsciiLatin1Encoding | HexBase64BinaryEncoding;
export declare type Encoding = StringEncoding | 'buffer' | undefined;
interface Props {

@@ -13,3 +14,3 @@ secret: Buffer;

toBuffer(obj: any): any;
hmac(message: string | Buffer, outputEncoding?: Encoding): any;
hmac(message: string | Buffer, outputEncoding?: Encoding): Buffer & string;
sign(message: any, authenticationMetas: any, outputEncoding?: Encoding): string | Buffer;

@@ -16,0 +17,0 @@ isValid(signature: string | Buffer, message: any, authenticationMetas: any): boolean | "";

/// <reference types="node" />
import Authentication, { Encoding } from './authentication';
import Authentication, { StringEncoding } from './authentication';
interface Props {

@@ -7,3 +7,3 @@ secret?: Buffer;

authenticationSecret?: Buffer;
outputEncoding?: Encoding;
outputEncoding?: StringEncoding;
}

@@ -13,3 +13,3 @@ export default class SymmetricCipher<TPayload, TAuthenticationMetas> {

authenticationSecret: Buffer;
outputEncoding: Encoding;
outputEncoding: StringEncoding | undefined;
authentication: Authentication;

@@ -16,0 +16,0 @@ constructor({ secret, encryptionSecret, authenticationSecret, outputEncoding }: Props);

@@ -52,3 +52,2 @@ import { randomBytes, createCipheriv, createDecipheriv } from 'crypto';

decrypt(encryptedMessage, authenticationMetas) {
// @ts-ignore fuck typing definitions https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
const encrypted = Buffer.from(encryptedMessage, this.outputEncoding);

@@ -55,0 +54,0 @@ // Extract authentication and ciphertext Buffers

{
"name": "@withdouble/lucipher",
"description": "Encryption and JWT toolbox",
"version": "2.0.2",
"version": "2.0.3",
"author": {

@@ -6,0 +6,0 @@ "name": "Double, inc",

@@ -41,4 +41,28 @@ import jwt, { SignOptions, VerifyOptions } from 'jsonwebtoken'

const {
keyid,
expiresIn,
notBefore,
audience,
subject,
issuer,
jwtid,
mutatePayload,
noTimestamp,
header,
encoding,
}: SignOptions = this.defaultOptions || {}
const signOptions = {
...this.defaultOptions,
keyid,
expiresIn,
notBefore,
audience,
subject,
issuer,
jwtid,
mutatePayload,
noTimestamp,
header,
encoding,
...options,

@@ -52,4 +76,28 @@ algorithm: this.algorithm,

verify (message: string, options?: VerifyOptions): TData | null {
const {
audience,
clockTimestamp,
clockTolerance,
complete,
issuer,
ignoreExpiration,
ignoreNotBefore,
jwtid,
nonce,
subject,
maxAge,
}: VerifyOptions = this.defaultOptions || {}
const verifyOptions = {
...this.defaultOptions,
audience,
clockTimestamp,
clockTolerance,
complete,
issuer,
ignoreExpiration,
ignoreNotBefore,
jwtid,
nonce,
subject,
maxAge,
...options,

@@ -56,0 +104,0 @@ algorithms: [this.algorithm],

import { createHmac, HexBase64BinaryEncoding, Utf8AsciiLatin1Encoding } from 'crypto'
export type Encoding = Utf8AsciiLatin1Encoding | HexBase64BinaryEncoding | 'buffer' | undefined
export type StringEncoding = Utf8AsciiLatin1Encoding | HexBase64BinaryEncoding
export type Encoding = StringEncoding | 'buffer' | undefined

@@ -5,0 +6,0 @@ interface Props {

import { randomBytes, createCipheriv, createDecipheriv } from 'crypto'
import Authentication, { Encoding } from './authentication'
import Authentication, { StringEncoding } from './authentication'

@@ -8,3 +8,3 @@ interface Props {

authenticationSecret?: Buffer,
outputEncoding?: Encoding,
outputEncoding?: StringEncoding,
}

@@ -15,3 +15,3 @@

const HASH_LENGTH = 32
const DEFAULT_ENCODING: Encoding = 'base64'
const DEFAULT_ENCODING: StringEncoding = 'base64'

@@ -21,3 +21,3 @@ export default class SymmetricCipher<TPayload, TAuthenticationMetas> {

authenticationSecret: Buffer
outputEncoding: Encoding
outputEncoding: StringEncoding | undefined
authentication: Authentication

@@ -78,3 +78,2 @@

decrypt (encryptedMessage: string, authenticationMetas?: TAuthenticationMetas): TPayload | null {
// @ts-ignore fuck typing definitions https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings
const encrypted = Buffer.from(encryptedMessage, this.outputEncoding)

@@ -81,0 +80,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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