@cripty2001/utils 0.0.238 → 0.0.239
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -138,3 +138,4 @@ export declare function timesafeEqual(a: string, b: string): boolean;
|
|
|
138
138
|
export declare function builddigest(data: string): string;
|
|
139
139
|
export declare function checkDigest(data: string, digest: string): boolean;
|
|
140
140
|
export declare function enforceDigest(data: string, digest: string): void;
|
|
141
|
+
export declare function isDigest(digest: string): boolean;
|
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ exports.timesafeEqual = timesafeEqual;
|
|
|
27
27
|
exports.builddigest = builddigest;
|
|
28
28
|
exports.checkDigest = checkDigest;
|
|
29
29
|
exports.enforceDigest = enforceDigest;
|
|
30
|
+
exports.isDigest = isDigest;
|
|
30
31
|
const whispr_1 = require("@cripty2001/whispr");
|
|
31
32
|
const value_1 = require("@sinclair/typebox/value");
|
|
32
33
|
const crypto_1 = require("crypto");
|
|
@@ -394,3 +395,6 @@ function enforceDigest(data, digest) {
|
|
|
394
395
|
if (!checkDigest(data, digest))
|
|
395
396
|
throw new Error(`The digest does not match the data.`);
|
|
396
397
|
}
|
|
398
|
+
function isDigest(digest) {
|
|
399
|
+
return digest.startsWith(DIGEST_PREFIX) && digest.length === DIGEST_PREFIX.length + 43;
|
|
400
|
+
}
|
package/package.json
CHANGED