@molecule/api-password 1.0.3 → 1.0.4

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/README.md CHANGED
@@ -3,19 +3,19 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-16T00:31:40.302Z
6
+ Generated: 2026-11-11T21:01:05.442Z
7
7
  -->
8
8
 
9
9
  # @molecule/api-password
10
10
 
11
- > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
12
- > It is written to be read by coding agents as much as by people, and is generated from this
13
- > package's source — edit `src/index.ts` JSDoc, not this file.
14
-
15
11
  Password hashing interface for molecule.dev.
16
12
 
17
13
  Defines the standard interface for password hashing providers.
18
14
 
15
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
16
+ > It is written to be read by coding agents as much as by people, and is generated from this
17
+ > package's source — edit `src/index.ts` JSDoc, not this file.
18
+
19
19
  ## Quick Start
20
20
 
21
21
  ```ts
@@ -109,6 +109,9 @@ function hasProvider(): boolean
109
109
 
110
110
  Hashes a plain-text password using the bonded provider.
111
111
 
112
+ For user accounts you do not call this: `createAccount({ username, email, password }, { req, res })` from `@molecule/api-resource-user` validates, hashes and stores the password and
113
+ returns the signed-in session. Use `hash` for a secret of your own (an invite code, an API key).
114
+
112
115
  ```typescript
113
116
  function hash(password: string, saltRounds?: number): Promise<string>
114
117
  ```
@@ -122,6 +125,10 @@ function hash(password: string, saltRounds?: number): Promise<string>
122
125
 
123
126
  Compares a plain-text password against a stored hash using the bonded provider.
124
127
 
128
+ For user accounts you do not call this: `signIn({ email, password }, { req, res })` and
129
+ `checkPassword(userId, password)` from `@molecule/api-resource-user` read the stored hash and
130
+ compare for you, and take the same time whether or not the account exists.
131
+
125
132
  ```typescript
126
133
  function compare(password: string, passwordHash: string): Promise<boolean>
127
134
  ```
@@ -30,6 +30,9 @@ export declare const hasProvider: () => boolean;
30
30
  /**
31
31
  * Hashes a plain-text password using the bonded provider.
32
32
  *
33
+ * For user accounts you do not call this: `createAccount({ username, email, password }, { req, res })` from `@molecule/api-resource-user` validates, hashes and stores the password and
34
+ * returns the signed-in session. Use `hash` for a secret of your own (an invite code, an API key).
35
+ *
33
36
  * @param password - The plain-text password to hash.
34
37
  * The env-derived default is clamped to a sane bcrypt-cost range of 10–16
35
38
  * (mirroring `@molecule/api-password-bcrypt`'s own default): the cost factor
@@ -47,6 +50,10 @@ export declare const hash: (password: string, saltRounds?: number) => Promise<st
47
50
  /**
48
51
  * Compares a plain-text password against a stored hash using the bonded provider.
49
52
  *
53
+ * For user accounts you do not call this: `signIn({ email, password }, { req, res })` and
54
+ * `checkPassword(userId, password)` from `@molecule/api-resource-user` read the stored hash and
55
+ * compare for you, and take the same time whether or not the account exists.
56
+ *
50
57
  * @param password - The plain-text password to check.
51
58
  * @param passwordHash - The stored hash to compare against.
52
59
  * @returns `true` if the password matches the hash.
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAKlD;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,gBAAgB,KAAG,IAExD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,QAAO,gBAE9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAAO,OAE9B,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,IAAI,GACf,UAAU,MAAM,EAChB,aAAY,MAA0E,KACrF,OAAO,CAAC,MAAM,CAEhB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,UAAU,MAAM,EAAE,cAAc,MAAM,KAAG,OAAO,CAAC,OAAO,CAE/E,CAAA"}
1
+ {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAKlD;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,UAAU,gBAAgB,KAAG,IAExD,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,QAAO,gBAE9B,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,WAAW,QAAO,OAE9B,CAAA;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,IAAI,GACf,UAAU,MAAM,EAChB,aAAY,MAA0E,KACrF,OAAO,CAAC,MAAM,CAEhB,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,OAAO,GAAI,UAAU,MAAM,EAAE,cAAc,MAAM,KAAG,OAAO,CAAC,OAAO,CAE/E,CAAA"}
package/dist/provider.js CHANGED
@@ -38,6 +38,9 @@ export const hasProvider = () => {
38
38
  /**
39
39
  * Hashes a plain-text password using the bonded provider.
40
40
  *
41
+ * For user accounts you do not call this: `createAccount({ username, email, password }, { req, res })` from `@molecule/api-resource-user` validates, hashes and stores the password and
42
+ * returns the signed-in session. Use `hash` for a secret of your own (an invite code, an API key).
43
+ *
41
44
  * @param password - The plain-text password to hash.
42
45
  * The env-derived default is clamped to a sane bcrypt-cost range of 10–16
43
46
  * (mirroring `@molecule/api-password-bcrypt`'s own default): the cost factor
@@ -57,6 +60,10 @@ export const hash = (password, saltRounds = Math.min(Math.max(Number(process.env
57
60
  /**
58
61
  * Compares a plain-text password against a stored hash using the bonded provider.
59
62
  *
63
+ * For user accounts you do not call this: `signIn({ email, password }, { req, res })` and
64
+ * `checkPassword(userId, password)` from `@molecule/api-resource-user` read the stored hash and
65
+ * compare for you, and take the same time whether or not the account exists.
66
+ *
60
67
  * @param password - The plain-text password to check.
61
68
  * @param passwordHash - The stored hash to compare against.
62
69
  * @returns `true` if the password matches the hash.
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAIvF,MAAM,SAAS,GAAG,UAAU,CAAA;AAC5B,UAAU,CAAC,SAAS,CAAC,CAAA;AAErB;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAA0B,EAAQ,EAAE;IAC9D,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAA;AAC3B,CAAC,CAAA;AAED;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAqB,EAAE;IAChD,OAAO,WAAW,CAAmB,SAAS,CAAC,CAAA;AACjD,CAAC,CAAA;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,GAAY,EAAE;IACvC,OAAO,QAAQ,CAAC,SAAS,CAAC,CAAA;AAC5B,CAAC,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAClB,QAAgB,EAChB,aAAqB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,EACrE,EAAE;IACnB,OAAO,WAAW,EAAE,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAA;AACjD,CAAC,CAAA;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,QAAgB,EAAE,YAAoB,EAAoB,EAAE;IAClF,OAAO,WAAW,EAAE,CAAC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AACtD,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/api-password",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Password hashing interface for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -32,10 +32,10 @@
32
32
  "@molecule/api-i18n": "^1.0.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@molecule/api-bond": "1.0.2",
36
- "@molecule/api-i18n": "1.0.3",
35
+ "@molecule/api-bond": "1.0.4",
36
+ "@molecule/api-i18n": "1.0.5",
37
37
  "typescript": "6.0.3",
38
- "vitest": "4.1.11"
38
+ "vitest": "4.1.12"
39
39
  },
40
40
  "repository": {
41
41
  "type": "git",