node: definition of the module "crypto" has been changed

This commit is contained in:
Ilya Mochalov
2016-01-12 01:54:02 +05:00
parent 627b6c158b
commit 39e510415c
2 changed files with 14 additions and 7 deletions
+7 -7
View File
@@ -1681,13 +1681,13 @@ declare module "crypto" {
export function createHash(algorithm: string): Hash;
export function createHmac(algorithm: string, key: string): Hmac;
export function createHmac(algorithm: string, key: Buffer): Hmac;
interface Hash {
export interface Hash {
update(data: any, input_encoding?: string): Hash;
digest(encoding: 'buffer'): Buffer;
digest(encoding: string): any;
digest(): Buffer;
}
interface Hmac {
export interface Hmac extends NodeJS.ReadWriteStream {
update(data: any, input_encoding?: string): Hmac;
digest(encoding: 'buffer'): Buffer;
digest(encoding: string): any;
@@ -1695,7 +1695,7 @@ declare module "crypto" {
}
export function createCipher(algorithm: string, password: any): Cipher;
export function createCipheriv(algorithm: string, key: any, iv: any): Cipher;
interface Cipher {
export interface Cipher {
update(data: Buffer): Buffer;
update(data: string, input_encoding?: string, output_encoding?: string): string;
final(): Buffer;
@@ -1704,7 +1704,7 @@ declare module "crypto" {
}
export function createDecipher(algorithm: string, password: any): Decipher;
export function createDecipheriv(algorithm: string, key: any, iv: any): Decipher;
interface Decipher {
export interface Decipher {
update(data: Buffer): Buffer;
update(data: string, input_encoding?: string, output_encoding?: string): string;
final(): Buffer;
@@ -1712,18 +1712,18 @@ declare module "crypto" {
setAutoPadding(auto_padding: boolean): void;
}
export function createSign(algorithm: string): Signer;
interface Signer extends NodeJS.WritableStream {
export interface Signer extends NodeJS.WritableStream {
update(data: any): void;
sign(private_key: string, output_format: string): string;
}
export function createVerify(algorith: string): Verify;
interface Verify extends NodeJS.WritableStream {
export interface Verify extends NodeJS.WritableStream {
update(data: any): void;
verify(object: string, signature: string, signature_format?: string): boolean;
}
export function createDiffieHellman(prime_length: number): DiffieHellman;
export function createDiffieHellman(prime: number, encoding?: string): DiffieHellman;
interface DiffieHellman {
export interface DiffieHellman {
generateKeys(encoding?: string): string;
computeSecret(other_public_key: string, input_encoding?: string, output_encoding?: string): string;
getPrime(encoding?: string): string;