@contentgrowth/content-auth 0.0.4 → 0.1.0

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.
@@ -4,7 +4,7 @@ import {
4
4
  createAuth,
5
5
  createAuthApp,
6
6
  schema_exports
7
- } from "../chunk-OOXZHG4Y.js";
7
+ } from "../chunk-HPPCUGKY.js";
8
8
  import "../chunk-R5U7XKVJ.js";
9
9
  export {
10
10
  Hono,
@@ -115,8 +115,21 @@ async function hashPassword(password) {
115
115
  const hashB64 = btoa(String.fromCharCode(...new Uint8Array(hashBuffer)));
116
116
  return `pbkdf2:100000:${saltB64}:${hashB64}`;
117
117
  }
118
- async function verifyPassword(password, storedHash) {
119
- const parts = storedHash.split(":");
118
+ async function verifyPassword(passwordOrData, storedHash) {
119
+ let password;
120
+ let hash;
121
+ if (typeof passwordOrData === "object" && passwordOrData !== null) {
122
+ password = passwordOrData.password;
123
+ hash = passwordOrData.hash;
124
+ } else {
125
+ password = passwordOrData;
126
+ hash = storedHash;
127
+ }
128
+ if (!hash) {
129
+ console.error("[Auth] verifyPassword called with empty/undefined hash");
130
+ return false;
131
+ }
132
+ const parts = hash.split(":");
120
133
  if (parts.length !== 4) return false;
121
134
  const [alg, iterationsStr, saltB64, hashB64] = parts;
122
135
  if (alg !== "pbkdf2") return false;
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  createAuth,
5
5
  createAuthApp,
6
6
  schema_exports
7
- } from "./chunk-OOXZHG4Y.js";
7
+ } from "./chunk-HPPCUGKY.js";
8
8
  import {
9
9
  AuthForm,
10
10
  CreateOrganizationForm,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentgrowth/content-auth",
3
- "version": "0.0.4",
3
+ "version": "0.1.0",
4
4
  "description": "Better Auth wrapper with UI components for Cloudflare Workers & Pages",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",