apeframework 0.0.0-dev.29 → 0.0.0-dev.30

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/pwd/Pwd.d.ts CHANGED
@@ -6,7 +6,7 @@ declare class Pwd {
6
6
  private readonly timeCost;
7
7
  private readonly parallelism;
8
8
  constructor(params: {
9
- algorithm?: Algorithm;
9
+ algorithm: Algorithm;
10
10
  hashLength?: number;
11
11
  memoryCost?: number;
12
12
  timeCost?: number;
package/dist/pwd/Pwd.js CHANGED
@@ -22,7 +22,7 @@ class Pwd {
22
22
  }
23
23
  async hashPassword(password) {
24
24
  return argon2.hash(password, {
25
- ...this.algorithm ? { type: this.algorithm } : {},
25
+ type: this.algorithm,
26
26
  hashLength: this.hashLength,
27
27
  memoryCost: this.memoryCost,
28
28
  timeCost: this.timeCost,
@@ -0,0 +1,2 @@
1
+ declare const getRandomIntString: (length: number) => string;
2
+ export { getRandomIntString, };
@@ -0,0 +1,9 @@
1
+ import { randomInt } from 'crypto';
2
+ const getRandomIntString = (length) => {
3
+ let string = '';
4
+ for (let i = 0; i < length; i += 1) {
5
+ string += randomInt(0, 10).toString();
6
+ }
7
+ return string;
8
+ };
9
+ export { getRandomIntString, };
@@ -1,2 +1,2 @@
1
- declare const getTimestamp: () => number;
1
+ declare const getTimestamp: (date?: Date) => number;
2
2
  export { getTimestamp, };
@@ -1,4 +1,4 @@
1
- const getTimestamp = () => {
2
- return Math.trunc(Date.now() / 1000);
1
+ const getTimestamp = (date = new Date()) => {
2
+ return Math.trunc(date.getTime() / 1000);
3
3
  };
4
4
  export { getTimestamp, };
@@ -0,0 +1,2 @@
1
+ declare const isValidIntString: (string: string) => boolean;
2
+ export { isValidIntString, };
@@ -0,0 +1,5 @@
1
+ const intStringRegex = /^[0-9]*$/u;
2
+ const isValidIntString = (string) => {
3
+ return intStringRegex.test(string);
4
+ };
5
+ export { isValidIntString, };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "apeframework",
3
- "version": "0.0.0-dev.29",
3
+ "version": "0.0.0-dev.30",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -662,6 +662,12 @@
662
662
  "default": "./dist/utils/getRandomHexString.js"
663
663
  }
664
664
  },
665
+ "./utils/getRandomIntString": {
666
+ "import": {
667
+ "types": "./dist/utils/getRandomIntString.d.ts",
668
+ "default": "./dist/utils/getRandomIntString.js"
669
+ }
670
+ },
665
671
  "./utils/getTimestamp": {
666
672
  "import": {
667
673
  "types": "./dist/utils/getTimestamp.d.ts",
@@ -686,6 +692,12 @@
686
692
  "default": "./dist/utils/isValidHexString.js"
687
693
  }
688
694
  },
695
+ "./utils/isValidIntString": {
696
+ "import": {
697
+ "types": "./dist/utils/isValidIntString.d.ts",
698
+ "default": "./dist/utils/isValidIntString.js"
699
+ }
700
+ },
689
701
  "./utils/isValidIsoDate": {
690
702
  "import": {
691
703
  "types": "./dist/utils/isValidIsoDate.d.ts",