From: Dmitry Volyntsev Date: Thu, 27 Apr 2023 02:38:13 +0000 (-0700) Subject: Types: added definitions for Hash.copy() method. X-Git-Url: http://www.kaiwu.me/postgresql/commit/?a=commitdiff_plain;h=016fc3506578209b71e9cfc47dcd2ab1d0e6c772;p=njs.git Types: added definitions for Hash.copy() method. --- diff --git a/test/ts/test.ts b/test/ts/test.ts index 5522f4a1..127fb089 100644 --- a/test/ts/test.ts +++ b/test/ts/test.ts @@ -188,6 +188,7 @@ function crypto_module(str: NjsByteString) { h = cr.createHash("sha1"); h = h.update(str).update(Buffer.from([0])); + h = h.copy(); b = h.digest(); s = cr.createHash("sha256").digest("hex"); diff --git a/ts/njs_modules/crypto.d.ts b/ts/njs_modules/crypto.d.ts index ea554f34..70801144 100644 --- a/ts/njs_modules/crypto.d.ts +++ b/ts/njs_modules/crypto.d.ts @@ -7,6 +7,12 @@ declare module "crypto" { export type DigestEncoding = Exclude; export interface Hash { + /** + * Returns a new Hash object that contains a deep copy of + * the internal state of the current Hash object. + */ + copy(): Hash; + /** * Updates the hash content with the given `data` and returns self. */