@cripty2001/utils 0.0.233 → 0.0.234

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 CHANGED
@@ -134,3 +134,4 @@ export declare function timediff2HumanReadable(diffMs: number): string;
134
134
  export declare function fn2promise<T>(fn: () => T | Promise<T>): Promise<T>;
135
135
  export type SafeApplyed<T> = (updater: (draft: T) => T | void) => T;
136
136
  export declare function safeApply<T>(updater: (draft: T) => T | void, incoming: T): T;
137
+ export declare function timesafeEqual(a: string, b: string): boolean;
package/dist/index.js CHANGED
@@ -23,8 +23,10 @@ exports.getClock = getClock;
23
23
  exports.timediff2HumanReadable = timediff2HumanReadable;
24
24
  exports.fn2promise = fn2promise;
25
25
  exports.safeApply = safeApply;
26
+ exports.timesafeEqual = timesafeEqual;
26
27
  const whispr_1 = require("@cripty2001/whispr");
27
28
  const value_1 = require("@sinclair/typebox/value");
29
+ const crypto_1 = require("crypto");
28
30
  const lodash_1 = require("lodash");
29
31
  const U32_LIMIT = 0x1_0000_0000;
30
32
  function randomU32() {
@@ -367,3 +369,8 @@ function safeApply(updater, incoming) {
367
369
  const chosen = new_data ?? cloned;
368
370
  return structuredClone(chosen);
369
371
  }
372
+ function timesafeEqual(a, b) {
373
+ if (a.length !== b.length)
374
+ return false;
375
+ return (0, crypto_1.timingSafeEqual)(Buffer.from(a), Buffer.from(b));
376
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cripty2001/utils",
3
- "version": "0.0.233",
3
+ "version": "0.0.234",
4
4
  "description": "Internal Set of utils. If you need them use them, otherwise go to the next package ;)",
5
5
  "homepage": "https://github.com/cripty2001/utils#readme",
6
6
  "bugs": {