@aws-sdk/hash-node
Advanced tools
Comparing version 3.226.0 to 3.254.0
@@ -5,2 +5,3 @@ "use strict"; | ||
const util_buffer_from_1 = require("@aws-sdk/util-buffer-from"); | ||
const util_utf8_1 = require("@aws-sdk/util-utf8"); | ||
const buffer_1 = require("buffer"); | ||
@@ -10,6 +11,8 @@ const crypto_1 = require("crypto"); | ||
constructor(algorithmIdentifier, secret) { | ||
this.hash = secret ? (0, crypto_1.createHmac)(algorithmIdentifier, castSourceData(secret)) : (0, crypto_1.createHash)(algorithmIdentifier); | ||
this.algorithmIdentifier = algorithmIdentifier; | ||
this.secret = secret; | ||
this.reset(); | ||
} | ||
update(toHash, encoding) { | ||
this.hash.update(castSourceData(toHash, encoding)); | ||
this.hash.update((0, util_utf8_1.toUint8Array)(castSourceData(toHash, encoding))); | ||
} | ||
@@ -19,2 +22,7 @@ digest() { | ||
} | ||
reset() { | ||
this.hash = this.secret | ||
? (0, crypto_1.createHmac)(this.algorithmIdentifier, castSourceData(this.secret)) | ||
: (0, crypto_1.createHash)(this.algorithmIdentifier); | ||
} | ||
} | ||
@@ -21,0 +29,0 @@ exports.Hash = Hash; |
import { fromArrayBuffer, fromString } from "@aws-sdk/util-buffer-from"; | ||
import { toUint8Array } from "@aws-sdk/util-utf8"; | ||
import { Buffer } from "buffer"; | ||
@@ -6,6 +7,8 @@ import { createHash, createHmac } from "crypto"; | ||
constructor(algorithmIdentifier, secret) { | ||
this.hash = secret ? createHmac(algorithmIdentifier, castSourceData(secret)) : createHash(algorithmIdentifier); | ||
this.algorithmIdentifier = algorithmIdentifier; | ||
this.secret = secret; | ||
this.reset(); | ||
} | ||
update(toHash, encoding) { | ||
this.hash.update(castSourceData(toHash, encoding)); | ||
this.hash.update(toUint8Array(castSourceData(toHash, encoding))); | ||
} | ||
@@ -15,2 +18,7 @@ digest() { | ||
} | ||
reset() { | ||
this.hash = this.secret | ||
? createHmac(this.algorithmIdentifier, castSourceData(this.secret)) | ||
: createHash(this.algorithmIdentifier); | ||
} | ||
} | ||
@@ -17,0 +25,0 @@ function castSourceData(toCast, encoding) { |
@@ -1,7 +0,10 @@ | ||
import { Hash as IHash, SourceData } from "@aws-sdk/types"; | ||
export declare class Hash implements IHash { | ||
private readonly hash; | ||
import { Checksum, SourceData } from "@aws-sdk/types"; | ||
export declare class Hash implements Checksum { | ||
private readonly algorithmIdentifier; | ||
private readonly secret?; | ||
private hash; | ||
constructor(algorithmIdentifier: string, secret?: SourceData); | ||
update(toHash: SourceData, encoding?: "utf8" | "ascii" | "latin1"): void; | ||
digest(): Promise<Uint8Array>; | ||
reset(): void; | ||
} |
@@ -1,7 +0,10 @@ | ||
import { Hash as IHash, SourceData } from "@aws-sdk/types"; | ||
export declare class Hash implements IHash { | ||
private readonly hash; | ||
import { Checksum, SourceData } from "@aws-sdk/types"; | ||
export declare class Hash implements Checksum { | ||
private readonly algorithmIdentifier; | ||
private readonly secret?; | ||
private hash; | ||
constructor(algorithmIdentifier: string, secret?: SourceData); | ||
update(toHash: SourceData, encoding?: "utf8" | "ascii" | "latin1"): void; | ||
digest(): Promise<Uint8Array>; | ||
reset(): void; | ||
} |
{ | ||
"name": "@aws-sdk/hash-node", | ||
"version": "3.226.0", | ||
"version": "3.254.0", | ||
"scripts": { | ||
@@ -33,4 +33,5 @@ "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'", | ||
"dependencies": { | ||
"@aws-sdk/types": "3.226.0", | ||
"@aws-sdk/types": "3.254.0", | ||
"@aws-sdk/util-buffer-from": "3.208.0", | ||
"@aws-sdk/util-utf8": "3.254.0", | ||
"tslib": "^2.3.1" | ||
@@ -37,0 +38,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16553
92
4
+ Added@aws-sdk/util-utf8@3.254.0
+ Added@aws-sdk/types@3.254.0(transitive)
+ Added@aws-sdk/util-utf8@3.254.0(transitive)
- Removed@aws-sdk/types@3.226.0(transitive)
Updated@aws-sdk/types@3.254.0