@kingironman2011/better-auth-bsky 0.2.2 → 0.2.3

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/server.js CHANGED
@@ -1,2 +1,2 @@
1
- import { n as atprotoPlaceholderEmail, r as fetchAtprotoProfilePublic, t as atproto } from "./server-Be4Cn16D.js";
1
+ import { n as atprotoPlaceholderEmail, r as fetchAtprotoProfilePublic, t as atproto } from "./server-B4daPb_Y.js";
2
2
  export { atproto, atprotoPlaceholderEmail, fetchAtprotoProfilePublic };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kingironman2011/better-auth-bsky",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "A better-auth plugin that adds ATProto/Bluesky OAuth 2.1 authentication (DPoP, PAR, PKCE) via @atcute/oauth-node-client.",
5
5
  "keywords": [
6
6
  "atproto",
package/src/stores.ts CHANGED
@@ -100,13 +100,15 @@ export class DbStateStore implements StateStore {
100
100
  async get(stateKey: string): Promise<StoredState | undefined> {
101
101
  const row = await this.adapter.findOne<{
102
102
  stateData: string;
103
- expiresAt: number;
103
+ expiresAt: Date | number;
104
104
  }>({
105
105
  model: "atprotoState",
106
106
  where: [{ field: "stateKey", value: stateKey }],
107
107
  });
108
108
  if (!row) return undefined;
109
- if (row.expiresAt < Date.now()) {
109
+ const expiresAtMs =
110
+ row.expiresAt instanceof Date ? row.expiresAt.getTime() : row.expiresAt;
111
+ if (expiresAtMs < Date.now()) {
110
112
  // Expired — clean it up
111
113
  await this.delete(stateKey);
112
114
  return undefined;
@@ -122,7 +124,7 @@ export class DbStateStore implements StateStore {
122
124
  data: {
123
125
  stateKey,
124
126
  stateData: data,
125
- expiresAt: state.expiresAt,
127
+ expiresAt: new Date(state.expiresAt),
126
128
  },
127
129
  });
128
130
  }