@stacksjs/auth 0.74.3 → 0.74.5

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/client.js CHANGED
@@ -1 +1 @@
1
- import{randomBytes}from"node:crypto";import{db}from"@stacksjs/database";import{formatDate}from"@stacksjs/orm";import{err,HttpError,ok}from"@stacksjs/error-handling";import{makeHash}from"@stacksjs/security";export async function createPersonalAccessClient(){if((await db.selectFrom("oauth_clients").where("personal_access_client","=",!0).where("revoked","=",!1).select(["id"]).executeTakeFirst())?.id)return err({code:"already-exists",message:"A personal access client already exists. Revoke the existing client (`./buddy auth:revoke-client`) before creating a new one."});const secret=randomBytes(40).toString("hex"),hashedSecret=await makeHash(secret,{algorithm:"bcrypt"});await db.insertInto("oauth_clients").values({name:"Personal Access Client",secret:hashedSecret,provider:"local",redirect:"http://localhost",personal_access_client:!0,password_client:!1,revoked:!1,created_at:formatDate(new Date)}).execute();if(!(await db.selectFrom("oauth_clients").where("secret","=",hashedSecret).select(["id"]).executeTakeFirst())?.id)throw new HttpError(500,"Failed to create personal access client");return ok(secret)}
1
+ import{randomBytes}from"node:crypto";import{db}from"@stacksjs/database";import{formatDate}from"@stacksjs/orm";import{err,HttpError,ok}from"@stacksjs/error-handling";import{makeHash}from"@stacksjs/security";export async function createPersonalAccessClient(){if((await db.selectFrom("oauth_clients").where("personal_access_client","=",!0).where("revoked","=",!1).select(["id"]).executeTakeFirst())?.id)return err({code:"already-exists",message:"A personal access client already exists. There is no CLI command to revoke one yet - delete its row from `oauth_clients` (or use the existing client) before creating another."});const secret=randomBytes(40).toString("hex"),hashedSecret=await makeHash(secret,{algorithm:"bcrypt"});await db.insertInto("oauth_clients").values({name:"Personal Access Client",secret:hashedSecret,provider:"local",redirect:"http://localhost",personal_access_client:!0,password_client:!1,revoked:!1,created_at:formatDate(new Date)}).execute();if(!(await db.selectFrom("oauth_clients").where("secret","=",hashedSecret).select(["id"]).executeTakeFirst())?.id)throw new HttpError(500,"Failed to create personal access client");return ok(secret)}
package/dist/passkey.d.ts CHANGED
@@ -40,7 +40,7 @@ export declare function getUserPasskey(userId: number, passkeyId: string): Promi
40
40
  * stacksjs/stacks#1861 A-4.
41
41
  */
42
42
  export declare function updatePasskeyCounter(userId: number, passkeyId: string, newCounter: number): Promise<boolean>;
43
- export declare function setCurrentRegistrationOptions(user: UserModel, verified: VerifiedRegistrationResponse): Promise<void>;
43
+ export declare function setCurrentRegistrationOptions(verified: VerifiedRegistrationResponse): Promise<void>;
44
44
  /**
45
45
  * Persist a server-issued WebAuthn challenge for the given user +
46
46
  * purpose. Deletes any prior challenge for the same (user, purpose)
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@stacksjs/auth",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "0.74.3",
5
+ "version": "0.74.5",
6
6
  "description": "A more simplistic way to authenticate.",
7
7
  "author": "Chris Breuer",
8
8
  "contributors": [
@@ -58,18 +58,18 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@stacksjs/bun-router": "^0.1.8",
61
- "@stacksjs/cache": "0.74.3",
62
- "@stacksjs/config": "0.74.3",
63
- "@stacksjs/database": "0.74.3",
64
- "@stacksjs/email": "0.74.3",
65
- "@stacksjs/env": "0.74.3",
66
- "@stacksjs/error-handling": "0.74.3",
67
- "@stacksjs/logging": "0.74.3",
68
- "@stacksjs/orm": "0.74.3",
69
- "@stacksjs/path": "0.74.3",
70
- "@stacksjs/router": "0.74.3",
71
- "@stacksjs/security": "0.74.3",
72
- "@stacksjs/storage": "0.74.3",
61
+ "@stacksjs/cache": "0.74.5",
62
+ "@stacksjs/config": "0.74.5",
63
+ "@stacksjs/database": "0.74.5",
64
+ "@stacksjs/email": "0.74.5",
65
+ "@stacksjs/env": "0.74.5",
66
+ "@stacksjs/error-handling": "0.74.5",
67
+ "@stacksjs/logging": "0.74.5",
68
+ "@stacksjs/orm": "0.74.5",
69
+ "@stacksjs/path": "0.74.5",
70
+ "@stacksjs/router": "0.74.5",
71
+ "@stacksjs/security": "0.74.5",
72
+ "@stacksjs/storage": "0.74.5",
73
73
  "@stacksjs/ts-auth": "^0.4.4",
74
74
  "ts-qr-codes": "^0.1.8"
75
75
  },