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

@collabland/common

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@collabland/common - npm Package Compare versions

Comparing version 0.9.0 to 0.10.0

11

CHANGELOG.md

@@ -6,2 +6,13 @@ # Change Log

# [0.10.0](https://github.com/abridged/collabland-monorepo/compare/@collabland/common@0.9.0...@collabland/common@0.10.0) (2021-04-15)
### Features
* add api key support ([2ec46cd](https://github.com/abridged/collabland-monorepo/commit/2ec46cd391fb0598ac08646825d158d381bc52ba))
# [0.9.0](https://github.com/abridged/collabland-monorepo/compare/@collabland/common@0.8.1...@collabland/common@0.9.0) (2021-04-10)

@@ -8,0 +19,0 @@

7

dist/utils/jwt.d.ts

@@ -1,10 +0,11 @@

import jwt from 'jsonwebtoken';
/// <reference types="node" />
import { Secret, SignOptions, VerifyOptions } from 'jsonwebtoken';
/**
* Encode a json object into JWT
*/
export declare const jwtSign: typeof jwt.sign;
export declare function jwtSign(payload: string | Buffer | object, secretOrPrivateKey?: Secret, options?: SignOptions): string;
/**
* Decode a JWT into a json object
*/
export declare const jwtVerify: typeof jwt.verify;
export declare function jwtVerify(token: string, secretOrPublicKey: Secret, options?: VerifyOptions): object | string;
/**

@@ -11,0 +12,0 @@ * Get the signing secret for JWTs

@@ -15,7 +15,16 @@ "use strict";

*/
exports.jwtSign = jsonwebtoken_1.default.sign;
function jwtSign(payload, secretOrPrivateKey = getJwtSecret(), options) {
return jsonwebtoken_1.default.sign(payload, secretOrPrivateKey, {
issuer: getJwtIssuer(),
...options,
});
}
exports.jwtSign = jwtSign;
/**
* Decode a JWT into a json object
*/
exports.jwtVerify = jsonwebtoken_1.default.verify;
function jwtVerify(token, secretOrPublicKey, options) {
return jsonwebtoken_1.default.verify(token, secretOrPublicKey, options);
}
exports.jwtVerify = jwtVerify;
/**

@@ -22,0 +31,0 @@ * Get the signing secret for JWTs

{
"name": "@collabland/common",
"version": "0.9.0",
"version": "0.10.0",
"description": "CollabLand common utilities",

@@ -56,3 +56,3 @@ "main": "dist/index.js",

"author": "Abridged, Inc.",
"gitHead": "72d2c25b7c830c683792ed6f48f305b001fd0bf6"
"gitHead": "92a9122fe027d96361461c2050484ee39d6a8107"
}

@@ -7,3 +7,3 @@ // Copyright Abridged, Inc. 2021. All Rights Reserved.

import {createHmac} from 'crypto';
import jwt from 'jsonwebtoken';
import jwt, {Secret, SignOptions, VerifyOptions} from 'jsonwebtoken';
import {getApiServerUrl} from './env';

@@ -14,3 +14,12 @@

*/
export const jwtSign = jwt.sign;
export function jwtSign(
payload: string | Buffer | object,
secretOrPrivateKey: Secret = getJwtSecret(),
options?: SignOptions,
): string {
return jwt.sign(payload, secretOrPrivateKey, {
issuer: getJwtIssuer(),
...options,
});
}

@@ -20,3 +29,9 @@ /**

*/
export const jwtVerify = jwt.verify;
export function jwtVerify(
token: string,
secretOrPublicKey: Secret,
options?: VerifyOptions,
): object | string {
return jwt.verify(token, secretOrPublicKey, options);
}

@@ -23,0 +38,0 @@ /**

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