mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-04 12:11:47 +00:00
Merge commit 'upstream/master~460' into types-2.0
This commit is contained in:
Vendored
+1
@@ -2834,6 +2834,7 @@ declare module "crypto" {
|
||||
setPrivateKey(private_key: string, encoding: HexBase64Latin1Encoding): void;
|
||||
}
|
||||
export function createECDH(curve_name: string): ECDH;
|
||||
export function timingSafeEqual(a: Buffer, b: Buffer): boolean;
|
||||
export var DEFAULT_ENCODING: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -542,6 +542,15 @@ namespace crypto_tests {
|
||||
|
||||
assert.deepEqual(clearText2, clearText);
|
||||
}
|
||||
|
||||
{
|
||||
let buffer1: Buffer = new Buffer([1, 2, 3, 4, 5]);
|
||||
let buffer2: Buffer = new Buffer([1, 2, 3, 4, 5]);
|
||||
let buffer3: Buffer = new Buffer([5, 4, 3, 2, 1]);
|
||||
|
||||
assert(crypto.timingSafeEqual(buffer1, buffer2))
|
||||
assert(!crypto.timingSafeEqual(buffer1, buffer3))
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////
|
||||
|
||||
Reference in New Issue
Block a user