[njs] Types: added definitions for Hash.copy() method.

Dmitry Volyntsev xeioex at nginx.com
Thu Apr 27 04:06:03 UTC 2023


details:   https://hg.nginx.org/njs/rev/2efa017faaed
branches:  
changeset: 2090:2efa017faaed
user:      Dmitry Volyntsev <xeioex at nginx.com>
date:      Wed Apr 26 19:38:13 2023 -0700
description:
Types: added definitions for Hash.copy() method.

diffstat:

 test/ts/test.ts            |  1 +
 ts/njs_modules/crypto.d.ts |  6 ++++++
 2 files changed, 7 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r 9fbae1f025e2 -r 2efa017faaed test/ts/test.ts
--- a/test/ts/test.ts	Wed Apr 26 17:27:48 2023 -0700
+++ b/test/ts/test.ts	Wed Apr 26 19:38:13 2023 -0700
@@ -188,6 +188,7 @@ function crypto_module(str: NjsByteStrin
 
     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 -r 9fbae1f025e2 -r 2efa017faaed ts/njs_modules/crypto.d.ts
--- a/ts/njs_modules/crypto.d.ts	Wed Apr 26 17:27:48 2023 -0700
+++ b/ts/njs_modules/crypto.d.ts	Wed Apr 26 19:38:13 2023 -0700
@@ -8,6 +8,12 @@ declare module "crypto" {
 
     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.
          */
         update(data: NjsStringOrBuffer): Hash;


More information about the nginx-devel mailing list