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

@webcrypto/tools

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@webcrypto/tools - npm Package Compare versions

Comparing version 1.0.6 to 1.1.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

# [1.1.0](https://github.com/willgm/web-crypto-tools/compare/v1.0.6...v1.1.0) (2020-05-29)
### Features
* **jwk:** adds support for importing key from JSON Web Key ([befcf93](https://github.com/willgm/web-crypto-tools/commit/befcf93dfc965c4dc801dd577689cf694b35ffa5))
## [1.0.6](https://github.com/willgm/web-crypto-tools/compare/v1.0.5...v1.0.6) (2020-05-27)

@@ -2,0 +9,0 @@

3

dist/lib/web-crypto-tools.js

@@ -22,3 +22,4 @@ "use strict";

function generateBaseCryptoKey(rawKey, algorithm = 'PBKDF2', keyUsages = ['deriveKey'], format = 'raw') {
return Promise.resolve(crypto.subtle.importKey(format, encode(rawKey), algorithm, false, // the original value will not be extractable
const isJwkKey = !isTypedArray(rawKey) && typeof rawKey === 'object';
return Promise.resolve(crypto.subtle.importKey(isJwkKey ? 'jwk' : format, typeof rawKey === 'string' ? encode(rawKey) : rawKey, algorithm, false, // the original value will not be extractable
keyUsages));

@@ -25,0 +26,0 @@ }

@@ -26,3 +26,4 @@ 'use strict';

if (format === void 0) { format = 'raw'; }
return Promise.resolve(crypto.subtle.importKey(format, encode(rawKey), algorithm, false, // the original value will not be extractable
var isJwkKey = !isTypedArray(rawKey) && typeof rawKey === 'object';
return Promise.resolve(crypto.subtle.importKey(isJwkKey ? 'jwk' : format, typeof rawKey === 'string' ? encode(rawKey) : rawKey, algorithm, false, // the original value will not be extractable
keyUsages));

@@ -29,0 +30,0 @@ }

@@ -8,3 +8,3 @@ /**

*/
export declare type OriginalKeyFormat = 'raw' | 'pkcs8' | 'spki';
export declare type OriginalKeyFormat = 'raw' | 'pkcs8' | 'spki' | 'jwk';
/**

@@ -47,3 +47,3 @@ * Derive Key Algorithms at at Web Crypto API

*/
export declare function generateBaseCryptoKey(rawKey: string | TypedArray, algorithm?: ImportAlgorithm, keyUsages?: KeyUsage[], format?: OriginalKeyFormat): Promise<CryptoKey>;
export declare function generateBaseCryptoKey(rawKey: string | TypedArray | JsonWebKey, algorithm?: ImportAlgorithm, keyUsages?: KeyUsage[], format?: OriginalKeyFormat): Promise<CryptoKey>;
/**

@@ -55,4 +55,4 @@ * Derives a base Crypto Key to new one that can be used in encrypt / decrypt algorithms

* @param salt The salt value to be used with the default `PBKDF2` derive algorithm.
* @param iterations The number of iterations to be used with the default `PBKDF2` derive algorithm.
* @param keyUsages The new uses of the new derive Crypto Key.
* @param iterations The number of iterations to be used with the default `PBKDF2` derive algorithm. Default value: `PBKDF2_ITERATIONS_DEFAULT`.
* @param keyUsages The new uses of the new derive Crypto Key. Default value: `['encrypt', 'decrypt']`.
* @returns A promise with the derived Crypto Key for other uses.

@@ -67,4 +67,4 @@ */

* @param salt The salt value to be used with the default `PBKDF2` derive algorithm.
* @param algorithmFor The algorithm where the derived Crypto Key will be used.
* @param keyUsages The new uses of the new derive Crypto Key.
* @param algorithmFor The algorithm where the derived Crypto Key will be used. Default value: `{ name: 'AES-GCM', length: 256 }`.
* @param keyUsages The new uses of the new derive Crypto Key. Default value: `['encrypt', 'decrypt']`.
* @returns A promise with the derived Crypto Key for other uses.

@@ -79,4 +79,4 @@ */

* @param deriveAlgorithm The algorithm to be used when deriving the Crypto Key.
* @param algorithmFor The algorithm where the derived Crypto Key will be used.
* @param keyUsages The new uses of the new derive Crypto Key.
* @param algorithmFor The algorithm where the derived Crypto Key will be used. Default value: `{ name: 'AES-GCM', length: 256 }`.
* @param keyUsages The new uses of the new derive Crypto Key. Default value: `['encrypt', 'decrypt']`.
* @returns A promise with the derived Crypto Key for other uses.

@@ -83,0 +83,0 @@ */

@@ -19,3 +19,4 @@ /**

function generateBaseCryptoKey(rawKey, algorithm = 'PBKDF2', keyUsages = ['deriveKey'], format = 'raw') {
return Promise.resolve(crypto.subtle.importKey(format, encode(rawKey), algorithm, false, // the original value will not be extractable
const isJwkKey = !isTypedArray(rawKey) && typeof rawKey === 'object';
return Promise.resolve(crypto.subtle.importKey(isJwkKey ? 'jwk' : format, typeof rawKey === 'string' ? encode(rawKey) : rawKey, algorithm, false, // the original value will not be extractable
keyUsages));

@@ -22,0 +23,0 @@ }

@@ -22,3 +22,4 @@ /**

if (format === void 0) { format = 'raw'; }
return Promise.resolve(crypto.subtle.importKey(format, encode(rawKey), algorithm, false, // the original value will not be extractable
var isJwkKey = !isTypedArray(rawKey) && typeof rawKey === 'object';
return Promise.resolve(crypto.subtle.importKey(isJwkKey ? 'jwk' : format, typeof rawKey === 'string' ? encode(rawKey) : rawKey, algorithm, false, // the original value will not be extractable
keyUsages));

@@ -25,0 +26,0 @@ }

@@ -28,3 +28,4 @@ (function (global, factory) {

if (format === void 0) { format = 'raw'; }
return Promise.resolve(crypto.subtle.importKey(format, encode(rawKey), algorithm, false, // the original value will not be extractable
var isJwkKey = !isTypedArray(rawKey) && typeof rawKey === 'object';
return Promise.resolve(crypto.subtle.importKey(isJwkKey ? 'jwk' : format, typeof rawKey === 'string' ? encode(rawKey) : rawKey, algorithm, false, // the original value will not be extractable
keyUsages));

@@ -31,0 +32,0 @@ }

{
"name": "@webcrypto/tools",
"version": "1.0.6",
"version": "1.1.0",
"private": false,

@@ -71,3 +71,4 @@ "description": "A set of tools to facilitate and give good defaults for use of the native Web Crypto API.",

"CHANGELOG.md",
"package.json"
"package.json",
"package-lock.json"
]

@@ -74,0 +75,0 @@ }

@@ -25,2 +25,3 @@ # Web Crypto Tools

deriveCryptKey,
generateSalt,
encryptValue,

@@ -27,0 +28,0 @@ decryptValue,

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