mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-07 16:30:12 +08:00
Merge pull request #7574 from chrootsu/node-crypto
node: definition of the module "crypto" has been changed
This commit is contained in:
@@ -203,6 +203,13 @@ function stream_readable_pipe_test() {
|
||||
|
||||
var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex');
|
||||
|
||||
{
|
||||
let hmac: crypto.Hmac;
|
||||
(hmac = crypto.createHmac('md5', 'hello')).end('world', 'utf8', () => {
|
||||
let hash: Buffer|string = hmac.read();
|
||||
});
|
||||
}
|
||||
|
||||
function crypto_cipher_decipher_string_test() {
|
||||
var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]);
|
||||
var clearText:string = "This is the clear text.";
|
||||
|
||||
Vendored
+7
-7
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user