@maestro-js/password 1.0.0-alpha.16 → 1.0.0-alpha.18

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
@@ -40,7 +40,9 @@ declare namespace Password {
40
40
  password: string;
41
41
  }> {
42
42
  verifyCredentials(credentials: Credentials): Promise<Password.Authenticatable<Id> | null>;
43
- createPasswordResetToken: (authenticatableId: Id) => Promise<string>;
43
+ createPasswordResetToken: (authenticatableId: Id, options: {
44
+ expirationMinutes: number;
45
+ }) => Promise<string>;
44
46
  resetPassword: (options: {
45
47
  authenticatableId: Id;
46
48
  token: string;
@@ -76,8 +78,6 @@ declare namespace Password {
76
78
  getBySelector(selector: string): Promise<Password.ResetTokenRecord<Id> | null>;
77
79
  getByAuthenticatableId(authenticatableId: Id): Promise<Password.ResetTokenRecord<Id> | null>;
78
80
  deleteByAuthenticatableId(authenticatableId: Id): Promise<void>;
79
- /** Token lifetime in minutes. Default: 60 */
80
- tokenExpirationMinutes?: number;
81
81
  /** Minimum seconds between createToken calls for the same authenticatable. Default: 60 */
82
82
  throttleSeconds?: number;
83
83
  }
package/dist/index.js CHANGED
@@ -24,7 +24,7 @@ function create(config) {
24
24
  }
25
25
  return { id: authenticatable.id, credentialsInvalidBefore: authenticatable.credentialsInvalidBefore };
26
26
  }
27
- async function createPasswordResetToken(authenticatableId) {
27
+ async function createPasswordResetToken(authenticatableId, options) {
28
28
  if (!passwordResetOptions) {
29
29
  throw new Error("Password reset is not configured. Provide `passwordResetOptions` when creating the password service.");
30
30
  }
@@ -39,7 +39,7 @@ function create(config) {
39
39
  const verifier = crypto.randomBytes(32).toString("base64url");
40
40
  const verifierHash = await config.hash.hash(verifier);
41
41
  const now = instantFns.now();
42
- const expirationDate = instantFns.add(now, { minutes: passwordResetOptions.tokenExpirationMinutes ?? 60 });
42
+ const expirationDate = instantFns.add(now, { minutes: options.expirationMinutes });
43
43
  await passwordResetOptions.create({
44
44
  authenticatableId,
45
45
  selector,
package/package.json CHANGED
@@ -7,7 +7,7 @@
7
7
  "default": "./dist/index.js"
8
8
  }
9
9
  },
10
- "version": "1.0.0-alpha.16",
10
+ "version": "1.0.0-alpha.18",
11
11
  "publishConfig": {
12
12
  "access": "restricted"
13
13
  },
@@ -16,15 +16,15 @@
16
16
  ],
17
17
  "dependencies": {
18
18
  "iso-fns2": "npm:iso-fns@2.0.0-alpha.26",
19
- "@maestro-js/custom-errors": "1.0.0-alpha.16",
20
- "@maestro-js/service-registry": "1.0.0-alpha.16"
19
+ "@maestro-js/service-registry": "1.0.0-alpha.18",
20
+ "@maestro-js/custom-errors": "1.0.0-alpha.18"
21
21
  },
22
22
  "peerDependencies": {
23
- "@maestro-js/hash": "1.0.0-alpha.16"
23
+ "@maestro-js/hash": "1.0.0-alpha.18"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^22.19.11",
27
- "@maestro-js/hash": "1.0.0-alpha.16"
27
+ "@maestro-js/hash": "1.0.0-alpha.18"
28
28
  },
29
29
  "license": "UNLICENSED",
30
30
  "engines": {