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 b8cc7d933..7e9474087 100644 --- a/node/node.d.ts +++ b/node/node.d.ts @@ -1021,8 +1021,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;