mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Update CryptoJS-definition to include lib.WordArray.create and allow the output as input to any Hash (#20072)
* Update CryptoJS-definition to include lib.WordArray.create and allow the output as input to any Hash * fixed indentation
This commit is contained in:
committed by
Ryan Cavanaugh
parent
934989143e
commit
8055d9b2b1
@@ -11,6 +11,10 @@ wordArray = CryptoJS.SHA1('some message', 'some key', { any: true });
|
||||
wordArray = CryptoJS.format.OpenSSL('some message');
|
||||
wordArray = CryptoJS.format.OpenSSL('some message', 'some key');
|
||||
|
||||
var FR = new FileReader();
|
||||
FR.onloadend = () => {
|
||||
var hash = CryptoJS.SHA1(CryptoJS.lib.WordArray.create(FR.result)).toString()
|
||||
}
|
||||
|
||||
// Ciphers
|
||||
var encrypted: CryptoJS.WordArray;
|
||||
|
||||
Vendored
+10
-1
@@ -8,7 +8,7 @@ export as namespace CryptoJS;
|
||||
|
||||
declare var CryptoJS: CryptoJS.Hashes;
|
||||
declare namespace CryptoJS {
|
||||
type Hash = (message: string, key?: string, ...options: any[]) => WordArray;
|
||||
type Hash = (message: string | LibWordArray, key?: string, ...options: any[]) => WordArray;
|
||||
interface Cipher {
|
||||
encrypt(message: string, secretPassphrase: string, option?: CipherOption): WordArray;
|
||||
decrypt(encryptedMessage: string | WordArray, secretPassphrase: string, option?: CipherOption): DecryptedMessage;
|
||||
@@ -25,6 +25,10 @@ declare namespace CryptoJS {
|
||||
process(messagePart: string): string;
|
||||
finalize(): string;
|
||||
}
|
||||
interface LibWordArray {
|
||||
sigBytes: number,
|
||||
words: number[],
|
||||
}
|
||||
export interface WordArray {
|
||||
iv: string;
|
||||
salt: string;
|
||||
@@ -97,6 +101,11 @@ declare namespace CryptoJS {
|
||||
Utf16LE: Encoder;
|
||||
Base64: Encoder;
|
||||
};
|
||||
lib: {
|
||||
WordArray: {
|
||||
create: (v: any) => LibWordArray;
|
||||
};
|
||||
};
|
||||
mode: {
|
||||
CBC: Mode;
|
||||
CFB: Mode;
|
||||
|
||||
Reference in New Issue
Block a user