style: fix lint errors
This commit is contained in:
parent
61e5dc13be
commit
5ce0c267f4
|
@ -18,6 +18,7 @@
|
||||||
"@typescript-eslint/interface-name-prefix": 0,
|
"@typescript-eslint/interface-name-prefix": 0,
|
||||||
"@typescript-eslint/no-explicit-any": 0,
|
"@typescript-eslint/no-explicit-any": 0,
|
||||||
"@typescript-eslint/semi": 1,
|
"@typescript-eslint/semi": 1,
|
||||||
|
"@typescript-eslint/explicit-module-boundary-types": 0,
|
||||||
"semi": "off",
|
"semi": "off",
|
||||||
"import/order": ["error", {
|
"import/order": ["error", {
|
||||||
"groups": ["builtin", "external", "internal"],
|
"groups": ["builtin", "external", "internal"],
|
||||||
|
|
|
@ -23,14 +23,12 @@ export class EcCrypto {
|
||||||
publicKey.extractable = true;
|
publicKey.extractable = true;
|
||||||
publicKey.usages = keyUsages.filter((usage) => this.publicKeyUsages.indexOf(usage) !== -1);
|
publicKey.usages = keyUsages.filter((usage) => this.publicKeyUsages.indexOf(usage) !== -1);
|
||||||
|
|
||||||
// @ts-ignore NodeJs d.ts error
|
|
||||||
const keys = crypto.generateKeyPairSync("ec", {
|
const keys = crypto.generateKeyPairSync("ec", {
|
||||||
namedCurve: this.getOpenSSLNamedCurve(algorithm.namedCurve),
|
namedCurve: this.getOpenSSLNamedCurve(algorithm.namedCurve),
|
||||||
publicKeyEncoding: {
|
publicKeyEncoding: {
|
||||||
format: "der",
|
format: "der",
|
||||||
type: "spki",
|
type: "spki",
|
||||||
},
|
},
|
||||||
// @ts-ignore NodeJs d.ts error
|
|
||||||
privateKeyEncoding: {
|
privateKeyEncoding: {
|
||||||
format: "der",
|
format: "der",
|
||||||
type: "pkcs8",
|
type: "pkcs8",
|
||||||
|
|
|
@ -34,7 +34,6 @@ export class RsaCrypto {
|
||||||
Buffer.from(algorithm.publicExponent),
|
Buffer.from(algorithm.publicExponent),
|
||||||
]).readInt32BE(0);
|
]).readInt32BE(0);
|
||||||
|
|
||||||
// @ts-ignore NodeJs d.ts error
|
|
||||||
const keys = crypto.generateKeyPairSync("rsa", {
|
const keys = crypto.generateKeyPairSync("rsa", {
|
||||||
modulusLength: algorithm.modulusLength,
|
modulusLength: algorithm.modulusLength,
|
||||||
publicExponent,
|
publicExponent,
|
||||||
|
@ -199,7 +198,6 @@ export class RsaCrypto {
|
||||||
key: key.pem,
|
key: key.pem,
|
||||||
};
|
};
|
||||||
if (algorithm.name.toUpperCase() === "RSA-PSS") {
|
if (algorithm.name.toUpperCase() === "RSA-PSS") {
|
||||||
// @ts-ignore
|
|
||||||
options.padding = crypto.constants.RSA_PKCS1_PSS_PADDING;
|
options.padding = crypto.constants.RSA_PKCS1_PSS_PADDING;
|
||||||
options.saltLength = (algorithm as RsaPssParams).saltLength;
|
options.saltLength = (algorithm as RsaPssParams).saltLength;
|
||||||
}
|
}
|
||||||
|
@ -220,7 +218,6 @@ export class RsaCrypto {
|
||||||
key: key.pem,
|
key: key.pem,
|
||||||
};
|
};
|
||||||
if (algorithm.name.toUpperCase() === "RSA-PSS") {
|
if (algorithm.name.toUpperCase() === "RSA-PSS") {
|
||||||
// @ts-ignore
|
|
||||||
options.padding = crypto.constants.RSA_PKCS1_PSS_PADDING;
|
options.padding = crypto.constants.RSA_PKCS1_PSS_PADDING;
|
||||||
options.saltLength = (algorithm as RsaPssParams).saltLength;
|
options.saltLength = (algorithm as RsaPssParams).saltLength;
|
||||||
}
|
}
|
||||||
|
@ -232,7 +229,6 @@ export class RsaCrypto {
|
||||||
protected static encryptOAEP(algorithm: RsaOaepParams, key: RsaPublicKey, data: Uint8Array) {
|
protected static encryptOAEP(algorithm: RsaOaepParams, key: RsaPublicKey, data: Uint8Array) {
|
||||||
const options: crypto.RsaPublicKey = {
|
const options: crypto.RsaPublicKey = {
|
||||||
key: `-----BEGIN PUBLIC KEY-----\n${key.data.toString("base64")}\n-----END PUBLIC KEY-----`,
|
key: `-----BEGIN PUBLIC KEY-----\n${key.data.toString("base64")}\n-----END PUBLIC KEY-----`,
|
||||||
// @ts-ignore
|
|
||||||
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
|
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
|
||||||
};
|
};
|
||||||
if (algorithm.label) {
|
if (algorithm.label) {
|
||||||
|
@ -245,7 +241,6 @@ export class RsaCrypto {
|
||||||
protected static decryptOAEP(algorithm: RsaOaepParams, key: RsaPrivateKey, data: Uint8Array) {
|
protected static decryptOAEP(algorithm: RsaOaepParams, key: RsaPrivateKey, data: Uint8Array) {
|
||||||
const options: crypto.RsaPrivateKey = {
|
const options: crypto.RsaPrivateKey = {
|
||||||
key: `-----BEGIN PRIVATE KEY-----\n${key.data.toString("base64")}\n-----END PRIVATE KEY-----`,
|
key: `-----BEGIN PRIVATE KEY-----\n${key.data.toString("base64")}\n-----END PRIVATE KEY-----`,
|
||||||
// @ts-ignore
|
|
||||||
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
|
padding: crypto.constants.RSA_PKCS1_OAEP_PADDING,
|
||||||
};
|
};
|
||||||
if (algorithm.label) {
|
if (algorithm.label) {
|
||||||
|
|
|
@ -87,7 +87,6 @@ export class RsaEsProvider extends core.ProviderCrypto {
|
||||||
const type = key.type.toUpperCase();
|
const type = key.type.toUpperCase();
|
||||||
return {
|
return {
|
||||||
key: `-----BEGIN ${type} KEY-----\n${getCryptoKey(key).data.toString("base64")}\n-----END ${type} KEY-----`,
|
key: `-----BEGIN ${type} KEY-----\n${getCryptoKey(key).data.toString("base64")}\n-----END ${type} KEY-----`,
|
||||||
// @ts-ignore
|
|
||||||
padding: crypto.constants.RSA_PKCS1_PADDING,
|
padding: crypto.constants.RSA_PKCS1_PADDING,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue