From 941d790d6f42a00fd1b7f2daa65f44c1f881a77b Mon Sep 17 00:00:00 2001 From: John Purcell Date: Wed, 19 Mar 2014 16:53:31 -0400 Subject: [PATCH] Update crypto.Hmac.update and crypto.Hmac.digest methods to the correct signature --- node/node-tests.ts | 8 ++++++++ node/node.d.ts | 4 ++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/node/node-tests.ts b/node/node-tests.ts index 397a9dfa4..f82fb9530 100644 --- a/node/node-tests.ts +++ b/node/node-tests.ts @@ -6,6 +6,7 @@ import events = require("events"); import zlib = require("zlib"); import url = require('url'); import util = require("util"); +import crypto = require("crypto"); assert(1 + 1 - 2 === 0, "The universe isn't how it should."); @@ -80,3 +81,10 @@ function stream_readable_pipe_test() { var w = fs.createWriteStream('file.txt.gz'); r.pipe(z).pipe(w); } + + +//////////////////////////////////////////////////// +/// Crypto tests : http://nodejs.org/api/crypto.html +//////////////////////////////////////////////////// + +var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex'); diff --git a/node/node.d.ts b/node/node.d.ts index a0473ad8b..2e368c314 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1017,8 +1017,8 @@ declare module "crypto" { digest(encoding?: string): string; } interface Hmac { - update(data: any): void; - digest(encoding?: string): void; + update(data: any, input_encoding?: string): Hmac; + digest(encoding?: string): string; } export function createCipher(algorithm: string, password: any): Cipher; export function createCipheriv(algorithm: string, key: any, iv: any): Cipher;