Added WordArray to Hash type Definition

Added the WordArray type to the Hash type.

var kDate = Crypto.HmacSHA256(dateStamp, "AWS4" + key);
    var kRegion = Crypto.HmacSHA256(regionName, kDate); <=== Issue because kDate is typeof WordArray and not string as the key should be supposed to. 
With adding the WordArray type the Hashing Procedure works fine (when using the toString it doesn't work correctly there).

Sample for JS from Amazon:
https://docs.aws.amazon.com/de_de/general/latest/gr/signature-v4-examples.html#signature-v4-examples-javascript
This commit is contained in:
Ritorna
2017-12-07 17:03:09 +01:00
committed by GitHub
parent b13b82c214
commit 2d7c61c83d

View File

@@ -8,7 +8,7 @@ export as namespace CryptoJS;
declare var CryptoJS: CryptoJS.Hashes;
declare namespace CryptoJS {
type Hash = (message: string | LibWordArray, key?: string, ...options: any[]) => WordArray;
type Hash = (message: string | LibWordArray, key?: string | WordArray, ...options: any[]) => WordArray;
interface Cipher {
encrypt(message: string, secretPassphrase: string | WordArray, option?: CipherOption): WordArray;
decrypt(encryptedMessage: string | WordArray, secretPassphrase: string | WordArray, option?: CipherOption): DecryptedMessage;