Skip to content

Commit 11907aa

Browse files
manovotnyclaude
andauthored
fix(backend): correct salted password digests and accept every documented hasher (#10504)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 5e6101b commit 11907aa

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/backend': patch
3+
---
4+
5+
Add `bcrypt_peppered`, `md5_salted`, `pbkdf2_sha512`, `pbkdf2_sha512_hex`, `sha256_salted`, and `sha512_symfony` to the `PasswordHasher` type, so TypeScript accepts every hasher the `createUser()` JSDoc documents. The JSDoc for `md5_salted` and `sha256_salted` now also shows the `password_digest` format the Backend API accepts: `hash$salt`, not `salt$hash`.

‎packages/backend/src/api/endpoints/UserApi.ts‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,21 @@ export type PasswordHasher =
101101
| 'argon2id'
102102
| 'awscognito'
103103
| 'bcrypt'
104+
| 'bcrypt_peppered'
104105
| 'bcrypt_sha256_django'
105106
| 'md5'
107+
| 'md5_salted'
106108
| 'pbkdf2_sha256'
107109
| 'pbkdf2_sha256_django'
108110
| 'pbkdf2_sha1'
111+
| 'pbkdf2_sha512'
112+
| 'pbkdf2_sha512_hex'
109113
| 'phpass'
110114
| 'scrypt_firebase'
111115
| 'scrypt_werkzeug'
112116
| 'sha256'
117+
| 'sha256_salted'
118+
| 'sha512_symfony'
113119
| 'md5_phpass'
114120
| 'ldap_ssha';
115121

@@ -145,9 +151,9 @@ export type UserPasswordHashingParams = {
145151
* </ul>
146152
* <li> [`md5_salted` (insecure)](https://en.wikipedia.org/wiki/MD5) </li>
147153
* <ul>
148-
* <li> When set, `password_digest` must be in the format of `salt$hash`. </li>
149-
* <li> _salt:_ The salt used to generate the above hash. </li>
154+
* <li> When set, `password_digest` must be in the format of `hash$salt`. </li>
150155
* <li> _hash:_ A 32-length hex string. </li>
156+
* <li> _salt:_ The salt used to generate the above hash. </li>
151157
* </ul>
152158
* <li> [`pbkdf2_sha1`](https://en.wikipedia.org/wiki/PBKDF2) </li>
153159
* <ul>
@@ -205,9 +211,9 @@ export type UserPasswordHashingParams = {
205211
* </ul>
206212
* <li> [`sha256_salted` (insecure)](https://en.wikipedia.org/wiki/SHA-2) </li>
207213
* <ul>
208-
* <li> When set, `password_digest` must be in the format of `salt$hash`. </li>
209-
* <li> _salt:_ The salt used to generate the above hash. </li>
214+
* <li> When set, `password_digest` must be in the format of `hash$salt`. </li>
210215
* <li> _hash:_ A 64-length hex string. </li>
216+
* <li> _salt:_ The salt used to generate the above hash. </li>
211217
* </ul>
212218
* <li> [`argon2`](https://argon2.online/) variants: `argon2i` and `argon2id`. </li>
213219
* <ul>

0 commit comments

Comments
 (0)