Merge pull request #62 from PeculiarVentures/update-dependencies
Update dependencies
This commit is contained in:
commit
c74cf09150
|
@ -16,7 +16,7 @@ jobs:
|
|||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [14.x, 16.x]
|
||||
node-version: [14.x, 16.x, 18.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
@ -39,7 +39,7 @@ jobs:
|
|||
${{ runner.os }}-
|
||||
|
||||
- name: Install global dependencies
|
||||
run: npm i yarn -g
|
||||
run: npm i yarn nyc coveralls -g
|
||||
|
||||
- name: Install dependencies
|
||||
run: yarn
|
||||
|
|
28
package.json
28
package.json
|
@ -54,27 +54,25 @@
|
|||
"homepage": "https://github.com/PeculiarVentures/webcrypto#readme",
|
||||
"devDependencies": {
|
||||
"@peculiar/webcrypto-test": "^1.0.7",
|
||||
"@types/mocha": "^10.0.0",
|
||||
"@types/node": "^18.11.9",
|
||||
"@typescript-eslint/eslint-plugin": "^5.42.0",
|
||||
"@typescript-eslint/parser": "^5.42.0",
|
||||
"coveralls": "^3.1.1",
|
||||
"eslint": "^8.26.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"mocha": "^10.1.0",
|
||||
"nyc": "^15.1.0",
|
||||
"rimraf": "^3.0.2",
|
||||
"rollup": "^3.2.5",
|
||||
"@types/mocha": "^10.0.1",
|
||||
"@types/node": "^18.15.5",
|
||||
"@typescript-eslint/eslint-plugin": "^5.56.0",
|
||||
"@typescript-eslint/parser": "^5.56.0",
|
||||
"eslint": "^8.36.0",
|
||||
"eslint-plugin-import": "^2.27.5",
|
||||
"mocha": "^10.2.0",
|
||||
"rimraf": "^4.4.0",
|
||||
"rollup": "^3.20.0",
|
||||
"rollup-plugin-typescript2": "^0.34.1",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.8.4"
|
||||
"typescript": "^5.0.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@peculiar/asn1-schema": "^2.3.0",
|
||||
"@peculiar/asn1-schema": "^2.3.6",
|
||||
"@peculiar/json-schema": "^1.1.12",
|
||||
"pvtsutils": "^1.3.2",
|
||||
"tslib": "^2.4.1",
|
||||
"webcrypto-core": "^1.7.4"
|
||||
"tslib": "^2.5.0",
|
||||
"webcrypto-core": "^1.7.7"
|
||||
},
|
||||
"nyc": {
|
||||
"extension": [
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { getCryptoKey, setCryptoKey } from "../storage";
|
||||
import { AesCrypto } from "./crypto";
|
||||
import { AesCryptoKey } from "./key";
|
||||
import { getCryptoKey, setCryptoKey } from "../storage";
|
||||
|
||||
export class AesCbcProvider extends core.AesCbcProvider {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as crypto from "crypto";
|
||||
import * as core from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { AesCrypto } from "./crypto";
|
||||
import { AesCryptoKey } from "./key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
/**
|
||||
* AES-CMAC implementation source code from https://github.com/allan-stewart/node-aes-cmac
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { AesCrypto } from "./crypto";
|
||||
import { AesCryptoKey } from "./key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class AesCtrProvider extends core.AesCtrProvider {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { AesCrypto } from "./crypto";
|
||||
import { AesCryptoKey } from "./key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class AesEcbProvider extends core.AesEcbProvider {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { AesCrypto } from "./crypto";
|
||||
import { AesCryptoKey } from "./key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class AesGcmProvider extends core.AesGcmProvider {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { AesCrypto } from "./crypto";
|
||||
import { AesCryptoKey } from "./key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class AesKwProvider extends core.AesKwProvider {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import crypto, { CipherGCM, DecipherGCM } from "crypto";
|
||||
import { JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import * as core from "webcrypto-core";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { AesCryptoKey } from "./key";
|
||||
import { CryptoKey } from "../../keys";
|
||||
|
||||
export class AesCrypto {
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@ import crypto from "crypto";
|
|||
import { JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import * as core from "webcrypto-core";
|
||||
import { DesParams } from "webcrypto-core";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { DesCryptoKey } from "./key";
|
||||
import { CryptoKey } from "../../keys";
|
||||
|
||||
export class DesCrypto {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { DesCrypto } from "./crypto";
|
||||
import { DesCryptoKey } from "./key";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export type DesCbcParams = core.DesParams;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { DesCrypto } from "./crypto";
|
||||
import { DesCryptoKey } from "./key";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export type DesEde3CbcParams = core.DesParams;
|
||||
|
||||
|
|
|
@ -3,11 +3,11 @@ import { AsnParser, AsnSerializer } from "@peculiar/asn1-schema";
|
|||
import { JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import { BufferSourceConverter } from "pvtsutils";
|
||||
import * as core from "webcrypto-core";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { ShaCrypto } from "../sha";
|
||||
import { getOidByNamedCurve } from "./helper";
|
||||
import { EcPrivateKey } from "./private_key";
|
||||
import { EcPublicKey } from "./public_key";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { ShaCrypto } from "../sha";
|
||||
|
||||
export class EcCrypto {
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { EcCrypto } from "./crypto";
|
||||
import { EcPrivateKey } from "./private_key";
|
||||
import { EcPublicKey } from "./public_key";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class EcdhProvider extends core.EcdhProvider {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { EcCrypto } from "./crypto";
|
||||
import { EcPrivateKey } from "./private_key";
|
||||
import { EcPublicKey } from "./public_key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class EcdsaProvider extends core.EcdsaProvider {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { AsnParser, AsnSerializer } from "@peculiar/asn1-schema";
|
||||
import { IJsonConvertible, JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import * as core from "webcrypto-core";
|
||||
import { AsymmetricKey } from "../../keys";
|
||||
import { getOidByNamedCurve } from "./helper";
|
||||
import { AsymmetricKey } from "../../keys";
|
||||
|
||||
export class EcPrivateKey extends AsymmetricKey implements IJsonConvertible {
|
||||
public readonly type = "private" as const;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { AsnParser, AsnSerializer } from "@peculiar/asn1-schema";
|
||||
import { IJsonConvertible, JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import * as core from "webcrypto-core";
|
||||
import { AsymmetricKey } from "../../keys/asymmetric";
|
||||
import { getOidByNamedCurve } from "./helper";
|
||||
import { AsymmetricKey } from "../../keys/asymmetric";
|
||||
|
||||
export class EcPublicKey extends AsymmetricKey implements IJsonConvertible {
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ import { AsnParser } from "@peculiar/asn1-schema";
|
|||
import { JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import { Convert } from "pvtsutils";
|
||||
import * as core from "webcrypto-core";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { EdPrivateKey } from "./private_key";
|
||||
import { EdPublicKey } from "./public_key";
|
||||
import { CryptoKey } from "../../keys";
|
||||
|
||||
export class EdCrypto {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { EdCrypto } from "./crypto";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { getCryptoKey, setCryptoKey } from "../storage";
|
||||
import { EdCrypto } from "./crypto";
|
||||
|
||||
export class EcdhEsProvider extends core.EcdhEsProvider {
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { getCryptoKey, setCryptoKey } from "../storage";
|
||||
import { EdCrypto } from "./crypto";
|
||||
import { EdPrivateKey } from "./private_key";
|
||||
import { EdPublicKey } from "./public_key";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { getCryptoKey, setCryptoKey } from "../storage";
|
||||
|
||||
export class EdDsaProvider extends core.EdDsaProvider {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { AsnParser, AsnSerializer } from "@peculiar/asn1-schema";
|
||||
import { IJsonConvertible, JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import * as core from "webcrypto-core";
|
||||
import { AsymmetricKey } from "../../keys";
|
||||
import { getOidByNamedCurve } from "./helper";
|
||||
import { AsymmetricKey } from "../../keys";
|
||||
|
||||
export class EdPrivateKey extends AsymmetricKey implements IJsonConvertible {
|
||||
public readonly type = "private" as const;
|
||||
|
|
|
@ -2,8 +2,8 @@ import { AsnParser, AsnSerializer } from "@peculiar/asn1-schema";
|
|||
import { IJsonConvertible } from "@peculiar/json-schema";
|
||||
import { Convert } from "pvtsutils";
|
||||
import * as core from "webcrypto-core";
|
||||
import { AsymmetricKey } from "../../keys/asymmetric";
|
||||
import { getOidByNamedCurve } from "./helper";
|
||||
import { AsymmetricKey } from "../../keys/asymmetric";
|
||||
|
||||
export class EdPublicKey extends AsymmetricKey implements IJsonConvertible {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import crypto from "crypto";
|
||||
import * as core from "webcrypto-core";
|
||||
import { BufferSourceConverter, CryptoKey } from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { HkdfCryptoKey } from "./key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class HkdfProvider extends core.HkdfProvider {
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import crypto from "crypto";
|
||||
import { JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import * as core from "webcrypto-core";
|
||||
import { HmacCryptoKey } from "./key";
|
||||
import { ShaCrypto } from "../sha";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { HmacCryptoKey } from "./key";
|
||||
|
||||
export class HmacProvider extends core.HmacProvider {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import crypto from "crypto";
|
||||
import * as core from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { PbkdfCryptoKey } from "./key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class Pbkdf2Provider extends core.Pbkdf2Provider {
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ import crypto from "crypto";
|
|||
import { AsnParser, AsnSerializer } from "@peculiar/asn1-schema";
|
||||
import { JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import * as core from "webcrypto-core";
|
||||
import { CryptoKey } from "../../keys";
|
||||
import { RsaPrivateKey } from "./private_key";
|
||||
import { RsaPublicKey } from "./public_key";
|
||||
import { CryptoKey } from "../../keys";
|
||||
|
||||
interface INodeCryptoSignOptions {
|
||||
key: string;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { AsnParser, AsnSerializer } from "@peculiar/asn1-schema";
|
||||
import { JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import * as core from "webcrypto-core";
|
||||
import { AsymmetricKey } from "../../keys";
|
||||
import { getJwkAlgorithm } from "./helper";
|
||||
import { AsymmetricKey } from "../../keys";
|
||||
|
||||
export class RsaPrivateKey extends AsymmetricKey {
|
||||
public readonly type = "private" as const;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { AsnParser, AsnSerializer } from "@peculiar/asn1-schema";
|
||||
import { JsonParser, JsonSerializer } from "@peculiar/json-schema";
|
||||
import * as core from "webcrypto-core";
|
||||
import { AsymmetricKey } from "../../keys/asymmetric";
|
||||
import { getJwkAlgorithm } from "./helper";
|
||||
import { AsymmetricKey } from "../../keys/asymmetric";
|
||||
|
||||
export class RsaPublicKey extends AsymmetricKey {
|
||||
public readonly type = "public" as const;
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import * as crypto from "crypto";
|
||||
import { Convert } from "pvtsutils";
|
||||
import * as core from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { RsaCrypto } from "./crypto";
|
||||
import { RsaPrivateKey } from "./private_key";
|
||||
import { RsaPublicKey } from "./public_key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class RsaEsProvider extends core.ProviderCrypto {
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import crypto from "crypto";
|
||||
import * as core from "webcrypto-core";
|
||||
import { ShaCrypto } from "../sha/crypto";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { RsaCrypto } from "./crypto";
|
||||
import { RsaPrivateKey } from "./private_key";
|
||||
import { RsaPublicKey } from "./public_key";
|
||||
import { ShaCrypto } from "../sha/crypto";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
/**
|
||||
* Source code for decrypt, encrypt, mgf1 functions is from asmcrypto module
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { RsaCrypto } from "./crypto";
|
||||
import { RsaPrivateKey } from "./private_key";
|
||||
import { RsaPublicKey } from "./public_key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class RsaPssProvider extends core.RsaPssProvider {
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import * as core from "webcrypto-core";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
import { RsaCrypto } from "./crypto";
|
||||
import { RsaPrivateKey } from "./private_key";
|
||||
import { RsaPublicKey } from "./public_key";
|
||||
import { setCryptoKey, getCryptoKey } from "../storage";
|
||||
|
||||
export class RsaSsaProvider extends core.RsaSsaProvider {
|
||||
|
||||
|
|
|
@ -30,7 +30,10 @@ export class SubtleCrypto extends core.SubtleCrypto {
|
|||
//#endregion
|
||||
|
||||
//#region DES
|
||||
const ciphers = crypto.getCiphers();
|
||||
if (ciphers.includes("des-cbc")) {
|
||||
this.providers.set(new DesCbcProvider());
|
||||
}
|
||||
this.providers.set(new DesEde3CbcProvider());
|
||||
//#endregion
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import assert from "assert";
|
||||
import process from "process";
|
||||
import assert from "node:assert";
|
||||
import nodeCrypto from "node:crypto";
|
||||
import process from "node:process";
|
||||
import { WebcryptoTest } from "@peculiar/webcrypto-test";
|
||||
import { Convert } from "pvtsutils";
|
||||
import * as core from "webcrypto-core";
|
||||
|
@ -10,7 +11,11 @@ const nodeMajorVersion = parseInt(/^v(\d+)/.exec(process.version)![1], 10);
|
|||
|
||||
const crypto = new Crypto();
|
||||
|
||||
WebcryptoTest.check(crypto as any, {});
|
||||
const ciphers = nodeCrypto.getCiphers();
|
||||
|
||||
WebcryptoTest.check(crypto as any, {
|
||||
DESCBC: !ciphers.includes("des-cbc"),
|
||||
});
|
||||
context("Crypto", () => {
|
||||
|
||||
context("getRandomValues", () => {
|
||||
|
|
Reference in New Issue