@cfast/auth 0.2.0 → 0.2.2
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/LICENSE +21 -0
- package/dist/schema.d.ts +22 -3
- package/dist/schema.js +4 -3
- package/llms.txt +5 -0
- package/package.json +10 -10
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Daniel Schmidt
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/schema.d.ts
CHANGED
|
@@ -732,7 +732,7 @@ declare const passkeys: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
732
732
|
}, {}, {
|
|
733
733
|
length: number | undefined;
|
|
734
734
|
}>;
|
|
735
|
-
|
|
735
|
+
credentialID: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
736
736
|
name: "credential_id";
|
|
737
737
|
tableName: "passkeys";
|
|
738
738
|
dataType: "string";
|
|
@@ -775,7 +775,7 @@ declare const passkeys: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
775
775
|
columnType: "SQLiteText";
|
|
776
776
|
data: string;
|
|
777
777
|
driverParam: string;
|
|
778
|
-
notNull:
|
|
778
|
+
notNull: true;
|
|
779
779
|
hasDefault: false;
|
|
780
780
|
isPrimaryKey: false;
|
|
781
781
|
isAutoincrement: false;
|
|
@@ -794,7 +794,7 @@ declare const passkeys: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
794
794
|
columnType: "SQLiteBoolean";
|
|
795
795
|
data: boolean;
|
|
796
796
|
driverParam: number;
|
|
797
|
-
notNull:
|
|
797
|
+
notNull: true;
|
|
798
798
|
hasDefault: true;
|
|
799
799
|
isPrimaryKey: false;
|
|
800
800
|
isAutoincrement: false;
|
|
@@ -823,6 +823,25 @@ declare const passkeys: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
823
823
|
}, {}, {
|
|
824
824
|
length: number | undefined;
|
|
825
825
|
}>;
|
|
826
|
+
aaguid: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
827
|
+
name: "aaguid";
|
|
828
|
+
tableName: "passkeys";
|
|
829
|
+
dataType: "string";
|
|
830
|
+
columnType: "SQLiteText";
|
|
831
|
+
data: string;
|
|
832
|
+
driverParam: string;
|
|
833
|
+
notNull: false;
|
|
834
|
+
hasDefault: false;
|
|
835
|
+
isPrimaryKey: false;
|
|
836
|
+
isAutoincrement: false;
|
|
837
|
+
hasRuntimeDefault: false;
|
|
838
|
+
enumValues: [string, ...string[]];
|
|
839
|
+
baseColumn: never;
|
|
840
|
+
identity: undefined;
|
|
841
|
+
generated: undefined;
|
|
842
|
+
}, {}, {
|
|
843
|
+
length: number | undefined;
|
|
844
|
+
}>;
|
|
826
845
|
createdAt: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
827
846
|
name: "created_at";
|
|
828
847
|
tableName: "passkeys";
|
package/dist/schema.js
CHANGED
|
@@ -51,11 +51,12 @@ var passkeys = sqliteTable("passkeys", {
|
|
|
51
51
|
name: text("name"),
|
|
52
52
|
userId: text("user_id").notNull().references(() => users.id, { onDelete: "cascade" }),
|
|
53
53
|
publicKey: text("public_key").notNull(),
|
|
54
|
-
|
|
54
|
+
credentialID: text("credential_id").notNull().unique(),
|
|
55
55
|
counter: integer("counter").notNull().default(0),
|
|
56
|
-
deviceType: text("device_type"),
|
|
57
|
-
backedUp: integer("backed_up", { mode: "boolean" }).default(false),
|
|
56
|
+
deviceType: text("device_type").notNull(),
|
|
57
|
+
backedUp: integer("backed_up", { mode: "boolean" }).notNull().default(false),
|
|
58
58
|
transports: text("transports"),
|
|
59
|
+
aaguid: text("aaguid"),
|
|
59
60
|
createdAt: integer("created_at", { mode: "timestamp" }).$defaultFn(
|
|
60
61
|
() => /* @__PURE__ */ new Date()
|
|
61
62
|
)
|
package/llms.txt
CHANGED
|
@@ -214,3 +214,8 @@ await auth.removeRole(userId, "editor");
|
|
|
214
214
|
- **Forgetting to add auth routes** -- The magic link callback and passkey endpoints need `authRoutes()` in your `routes.ts`.
|
|
215
215
|
- **Using `unsafe()` instead of roles for admin** -- Admins should have a proper role with grants, not bypass permissions entirely.
|
|
216
216
|
- **Not wrapping the app with `AuthClientProvider`** -- `useAuth()` and `LoginPage` require the provider at the app root.
|
|
217
|
+
|
|
218
|
+
## See Also
|
|
219
|
+
|
|
220
|
+
- `@cfast/permissions` -- Defines roles and grants resolved from the authenticated user.
|
|
221
|
+
- `@cfast/db` -- Receives `grants` from auth to enforce permissions on queries.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cfast/auth",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Authentication for Cloudflare Workers: magic email, passkeys, roles, and impersonation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cfast",
|
|
@@ -44,13 +44,6 @@
|
|
|
44
44
|
"publishConfig": {
|
|
45
45
|
"access": "public"
|
|
46
46
|
},
|
|
47
|
-
"scripts": {
|
|
48
|
-
"build": "tsup src/index.ts src/client.ts src/plugin.ts src/schema.ts --format esm --dts",
|
|
49
|
-
"dev": "tsup src/index.ts src/client.ts src/plugin.ts src/schema.ts --format esm --dts --watch",
|
|
50
|
-
"test": "vitest run",
|
|
51
|
-
"typecheck": "tsc --noEmit",
|
|
52
|
-
"lint": "eslint src/"
|
|
53
|
-
},
|
|
54
47
|
"peerDependencies": {
|
|
55
48
|
"@better-auth/passkey": ">=1",
|
|
56
49
|
"better-auth": ">=1",
|
|
@@ -58,7 +51,7 @@
|
|
|
58
51
|
"react": ">=18"
|
|
59
52
|
},
|
|
60
53
|
"dependencies": {
|
|
61
|
-
"@cfast/permissions": "
|
|
54
|
+
"@cfast/permissions": "0.1.0"
|
|
62
55
|
},
|
|
63
56
|
"devDependencies": {
|
|
64
57
|
"@cloudflare/workers-types": "^4.20260305.1",
|
|
@@ -71,5 +64,12 @@
|
|
|
71
64
|
"tsup": "^8",
|
|
72
65
|
"typescript": "^5.7",
|
|
73
66
|
"vitest": "^4.1.0"
|
|
67
|
+
},
|
|
68
|
+
"scripts": {
|
|
69
|
+
"build": "tsup src/index.ts src/client.ts src/plugin.ts src/schema.ts --format esm --dts",
|
|
70
|
+
"dev": "tsup src/index.ts src/client.ts src/plugin.ts src/schema.ts --format esm --dts --watch",
|
|
71
|
+
"test": "vitest run",
|
|
72
|
+
"typecheck": "tsc --noEmit",
|
|
73
|
+
"lint": "eslint src/"
|
|
74
74
|
}
|
|
75
|
-
}
|
|
75
|
+
}
|