Comparing version 1.2.4 to 1.2.5
@@ -0,1 +1,7 @@ | ||
## 1.2.5 | ||
**2020-05-19** | ||
- Improve some param types in index.d.ts. | ||
## 1.2.4 | ||
@@ -2,0 +8,0 @@ |
@@ -211,2 +211,9 @@ declare namespace CryptoES { | ||
interface HasherCfg { | ||
// SHA3 | ||
outputLength?: number | ||
} | ||
/** | ||
@@ -222,4 +229,4 @@ * Abstract hasher template. | ||
static create(cfg?: object): Hasher; | ||
constructor(cfg?: object); | ||
static create(cfg?: HasherCfg): Hasher; | ||
constructor(cfg?: HasherCfg); | ||
@@ -296,2 +303,19 @@ /** | ||
interface CipherCfg { | ||
// Cipher | ||
iv?: lib.WordArray; | ||
mode?: lib.BlockCipherMode; | ||
padding?: pad.Padding; | ||
// SerializableCipher | ||
format?: format.Format; | ||
// PasswordBasedCipher | ||
kdf?: kdf.Kdf; | ||
} | ||
/** | ||
@@ -327,4 +351,4 @@ * Abstract base cipher template. | ||
*/ | ||
static create(xformMode?: number, key?: WordArray, cfg?: object): Cipher; | ||
constructor(xformMode?: number, key?: WordArray, cfg?: object); | ||
static create(xformMode?: number, key?: WordArray, cfg?: CipherCfg): Cipher; | ||
constructor(xformMode?: number, key?: WordArray, cfg?: CipherCfg); | ||
@@ -345,3 +369,3 @@ /** | ||
*/ | ||
static createEncryptor(key?: WordArray, cfg?: object): Cipher; | ||
static createEncryptor(key?: WordArray, cfg?: CipherCfg): Cipher; | ||
/** | ||
@@ -361,3 +385,3 @@ * Creates this cipher in decryption mode. | ||
*/ | ||
static createDecryptor(key?: WordArray, cfg?: object): Cipher; | ||
static createDecryptor(key?: WordArray, cfg?: CipherCfg): Cipher; | ||
@@ -489,5 +513,17 @@ /** | ||
export class BlockCipher extends Cipher { | ||
static create(xformMode?: number, key?: WordArray, cfg?: object): BlockCipher; | ||
static create(xformMode?: number, key?: WordArray, cfg?: CipherCfg): BlockCipher; | ||
} | ||
interface CipherParamsCfg { | ||
ciphertext?: WordArray; | ||
key?: WordArray; | ||
iv?: WordArray; | ||
salt?: WordArray; | ||
algorithm?: Cipher; | ||
mode?: BlockCipherMode; | ||
padding?: pad.Padding; | ||
blockSize?: number; | ||
formatter?: format.Format; | ||
} | ||
/** | ||
@@ -545,4 +581,4 @@ * A collection of cipher parameters. | ||
*/ | ||
static create(cipherParams?: object): CipherParams; | ||
constructor(cipherParams?: object); | ||
static create(cipherParams?: CipherParamsCfg): CipherParams; | ||
constructor(cipherParams?: CipherParamsCfg); | ||
@@ -594,3 +630,3 @@ /** | ||
*/ | ||
static encrypt(cipher?: Function, message?: WordArray | string, key?: WordArray | string, cfg?: object): CipherParams; | ||
static encrypt(cipher?: Function, message?: WordArray | string, key?: WordArray | string, cfg?: CipherCfg): CipherParams; | ||
@@ -618,3 +654,3 @@ /** | ||
*/ | ||
static decrypt(cipher?: Function, ciphertext?: CipherParams | string, key?: WordArray | string, cfg?: object): WordArray; | ||
static decrypt(cipher?: Function, ciphertext?: CipherParams | string, key?: WordArray | string, cfg?: CipherCfg): WordArray; | ||
@@ -666,3 +702,3 @@ /** | ||
*/ | ||
static encrypt(cipher?: Function, message?: WordArray | string, password?: string, cfg?: object): CipherParams; | ||
static encrypt(cipher?: Function, message?: WordArray | string, password?: string, cfg?: CipherCfg): CipherParams; | ||
@@ -690,3 +726,3 @@ /** | ||
*/ | ||
static decrypt(cipher?: Function, ciphertext?: CipherParams | string, password?: string, cfg?: object): WordArray; | ||
static decrypt(cipher?: Function, ciphertext?: CipherParams | string, password?: string, cfg?: CipherCfg): WordArray; | ||
} | ||
@@ -859,4 +895,4 @@ } | ||
export class PBKDF2 extends lib.Base { | ||
static create(cfg?: object): PBKDF2; | ||
constructor(cfg?: object); | ||
static create(cfg?: KDFCfg): PBKDF2; | ||
constructor(cfg?: KDFCfg); | ||
@@ -866,4 +902,4 @@ compute(password?: lib.WordArray | string, salt?: lib.WordArray | string): lib.WordArray; | ||
export class EvpKDF extends lib.Base { | ||
static create(cfg?: object): EvpKDF; | ||
constructor(cfg?: object); | ||
static create(cfg?: KDFCfg): EvpKDF; | ||
constructor(cfg?: KDFCfg); | ||
@@ -923,3 +959,3 @@ compute(password?: lib.WordArray | string, salt?: lib.WordArray | string): lib.WordArray; | ||
type HashFn = (message?: lib.WordArray | string) => lib.WordArray; | ||
type HashFn = (message?: lib.WordArray | string, cfg?: lib.HasherCfg) => lib.WordArray; | ||
type HMACHashFn = (message?: lib.WordArray | string, key?: lib.WordArray | string) => lib.WordArray; | ||
@@ -944,4 +980,13 @@ | ||
type KDFFn = (password?: lib.WordArray | string, salt?: lib.WordArray | string, cfg?: object) => lib.WordArray; | ||
interface KDFCfg { | ||
// EvpKDF | ||
keySize?: number; | ||
hasher?: lib.Hasher; | ||
iterations?: number; | ||
} | ||
type KDFFn = (password?: lib.WordArray | string, salt?: lib.WordArray | string, cfg?: KDFCfg) => lib.WordArray; | ||
export const PBKDF2: KDFFn; | ||
@@ -951,4 +996,4 @@ export const EvpKDF: KDFFn; | ||
interface CipherObj { | ||
encrypt(message?: lib.WordArray | string, key?: lib.WordArray | string, cfg?: object): lib.CipherParams; | ||
decrypt(ciphertext?: lib.CipherParams | string, key?: lib.WordArray | string, cfg?: object): lib.WordArray; | ||
encrypt(message?: lib.WordArray | string, key?: lib.WordArray | string, cfg?: lib.CipherCfg): lib.CipherParams; | ||
decrypt(ciphertext?: lib.CipherParams | lib.CipherParamsCfg | string, key?: lib.WordArray | string, cfg?: lib.CipherCfg): lib.WordArray; | ||
} | ||
@@ -955,0 +1000,0 @@ |
{ | ||
"name": "crypto-es", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "A cryptography algorithms library compatible with ES6 and TypeScript", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -66,11 +66,4 @@ # CryptoES | ||
} | ||
``` | ||
If you want to have type checks, make sure to use overall import: | ||
``` | ||
import CryptoES from 'crypto-es'; | ||
``` | ||
## Guide | ||
@@ -456,3 +449,3 @@ | ||
## Change Logs | ||
## Change Log | ||
@@ -459,0 +452,0 @@ [Change Log](https://github.com/entronad/crypto-es/blob/master/CHANGELOG.md) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
199566
6135
454