Socket
Socket
Sign inDemoInstall

jose

Package Overview
Dependencies
Maintainers
1
Versions
206
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jose - npm Package Compare versions

Comparing version 3.0.1 to 3.0.2

dist/browser/package.json

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

## [3.0.2](https://github.com/panva/jose/compare/v3.0.1...v3.0.2) (2020-11-15)
### Bug Fixes
* **build:** publish esm submodules ([7b6364f](https://github.com/panva/jose/commit/7b6364f26f7654368c9e33af58043ee40e77ec77)), closes [#104](https://github.com/panva/jose/issues/104)
## [3.0.1](https://github.com/panva/jose/compare/v3.0.0...v3.0.1) (2020-11-15)

@@ -7,0 +14,0 @@

5

dist/browser/runtime/digest.js
import crypto, { ensureSecureContext } from './webcrypto.js';
export default async (digest, data) => {
const digest = async (algorithm, data) => {
ensureSecureContext();
const subtleDigest = `SHA-${digest.substr(-3)}`;
const subtleDigest = `SHA-${algorithm.substr(-3)}`;
return new Uint8Array(await crypto.subtle.digest(subtleDigest, data));
};
export default digest;
import { JOSEError } from '../util/errors.js';
export default async (url, timeout) => {
const fetch = async (url, timeout) => {
let controller;

@@ -8,3 +8,3 @@ if (typeof AbortController === 'function') {

}
const response = await fetch(url.href, {
const response = await window.fetch(url.href, {
signal: controller ? controller.signal : undefined,

@@ -27,1 +27,2 @@ redirect: 'manual',

};
export default fetch;

7

dist/browser/runtime/jwk_to_key.js
import crypto, { ensureSecureContext } from './webcrypto.js';
import { JOSENotSupported } from '../util/errors.js';
import { decode as base64url } from './base64url.js';
function parse(jwk) {
function subtleMapping(jwk) {
let algorithm;

@@ -97,5 +97,5 @@ let keyUsages;

}
export default async (jwk) => {
const parse = async (jwk) => {
var _a, _b;
const { algorithm, keyUsages } = parse(jwk);
const { algorithm, keyUsages } = subtleMapping(jwk);
let format = 'jwk';

@@ -111,1 +111,2 @@ let keyData = { ...jwk };

};
export default parse;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const crypto_1 = require("crypto");
exports.default = (digest, data) => {
return crypto_1.createHash(digest).update(data).digest();
const digest = (algorithm, data) => {
return crypto_1.createHash(algorithm).update(data).digest();
};
exports.default = digest;

@@ -11,3 +11,3 @@ "use strict";

};
exports.default = async (url, timeout, options) => {
const fetch = async (url, timeout, options) => {
if (!(url.protocol in protocols)) {

@@ -39,1 +39,2 @@ throw new TypeError('Unsupported URL protocol.');

};
exports.default = fetch;

@@ -9,3 +9,3 @@ "use strict";

const asn1_sequence_encoder_js_1 = require("./asn1_sequence_encoder.js");
exports.default = async (jwk) => {
const parse = (jwk) => {
switch (jwk.kty) {

@@ -107,1 +107,2 @@ case 'oct': {

};
exports.default = parse;
import { createHash } from 'crypto';
export default (digest, data) => {
return createHash(digest).update(data).digest();
const digest = (algorithm, data) => {
return createHash(algorithm).update(data).digest();
};
export default digest;

@@ -9,3 +9,3 @@ import { get as http } from 'http';

};
export default async (url, timeout, options) => {
const fetch = async (url, timeout, options) => {
if (!(url.protocol in protocols)) {

@@ -37,1 +37,2 @@ throw new TypeError('Unsupported URL protocol.');

};
export default fetch;

@@ -7,3 +7,3 @@ import { createPrivateKey, createPublicKey, createSecretKey } from 'crypto';

import Asn1SequenceEncoder from './asn1_sequence_encoder.js';
export default async (jwk) => {
const parse = (jwk) => {
switch (jwk.kty) {

@@ -105,1 +105,2 @@ case 'oct': {

};
export default parse;
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const webcrypto_js_1 = require("./webcrypto.js");
exports.default = async (digest, data) => {
const digest = async (algorithm, data) => {
webcrypto_js_1.ensureSecureContext();
const subtleDigest = `SHA-${digest.substr(-3)}`;
const subtleDigest = `SHA-${algorithm.substr(-3)}`;
return new Uint8Array(await webcrypto_js_1.default.subtle.digest(subtleDigest, data));
};
exports.default = digest;

@@ -11,3 +11,3 @@ "use strict";

};
exports.default = async (url, timeout, options) => {
const fetch = async (url, timeout, options) => {
if (!(url.protocol in protocols)) {

@@ -39,1 +39,2 @@ throw new TypeError('Unsupported URL protocol.');

};
exports.default = fetch;

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

const base64url_js_1 = require("./base64url.js");
function parse(jwk) {
function subtleMapping(jwk) {
let algorithm;

@@ -100,4 +100,4 @@ let keyUsages;

}
exports.default = async (jwk) => {
const { algorithm, keyUsages } = parse(jwk);
const parse = async (jwk) => {
const { algorithm, keyUsages } = subtleMapping(jwk);
let format = 'jwk';

@@ -113,1 +113,2 @@ let keyData = { ...jwk };

};
exports.default = parse;
import crypto, { ensureSecureContext } from './webcrypto.js';
export default async (digest, data) => {
const digest = async (algorithm, data) => {
ensureSecureContext();
const subtleDigest = `SHA-${digest.substr(-3)}`;
const subtleDigest = `SHA-${algorithm.substr(-3)}`;
return new Uint8Array(await crypto.subtle.digest(subtleDigest, data));
};
export default digest;

@@ -9,3 +9,3 @@ import { get as http } from 'http';

};
export default async (url, timeout, options) => {
const fetch = async (url, timeout, options) => {
if (!(url.protocol in protocols)) {

@@ -37,1 +37,2 @@ throw new TypeError('Unsupported URL protocol.');

};
export default fetch;
import crypto, { ensureSecureContext } from './webcrypto.js';
import { JOSENotSupported } from '../util/errors.js';
import { decode as base64url } from './base64url.js';
function parse(jwk) {
function subtleMapping(jwk) {
let algorithm;

@@ -97,4 +97,4 @@ let keyUsages;

}
export default async (jwk) => {
const { algorithm, keyUsages } = parse(jwk);
const parse = async (jwk) => {
const { algorithm, keyUsages } = subtleMapping(jwk);
let format = 'jwk';

@@ -110,1 +110,2 @@ let keyData = { ...jwk };

};
export default parse;
{
"name": "jose",
"version": "3.0.1",
"version": "3.0.2",
"description": "JSON Web Almost Everything - JWA, JWS, JWE, JWK, JWT, JWKS with no dependencies",

@@ -425,2 +425,3 @@ "keywords": [

"files": [
"dist/**/package.json",
"dist/**/*.js",

@@ -427,0 +428,0 @@ "src/**/*.d.ts",

@@ -1,3 +0,3 @@

import type { AesGcmKwUnwrapFunction, AesGcmKwWrapFunction } from './interfaces.d';
export declare const wrap: AesGcmKwWrapFunction;
export declare const unwrap: AesGcmKwUnwrapFunction;
import type { AesGcmKwUnwrapFunction, AesGcmKwWrapFunction } from './interfaces.d'
export declare const wrap: AesGcmKwWrapFunction
export declare const unwrap: AesGcmKwUnwrapFunction

@@ -1,3 +0,3 @@

import type { AesKwUnwrapFunction, AesKwWrapFunction } from './interfaces.d';
export declare const wrap: AesKwWrapFunction;
export declare const unwrap: AesKwUnwrapFunction;
import type { AesKwUnwrapFunction, AesKwWrapFunction } from './interfaces.d'
export declare const wrap: AesKwWrapFunction
export declare const unwrap: AesKwUnwrapFunction

@@ -1,3 +0,3 @@

import type { Base64UrlDecode, Base64UrlEncode } from './interfaces.d';
export declare const encode: Base64UrlEncode;
export declare const decode: Base64UrlDecode;
import type { Base64UrlDecode, Base64UrlEncode } from './interfaces.d'
export declare const encode: Base64UrlEncode
export declare const decode: Base64UrlDecode

@@ -1,3 +0,3 @@

import type { DecryptFunction } from './interfaces.d';
declare const decrypt: DecryptFunction;
export default decrypt;
import type { DecryptFunction } from './interfaces.d'
declare const decrypt: DecryptFunction
export default decrypt

@@ -1,3 +0,3 @@

import type { AsyncOrSync } from '../types.i.d'
declare const _default: (digest: string, data: Uint8Array) => AsyncOrSync<Uint8Array>;
export default _default;
import type { DigestFunction } from './interfaces.d'
declare const digest: DigestFunction
export default digest

@@ -1,6 +0,12 @@

import type { EcdhAllowedFunction, EcdhESDeriveKeyFunction, EphemeralKeyToPublicJwkFunction, GenerateEpkFunction, PublicJwkToEphemeralKeyFunction } from './interfaces.d';
export declare const deriveKey: EcdhESDeriveKeyFunction;
export declare const ephemeralKeyToPublicJWK: EphemeralKeyToPublicJwkFunction;
export declare const generateEpk: GenerateEpkFunction;
export declare const publicJwkToEphemeralKey: PublicJwkToEphemeralKeyFunction;
export declare const ecdhAllowed: EcdhAllowedFunction;
import type {
EcdhAllowedFunction,
EcdhESDeriveKeyFunction,
EphemeralKeyToPublicJwkFunction,
GenerateEpkFunction,
PublicJwkToEphemeralKeyFunction,
} from './interfaces.d'
export declare const deriveKey: EcdhESDeriveKeyFunction
export declare const ephemeralKeyToPublicJWK: EphemeralKeyToPublicJwkFunction
export declare const generateEpk: GenerateEpkFunction
export declare const publicJwkToEphemeralKey: PublicJwkToEphemeralKeyFunction
export declare const ecdhAllowed: EcdhAllowedFunction

@@ -1,3 +0,3 @@

import type { EncryptFunction } from './interfaces.d';
declare const encrypt: EncryptFunction;
export default encrypt;
import type { EncryptFunction } from './interfaces.d'
declare const encrypt: EncryptFunction
export default encrypt

@@ -1,2 +0,3 @@

declare const _default: (url: URL, timeout: number) => Promise<any>;
export default _default;
import type { FetchFunction } from './interfaces.d'
declare const fetch: FetchFunction
export default fetch

@@ -1,11 +0,14 @@

import type { KeyObject } from 'crypto';
import type { KeyLike } from '../types.d';
export declare function generateSecret(alg: string): Promise<KeyLike>;
import type { KeyObject } from 'crypto'
import type { KeyLike } from '../types.d'
export declare function generateSecret(alg: string): Promise<KeyLike>
interface Options {
crv?: string;
crv?: string
}
export declare function generateKeyPair(alg: string, options?: Options): Promise<{
privateKey: CryptoKey | KeyObject,
publicKey: CryptoKey | KeyObject
}>;
export {};
export declare function generateKeyPair(
alg: string,
options?: Options,
): Promise<{
privateKey: CryptoKey | KeyObject
publicKey: CryptoKey | KeyObject
}>
export {}

@@ -1,2 +0,2 @@

import type { KeyLike } from '../types.d'
import type { JWK, KeyLike } from '../types.d'
import type { EpkJwk, AsyncOrSync } from '../types.i.d'

@@ -112,9 +112,10 @@

}
// TODO:
export interface FetchFunction {
(url: URL, timeout: number): Promise<any>
}
// TODO:
export interface DigestFunction {
(digest: string, data: Uint8Array): AsyncOrSync<Uint8Array>
(digest: 'sha256' | 'sha384' | 'sha512', data: Uint8Array): AsyncOrSync<Uint8Array>
}
export interface JWKParseFunction {
(jwk: JWK): AsyncOrSync<KeyLike>
}

@@ -1,3 +0,3 @@

import type { KeyLike, JWK } from '../types.d';
declare const _default: (jwk: JWK) => Promise<KeyLike>;
export default _default;
import type { JWKParseFunction } from './interfaces.d'
declare const parse: JWKParseFunction
export default parse

@@ -1,3 +0,3 @@

import type { Pbes2KWDecryptFunction, Pbes2KWEncryptFunction } from './interfaces.d';
export declare const encrypt: Pbes2KWEncryptFunction;
export declare const decrypt: Pbes2KWDecryptFunction;
import type { Pbes2KWDecryptFunction, Pbes2KWEncryptFunction } from './interfaces.d'
export declare const encrypt: Pbes2KWEncryptFunction
export declare const decrypt: Pbes2KWDecryptFunction

@@ -1,3 +0,3 @@

import type { GetRandomValuesFunction } from './interfaces.d';
declare const random: GetRandomValuesFunction;
export default random;
import type { GetRandomValuesFunction } from './interfaces.d'
declare const random: GetRandomValuesFunction
export default random

@@ -1,3 +0,3 @@

import type { RsaEsDecryptFunction, RsaEsEncryptFunction } from './interfaces.d';
export declare const encrypt: RsaEsEncryptFunction;
export declare const decrypt: RsaEsDecryptFunction;
import type { RsaEsDecryptFunction, RsaEsEncryptFunction } from './interfaces.d'
export declare const encrypt: RsaEsEncryptFunction
export declare const decrypt: RsaEsDecryptFunction

@@ -1,3 +0,3 @@

import type { SignFunction } from './interfaces.d';
declare const sign: SignFunction;
export default sign;
import type { SignFunction } from './interfaces.d'
declare const sign: SignFunction
export default sign

@@ -1,3 +0,3 @@

import type { VerifyFunction } from './interfaces.d';
declare const verify: VerifyFunction;
export default verify;
import type { VerifyFunction } from './interfaces.d'
declare const verify: VerifyFunction
export default verify

@@ -1,3 +0,3 @@

import type { InflateFunction, DeflateFunction } from '../types.d';
export declare const inflate: InflateFunction;
export declare const deflate: DeflateFunction;
import type { InflateFunction, DeflateFunction } from '../types.d'
export declare const inflate: InflateFunction
export declare const deflate: DeflateFunction
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc