@parlor/auth 0.0.0-stage → 0.2.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.
Files changed (83) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +25 -2
  3. package/dist/account.d.ts +59 -0
  4. package/dist/account.d.ts.map +1 -0
  5. package/dist/account.js +127 -0
  6. package/dist/account.js.map +1 -0
  7. package/dist/audit.d.ts +10 -0
  8. package/dist/audit.d.ts.map +1 -0
  9. package/dist/audit.js +130 -0
  10. package/dist/audit.js.map +1 -0
  11. package/dist/better-auth.d.ts +46 -0
  12. package/dist/better-auth.d.ts.map +1 -0
  13. package/dist/better-auth.js +120 -0
  14. package/dist/better-auth.js.map +1 -0
  15. package/dist/client/index.d.ts +79 -0
  16. package/dist/client/index.d.ts.map +1 -0
  17. package/dist/client/index.js +554 -0
  18. package/dist/client/index.js.map +1 -0
  19. package/dist/database.d.ts +7 -0
  20. package/dist/database.d.ts.map +1 -0
  21. package/dist/database.js +11 -0
  22. package/dist/database.js.map +1 -0
  23. package/dist/devices.d.ts +157 -0
  24. package/dist/devices.d.ts.map +1 -0
  25. package/dist/devices.js +403 -0
  26. package/dist/devices.js.map +1 -0
  27. package/dist/es256.d.ts +4 -0
  28. package/dist/es256.d.ts.map +1 -0
  29. package/dist/es256.js +44 -0
  30. package/dist/es256.js.map +1 -0
  31. package/dist/grants.d.ts +4 -0
  32. package/dist/grants.d.ts.map +1 -0
  33. package/dist/grants.js +6 -0
  34. package/dist/grants.js.map +1 -0
  35. package/dist/hosts.d.ts +116 -0
  36. package/dist/hosts.d.ts.map +1 -0
  37. package/dist/hosts.js +538 -0
  38. package/dist/hosts.js.map +1 -0
  39. package/dist/index.d.ts +9 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +9 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/migrations.d.ts +3 -0
  44. package/dist/migrations.d.ts.map +1 -0
  45. package/dist/migrations.js +17 -0
  46. package/dist/migrations.js.map +1 -0
  47. package/dist/native-sign-in.d.ts +45 -0
  48. package/dist/native-sign-in.d.ts.map +1 -0
  49. package/dist/native-sign-in.js +183 -0
  50. package/dist/native-sign-in.js.map +1 -0
  51. package/dist/pages.d.ts +4 -0
  52. package/dist/pages.d.ts.map +1 -0
  53. package/dist/pages.js +53 -0
  54. package/dist/pages.js.map +1 -0
  55. package/dist/provider.d.ts +81 -0
  56. package/dist/provider.d.ts.map +1 -0
  57. package/dist/provider.js +301 -0
  58. package/dist/provider.js.map +1 -0
  59. package/dist/revocation.d.ts +51 -0
  60. package/dist/revocation.d.ts.map +1 -0
  61. package/dist/revocation.js +233 -0
  62. package/dist/revocation.js.map +1 -0
  63. package/dist/routes.d.ts +15 -0
  64. package/dist/routes.d.ts.map +1 -0
  65. package/dist/routes.js +116 -0
  66. package/dist/routes.js.map +1 -0
  67. package/dist/schema.d.ts +2970 -0
  68. package/dist/schema.d.ts.map +1 -0
  69. package/dist/schema.js +308 -0
  70. package/dist/schema.js.map +1 -0
  71. package/dist/statements.d.ts +92 -0
  72. package/dist/statements.d.ts.map +1 -0
  73. package/dist/statements.js +199 -0
  74. package/dist/statements.js.map +1 -0
  75. package/dist/tokens.d.ts +69 -0
  76. package/dist/tokens.d.ts.map +1 -0
  77. package/dist/tokens.js +134 -0
  78. package/dist/tokens.js.map +1 -0
  79. package/dist/turn-keys.d.ts +16 -0
  80. package/dist/turn-keys.d.ts.map +1 -0
  81. package/dist/turn-keys.js +108 -0
  82. package/dist/turn-keys.js.map +1 -0
  83. package/package.json +57 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;E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,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAG/B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;EAOvB,CAAC;AAEJ,eAAO,MAAM,gBAAgB;;;;EAO1B,CAAC;AAEJ,eAAO,MAAM,gBAAgB;;EAK1B,CAAC;AAEJ,eAAO,MAAM,oBAAoB;;;;;;EAS9B,CAAC;AAEJ,eAAO,MAAM,sBAAsB;;EAEhC,CAAC;AAEJ,eAAO,MAAM,4BAA4B;;;EAStC,CAAC;AAEJ,eAAO,MAAM,0BAA0B;;;;;EAiBtC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;EAiBnC,CAAC;AAEJ,eAAO,MAAM,qBAAqB;;;EAS/B,CAAC"}
package/dist/schema.js ADDED
@@ -0,0 +1,308 @@
1
+ // The Better Auth tables for parlorAuth() defaults, as `auth generate` writes them for better-auth 1.7.7.
2
+ // `schema.spec.ts` regenerates them and fails on any difference, so a Better Auth bump updates this file.
3
+ import { relations } from "drizzle-orm";
4
+ import { pgTable, text, timestamp, boolean, integer, jsonb, index, uniqueIndex, } from "drizzle-orm/pg-core";
5
+ export const user = pgTable("user", {
6
+ id: text("id").primaryKey(),
7
+ name: text("name").notNull(),
8
+ email: text("email").notNull().unique(),
9
+ emailVerified: boolean("email_verified").default(false).notNull(),
10
+ image: text("image"),
11
+ createdAt: timestamp("created_at").defaultNow().notNull(),
12
+ updatedAt: timestamp("updated_at")
13
+ .defaultNow()
14
+ .$onUpdate(() => /* @__PURE__ */ new Date())
15
+ .notNull(),
16
+ });
17
+ export const session = pgTable("session", {
18
+ id: text("id").primaryKey(),
19
+ expiresAt: timestamp("expires_at").notNull(),
20
+ token: text("token").notNull().unique(),
21
+ createdAt: timestamp("created_at").defaultNow().notNull(),
22
+ updatedAt: timestamp("updated_at")
23
+ .$onUpdate(() => /* @__PURE__ */ new Date())
24
+ .notNull(),
25
+ ipAddress: text("ip_address"),
26
+ userAgent: text("user_agent"),
27
+ userId: text("user_id")
28
+ .notNull()
29
+ .references(() => user.id, { onDelete: "cascade" }),
30
+ }, (table) => [index("session_userId_idx").on(table.userId)]);
31
+ export const account = pgTable("account", {
32
+ id: text("id").primaryKey(),
33
+ accountId: text("account_id").notNull(),
34
+ providerId: text("provider_id").notNull(),
35
+ userId: text("user_id")
36
+ .notNull()
37
+ .references(() => user.id, { onDelete: "cascade" }),
38
+ accessToken: text("access_token"),
39
+ refreshToken: text("refresh_token"),
40
+ idToken: text("id_token"),
41
+ accessTokenExpiresAt: timestamp("access_token_expires_at"),
42
+ refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
43
+ scope: text("scope"),
44
+ password: text("password"),
45
+ createdAt: timestamp("created_at").defaultNow().notNull(),
46
+ updatedAt: timestamp("updated_at")
47
+ .$onUpdate(() => /* @__PURE__ */ new Date())
48
+ .notNull(),
49
+ }, (table) => [index("account_userId_idx").on(table.userId)]);
50
+ export const verification = pgTable("verification", {
51
+ id: text("id").primaryKey(),
52
+ identifier: text("identifier").notNull(),
53
+ value: text("value").notNull(),
54
+ expiresAt: timestamp("expires_at").notNull(),
55
+ createdAt: timestamp("created_at").defaultNow().notNull(),
56
+ updatedAt: timestamp("updated_at")
57
+ .defaultNow()
58
+ .$onUpdate(() => /* @__PURE__ */ new Date())
59
+ .notNull(),
60
+ }, (table) => [index("verification_identifier_idx").on(table.identifier)]);
61
+ export const jwks = pgTable("jwks", {
62
+ id: text("id").primaryKey(),
63
+ publicKey: text("public_key").notNull(),
64
+ privateKey: text("private_key").notNull(),
65
+ createdAt: timestamp("created_at").notNull(),
66
+ expiresAt: timestamp("expires_at"),
67
+ alg: text("alg"),
68
+ crv: text("crv"),
69
+ });
70
+ export const oauthClient = pgTable("oauth_client", {
71
+ id: text("id").primaryKey(),
72
+ clientId: text("client_id").notNull().unique(),
73
+ clientSecret: text("client_secret"),
74
+ clientDiscoveryId: text("client_discovery_id"),
75
+ disabled: boolean("disabled").default(false),
76
+ skipConsent: boolean("skip_consent"),
77
+ enableEndSession: boolean("enable_end_session"),
78
+ subjectType: text("subject_type"),
79
+ scopes: text("scopes").array(),
80
+ clientCredentialsScopes: text("client_credentials_scopes").array().default([]),
81
+ userId: text("user_id").references(() => user.id, { onDelete: "cascade" }),
82
+ createdAt: timestamp("created_at"),
83
+ updatedAt: timestamp("updated_at"),
84
+ name: text("name"),
85
+ uri: text("uri"),
86
+ icon: text("icon"),
87
+ contacts: text("contacts").array(),
88
+ tos: text("tos"),
89
+ policy: text("policy"),
90
+ softwareId: text("software_id"),
91
+ softwareVersion: text("software_version"),
92
+ softwareStatement: text("software_statement"),
93
+ redirectUris: text("redirect_uris").array().notNull(),
94
+ postLogoutRedirectUris: text("post_logout_redirect_uris").array(),
95
+ backchannelLogoutUri: text("backchannel_logout_uri"),
96
+ backchannelLogoutSessionRequired: boolean("backchannel_logout_session_required"),
97
+ tokenEndpointAuthMethod: text("token_endpoint_auth_method"),
98
+ applicationType: text("application_type"),
99
+ jwks: text("jwks"),
100
+ jwksUri: text("jwks_uri"),
101
+ grantTypes: text("grant_types").array(),
102
+ responseTypes: text("response_types").array(),
103
+ requirePKCE: boolean("require_pkce"),
104
+ dpopBoundAccessTokens: boolean("dpop_bound_access_tokens").default(false),
105
+ referenceId: text("reference_id"),
106
+ metadata: jsonb("metadata"),
107
+ }, (table) => [index("oauthClient_userId_idx").on(table.userId)]);
108
+ export const oauthResource = pgTable("oauth_resource", {
109
+ id: text("id").primaryKey(),
110
+ identifier: text("identifier").notNull().unique(),
111
+ name: text("name").notNull(),
112
+ accessTokenTtl: integer("access_token_ttl"),
113
+ refreshTokenTtl: integer("refresh_token_ttl"),
114
+ signingAlgorithm: text("signing_algorithm"),
115
+ signingKeyId: text("signing_key_id"),
116
+ allowedScopes: text("allowed_scopes").array(),
117
+ customClaims: jsonb("custom_claims"),
118
+ dpopBoundAccessTokensRequired: boolean("dpop_bound_access_tokens_required").default(false),
119
+ disabled: boolean("disabled").default(false),
120
+ createdAt: timestamp("created_at"),
121
+ updatedAt: timestamp("updated_at"),
122
+ policyVersion: integer("policy_version").default(1),
123
+ metadata: jsonb("metadata"),
124
+ });
125
+ export const oauthClientResource = pgTable("oauth_client_resource", {
126
+ id: text("id").primaryKey(),
127
+ clientId: text("client_id")
128
+ .notNull()
129
+ .references(() => oauthClient.clientId, { onDelete: "cascade" }),
130
+ resourceId: text("resource_id")
131
+ .notNull()
132
+ .references(() => oauthResource.identifier, { onDelete: "cascade" }),
133
+ metadata: jsonb("metadata"),
134
+ createdAt: timestamp("created_at"),
135
+ }, (table) => [
136
+ uniqueIndex("oauthClientResource_clientId_resourceId_uidx").on(table.clientId, table.resourceId),
137
+ index("oauthClientResource_clientId_idx").on(table.clientId),
138
+ index("oauthClientResource_resourceId_idx").on(table.resourceId),
139
+ ]);
140
+ export const oauthRefreshToken = pgTable("oauth_refresh_token", {
141
+ id: text("id").primaryKey(),
142
+ token: text("token").notNull().unique(),
143
+ clientId: text("client_id")
144
+ .notNull()
145
+ .references(() => oauthClient.clientId, { onDelete: "cascade" }),
146
+ sessionId: text("session_id").references(() => session.id, {
147
+ onDelete: "set null",
148
+ }),
149
+ userId: text("user_id")
150
+ .notNull()
151
+ .references(() => user.id, { onDelete: "cascade" }),
152
+ referenceId: text("reference_id"),
153
+ authorizationCodeId: text("authorization_code_id"),
154
+ resources: text("resources").array(),
155
+ requestedUserInfoClaims: text("requested_user_info_claims").array(),
156
+ expiresAt: timestamp("expires_at").notNull(),
157
+ createdAt: timestamp("created_at").notNull(),
158
+ revoked: timestamp("revoked"),
159
+ rotatedAt: timestamp("rotated_at"),
160
+ rotationReplayResponse: text("rotation_replay_response"),
161
+ rotationReplayExpiresAt: timestamp("rotation_replay_expires_at"),
162
+ authTime: timestamp("auth_time"),
163
+ confirmation: jsonb("confirmation"),
164
+ scopes: text("scopes").array().notNull(),
165
+ }, (table) => [
166
+ index("oauthRefreshToken_clientId_idx").on(table.clientId),
167
+ index("oauthRefreshToken_sessionId_idx").on(table.sessionId),
168
+ index("oauthRefreshToken_userId_idx").on(table.userId),
169
+ index("oauthRefreshToken_authorizationCodeId_idx").on(table.authorizationCodeId),
170
+ ]);
171
+ export const oauthAccessToken = pgTable("oauth_access_token", {
172
+ id: text("id").primaryKey(),
173
+ token: text("token").notNull().unique(),
174
+ clientId: text("client_id")
175
+ .notNull()
176
+ .references(() => oauthClient.clientId, { onDelete: "cascade" }),
177
+ sessionId: text("session_id").references(() => session.id, {
178
+ onDelete: "set null",
179
+ }),
180
+ userId: text("user_id").references(() => user.id, { onDelete: "cascade" }),
181
+ referenceId: text("reference_id"),
182
+ authorizationCodeId: text("authorization_code_id"),
183
+ resources: text("resources").array(),
184
+ requestedUserInfoClaims: text("requested_user_info_claims").array(),
185
+ refreshId: text("refresh_id").references(() => oauthRefreshToken.id, {
186
+ onDelete: "cascade",
187
+ }),
188
+ expiresAt: timestamp("expires_at").notNull(),
189
+ createdAt: timestamp("created_at").notNull(),
190
+ revoked: timestamp("revoked"),
191
+ confirmation: jsonb("confirmation"),
192
+ scopes: text("scopes").array().notNull(),
193
+ }, (table) => [
194
+ index("oauthAccessToken_clientId_idx").on(table.clientId),
195
+ index("oauthAccessToken_sessionId_idx").on(table.sessionId),
196
+ index("oauthAccessToken_userId_idx").on(table.userId),
197
+ index("oauthAccessToken_authorizationCodeId_idx").on(table.authorizationCodeId),
198
+ index("oauthAccessToken_refreshId_idx").on(table.refreshId),
199
+ ]);
200
+ export const oauthConsent = pgTable("oauth_consent", {
201
+ id: text("id").primaryKey(),
202
+ clientId: text("client_id")
203
+ .notNull()
204
+ .references(() => oauthClient.clientId, { onDelete: "cascade" }),
205
+ userId: text("user_id").references(() => user.id, { onDelete: "cascade" }),
206
+ referenceId: text("reference_id"),
207
+ resources: text("resources").array(),
208
+ requestedUserInfoClaims: text("requested_user_info_claims").array(),
209
+ scopes: text("scopes").array().notNull(),
210
+ createdAt: timestamp("created_at").notNull(),
211
+ updatedAt: timestamp("updated_at").notNull(),
212
+ }, (table) => [
213
+ index("oauthConsent_clientId_idx").on(table.clientId),
214
+ index("oauthConsent_userId_idx").on(table.userId),
215
+ ]);
216
+ export const oauthClientAssertion = pgTable("oauth_client_assertion", {
217
+ id: text("id").primaryKey(),
218
+ expiresAt: timestamp("expires_at").notNull(),
219
+ });
220
+ export const userRelations = relations(user, ({ many }) => ({
221
+ sessions: many(session),
222
+ accounts: many(account),
223
+ oauthClients: many(oauthClient),
224
+ oauthRefreshTokens: many(oauthRefreshToken),
225
+ oauthAccessTokens: many(oauthAccessToken),
226
+ oauthConsents: many(oauthConsent),
227
+ }));
228
+ export const sessionRelations = relations(session, ({ one, many }) => ({
229
+ user: one(user, {
230
+ fields: [session.userId],
231
+ references: [user.id],
232
+ }),
233
+ oauthRefreshTokens: many(oauthRefreshToken),
234
+ oauthAccessTokens: many(oauthAccessToken),
235
+ }));
236
+ export const accountRelations = relations(account, ({ one }) => ({
237
+ user: one(user, {
238
+ fields: [account.userId],
239
+ references: [user.id],
240
+ }),
241
+ }));
242
+ export const oauthClientRelations = relations(oauthClient, ({ one, many }) => ({
243
+ user: one(user, {
244
+ fields: [oauthClient.userId],
245
+ references: [user.id],
246
+ }),
247
+ oauthClientResources: many(oauthClientResource),
248
+ oauthRefreshTokens: many(oauthRefreshToken),
249
+ oauthAccessTokens: many(oauthAccessToken),
250
+ oauthConsents: many(oauthConsent),
251
+ }));
252
+ export const oauthResourceRelations = relations(oauthResource, ({ many }) => ({
253
+ oauthClientResources: many(oauthClientResource),
254
+ }));
255
+ export const oauthClientResourceRelations = relations(oauthClientResource, ({ one }) => ({
256
+ oauthClient: one(oauthClient, {
257
+ fields: [oauthClientResource.clientId],
258
+ references: [oauthClient.clientId],
259
+ }),
260
+ oauthResource: one(oauthResource, {
261
+ fields: [oauthClientResource.resourceId],
262
+ references: [oauthResource.identifier],
263
+ }),
264
+ }));
265
+ export const oauthRefreshTokenRelations = relations(oauthRefreshToken, ({ one, many }) => ({
266
+ oauthClient: one(oauthClient, {
267
+ fields: [oauthRefreshToken.clientId],
268
+ references: [oauthClient.clientId],
269
+ }),
270
+ session: one(session, {
271
+ fields: [oauthRefreshToken.sessionId],
272
+ references: [session.id],
273
+ }),
274
+ user: one(user, {
275
+ fields: [oauthRefreshToken.userId],
276
+ references: [user.id],
277
+ }),
278
+ oauthAccessTokens: many(oauthAccessToken),
279
+ }));
280
+ export const oauthAccessTokenRelations = relations(oauthAccessToken, ({ one }) => ({
281
+ oauthClient: one(oauthClient, {
282
+ fields: [oauthAccessToken.clientId],
283
+ references: [oauthClient.clientId],
284
+ }),
285
+ session: one(session, {
286
+ fields: [oauthAccessToken.sessionId],
287
+ references: [session.id],
288
+ }),
289
+ user: one(user, {
290
+ fields: [oauthAccessToken.userId],
291
+ references: [user.id],
292
+ }),
293
+ oauthRefreshToken: one(oauthRefreshToken, {
294
+ fields: [oauthAccessToken.refreshId],
295
+ references: [oauthRefreshToken.id],
296
+ }),
297
+ }));
298
+ export const oauthConsentRelations = relations(oauthConsent, ({ one }) => ({
299
+ oauthClient: one(oauthClient, {
300
+ fields: [oauthConsent.clientId],
301
+ references: [oauthClient.clientId],
302
+ }),
303
+ user: one(user, {
304
+ fields: [oauthConsent.userId],
305
+ references: [user.id],
306
+ }),
307
+ }));
308
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../src/schema.ts"],"names":[],"mappings":"AAAA,0GAA0G;AAC1G,0GAA0G;AAC1G,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,OAAO,EACP,IAAI,EACJ,SAAS,EACT,OAAO,EACP,OAAO,EACP,KAAK,EACL,KAAK,EACL,WAAW,GACZ,MAAM,qBAAqB,CAAC;AAE7B,MAAM,CAAC,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,EAAE;IAClC,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,IAAI,EAAE,IAAI,CAAC,M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AAU,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;KACtB,CAAC;CACH,CAAC,CAAC,CAAC","sourcesContent":["// The Better Auth tables for parlorAuth() defaults, as `auth generate` writes them for better-auth 1.7.7.\n// `schema.spec.ts` regenerates them and fails on any difference, so a Better Auth bump updates this file.\nimport { relations } from \"drizzle-orm\";\nimport {\n pgTable,\n text,\n timestamp,\n boolean,\n integer,\n jsonb,\n index,\n uniqueIndex,\n} from \"drizzle-orm/pg-core\";\n\nexport const user = pgTable(\"user\", {\n id: text(\"id\").primaryKey(),\n name: text(\"name\").notNull(),\n email: text(\"email\").notNull().unique(),\n emailVerified: boolean(\"email_verified\").default(false).notNull(),\n image: text(\"image\"),\n createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n updatedAt: timestamp(\"updated_at\")\n .defaultNow()\n .$onUpdate(() => /* @__PURE__ */ new Date())\n .notNull(),\n});\n\nexport const session = pgTable(\n \"session\",\n {\n id: text(\"id\").primaryKey(),\n expiresAt: timestamp(\"expires_at\").notNull(),\n token: text(\"token\").notNull().unique(),\n createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n updatedAt: timestamp(\"updated_at\")\n .$onUpdate(() => /* @__PURE__ */ new Date())\n .notNull(),\n ipAddress: text(\"ip_address\"),\n userAgent: text(\"user_agent\"),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n },\n (table) => [index(\"session_userId_idx\").on(table.userId)],\n);\n\nexport const account = pgTable(\n \"account\",\n {\n id: text(\"id\").primaryKey(),\n accountId: text(\"account_id\").notNull(),\n providerId: text(\"provider_id\").notNull(),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n accessToken: text(\"access_token\"),\n refreshToken: text(\"refresh_token\"),\n idToken: text(\"id_token\"),\n accessTokenExpiresAt: timestamp(\"access_token_expires_at\"),\n refreshTokenExpiresAt: timestamp(\"refresh_token_expires_at\"),\n scope: text(\"scope\"),\n password: text(\"password\"),\n createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n updatedAt: timestamp(\"updated_at\")\n .$onUpdate(() => /* @__PURE__ */ new Date())\n .notNull(),\n },\n (table) => [index(\"account_userId_idx\").on(table.userId)],\n);\n\nexport const verification = pgTable(\n \"verification\",\n {\n id: text(\"id\").primaryKey(),\n identifier: text(\"identifier\").notNull(),\n value: text(\"value\").notNull(),\n expiresAt: timestamp(\"expires_at\").notNull(),\n createdAt: timestamp(\"created_at\").defaultNow().notNull(),\n updatedAt: timestamp(\"updated_at\")\n .defaultNow()\n .$onUpdate(() => /* @__PURE__ */ new Date())\n .notNull(),\n },\n (table) => [index(\"verification_identifier_idx\").on(table.identifier)],\n);\n\nexport const jwks = pgTable(\"jwks\", {\n id: text(\"id\").primaryKey(),\n publicKey: text(\"public_key\").notNull(),\n privateKey: text(\"private_key\").notNull(),\n createdAt: timestamp(\"created_at\").notNull(),\n expiresAt: timestamp(\"expires_at\"),\n alg: text(\"alg\"),\n crv: text(\"crv\"),\n});\n\nexport const oauthClient = pgTable(\n \"oauth_client\",\n {\n id: text(\"id\").primaryKey(),\n clientId: text(\"client_id\").notNull().unique(),\n clientSecret: text(\"client_secret\"),\n clientDiscoveryId: text(\"client_discovery_id\"),\n disabled: boolean(\"disabled\").default(false),\n skipConsent: boolean(\"skip_consent\"),\n enableEndSession: boolean(\"enable_end_session\"),\n subjectType: text(\"subject_type\"),\n scopes: text(\"scopes\").array(),\n clientCredentialsScopes: text(\"client_credentials_scopes\").array().default([]),\n userId: text(\"user_id\").references(() => user.id, { onDelete: \"cascade\" }),\n createdAt: timestamp(\"created_at\"),\n updatedAt: timestamp(\"updated_at\"),\n name: text(\"name\"),\n uri: text(\"uri\"),\n icon: text(\"icon\"),\n contacts: text(\"contacts\").array(),\n tos: text(\"tos\"),\n policy: text(\"policy\"),\n softwareId: text(\"software_id\"),\n softwareVersion: text(\"software_version\"),\n softwareStatement: text(\"software_statement\"),\n redirectUris: text(\"redirect_uris\").array().notNull(),\n postLogoutRedirectUris: text(\"post_logout_redirect_uris\").array(),\n backchannelLogoutUri: text(\"backchannel_logout_uri\"),\n backchannelLogoutSessionRequired: boolean(\"backchannel_logout_session_required\"),\n tokenEndpointAuthMethod: text(\"token_endpoint_auth_method\"),\n applicationType: text(\"application_type\"),\n jwks: text(\"jwks\"),\n jwksUri: text(\"jwks_uri\"),\n grantTypes: text(\"grant_types\").array(),\n responseTypes: text(\"response_types\").array(),\n requirePKCE: boolean(\"require_pkce\"),\n dpopBoundAccessTokens: boolean(\"dpop_bound_access_tokens\").default(false),\n referenceId: text(\"reference_id\"),\n metadata: jsonb(\"metadata\"),\n },\n (table) => [index(\"oauthClient_userId_idx\").on(table.userId)],\n);\n\nexport const oauthResource = pgTable(\"oauth_resource\", {\n id: text(\"id\").primaryKey(),\n identifier: text(\"identifier\").notNull().unique(),\n name: text(\"name\").notNull(),\n accessTokenTtl: integer(\"access_token_ttl\"),\n refreshTokenTtl: integer(\"refresh_token_ttl\"),\n signingAlgorithm: text(\"signing_algorithm\"),\n signingKeyId: text(\"signing_key_id\"),\n allowedScopes: text(\"allowed_scopes\").array(),\n customClaims: jsonb(\"custom_claims\"),\n dpopBoundAccessTokensRequired: boolean(\"dpop_bound_access_tokens_required\").default(\n false,\n ),\n disabled: boolean(\"disabled\").default(false),\n createdAt: timestamp(\"created_at\"),\n updatedAt: timestamp(\"updated_at\"),\n policyVersion: integer(\"policy_version\").default(1),\n metadata: jsonb(\"metadata\"),\n});\n\nexport const oauthClientResource = pgTable(\n \"oauth_client_resource\",\n {\n id: text(\"id\").primaryKey(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId, { onDelete: \"cascade\" }),\n resourceId: text(\"resource_id\")\n .notNull()\n .references(() => oauthResource.identifier, { onDelete: \"cascade\" }),\n metadata: jsonb(\"metadata\"),\n createdAt: timestamp(\"created_at\"),\n },\n (table) => [\n uniqueIndex(\"oauthClientResource_clientId_resourceId_uidx\").on(\n table.clientId,\n table.resourceId,\n ),\n index(\"oauthClientResource_clientId_idx\").on(table.clientId),\n index(\"oauthClientResource_resourceId_idx\").on(table.resourceId),\n ],\n);\n\nexport const oauthRefreshToken = pgTable(\n \"oauth_refresh_token\",\n {\n id: text(\"id\").primaryKey(),\n token: text(\"token\").notNull().unique(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId, { onDelete: \"cascade\" }),\n sessionId: text(\"session_id\").references(() => session.id, {\n onDelete: \"set null\",\n }),\n userId: text(\"user_id\")\n .notNull()\n .references(() => user.id, { onDelete: \"cascade\" }),\n referenceId: text(\"reference_id\"),\n authorizationCodeId: text(\"authorization_code_id\"),\n resources: text(\"resources\").array(),\n requestedUserInfoClaims: text(\"requested_user_info_claims\").array(),\n expiresAt: timestamp(\"expires_at\").notNull(),\n createdAt: timestamp(\"created_at\").notNull(),\n revoked: timestamp(\"revoked\"),\n rotatedAt: timestamp(\"rotated_at\"),\n rotationReplayResponse: text(\"rotation_replay_response\"),\n rotationReplayExpiresAt: timestamp(\"rotation_replay_expires_at\"),\n authTime: timestamp(\"auth_time\"),\n confirmation: jsonb(\"confirmation\"),\n scopes: text(\"scopes\").array().notNull(),\n },\n (table) => [\n index(\"oauthRefreshToken_clientId_idx\").on(table.clientId),\n index(\"oauthRefreshToken_sessionId_idx\").on(table.sessionId),\n index(\"oauthRefreshToken_userId_idx\").on(table.userId),\n index(\"oauthRefreshToken_authorizationCodeId_idx\").on(table.authorizationCodeId),\n ],\n);\n\nexport const oauthAccessToken = pgTable(\n \"oauth_access_token\",\n {\n id: text(\"id\").primaryKey(),\n token: text(\"token\").notNull().unique(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId, { onDelete: \"cascade\" }),\n sessionId: text(\"session_id\").references(() => session.id, {\n onDelete: \"set null\",\n }),\n userId: text(\"user_id\").references(() => user.id, { onDelete: \"cascade\" }),\n referenceId: text(\"reference_id\"),\n authorizationCodeId: text(\"authorization_code_id\"),\n resources: text(\"resources\").array(),\n requestedUserInfoClaims: text(\"requested_user_info_claims\").array(),\n refreshId: text(\"refresh_id\").references(() => oauthRefreshToken.id, {\n onDelete: \"cascade\",\n }),\n expiresAt: timestamp(\"expires_at\").notNull(),\n createdAt: timestamp(\"created_at\").notNull(),\n revoked: timestamp(\"revoked\"),\n confirmation: jsonb(\"confirmation\"),\n scopes: text(\"scopes\").array().notNull(),\n },\n (table) => [\n index(\"oauthAccessToken_clientId_idx\").on(table.clientId),\n index(\"oauthAccessToken_sessionId_idx\").on(table.sessionId),\n index(\"oauthAccessToken_userId_idx\").on(table.userId),\n index(\"oauthAccessToken_authorizationCodeId_idx\").on(table.authorizationCodeId),\n index(\"oauthAccessToken_refreshId_idx\").on(table.refreshId),\n ],\n);\n\nexport const oauthConsent = pgTable(\n \"oauth_consent\",\n {\n id: text(\"id\").primaryKey(),\n clientId: text(\"client_id\")\n .notNull()\n .references(() => oauthClient.clientId, { onDelete: \"cascade\" }),\n userId: text(\"user_id\").references(() => user.id, { onDelete: \"cascade\" }),\n referenceId: text(\"reference_id\"),\n resources: text(\"resources\").array(),\n requestedUserInfoClaims: text(\"requested_user_info_claims\").array(),\n scopes: text(\"scopes\").array().notNull(),\n createdAt: timestamp(\"created_at\").notNull(),\n updatedAt: timestamp(\"updated_at\").notNull(),\n },\n (table) => [\n index(\"oauthConsent_clientId_idx\").on(table.clientId),\n index(\"oauthConsent_userId_idx\").on(table.userId),\n ],\n);\n\nexport const oauthClientAssertion = pgTable(\"oauth_client_assertion\", {\n id: text(\"id\").primaryKey(),\n expiresAt: timestamp(\"expires_at\").notNull(),\n});\n\nexport const userRelations = relations(user, ({ many }) => ({\n sessions: many(session),\n accounts: many(account),\n oauthClients: many(oauthClient),\n oauthRefreshTokens: many(oauthRefreshToken),\n oauthAccessTokens: many(oauthAccessToken),\n oauthConsents: many(oauthConsent),\n}));\n\nexport const sessionRelations = relations(session, ({ one, many }) => ({\n user: one(user, {\n fields: [session.userId],\n references: [user.id],\n }),\n oauthRefreshTokens: many(oauthRefreshToken),\n oauthAccessTokens: many(oauthAccessToken),\n}));\n\nexport const accountRelations = relations(account, ({ one }) => ({\n user: one(user, {\n fields: [account.userId],\n references: [user.id],\n }),\n}));\n\nexport const oauthClientRelations = relations(oauthClient, ({ one, many }) => ({\n user: one(user, {\n fields: [oauthClient.userId],\n references: [user.id],\n }),\n oauthClientResources: many(oauthClientResource),\n oauthRefreshTokens: many(oauthRefreshToken),\n oauthAccessTokens: many(oauthAccessToken),\n oauthConsents: many(oauthConsent),\n}));\n\nexport const oauthResourceRelations = relations(oauthResource, ({ many }) => ({\n oauthClientResources: many(oauthClientResource),\n}));\n\nexport const oauthClientResourceRelations = relations(oauthClientResource, ({ one }) => ({\n oauthClient: one(oauthClient, {\n fields: [oauthClientResource.clientId],\n references: [oauthClient.clientId],\n }),\n oauthResource: one(oauthResource, {\n fields: [oauthClientResource.resourceId],\n references: [oauthResource.identifier],\n }),\n}));\n\nexport const oauthRefreshTokenRelations = relations(\n oauthRefreshToken,\n ({ one, many }) => ({\n oauthClient: one(oauthClient, {\n fields: [oauthRefreshToken.clientId],\n references: [oauthClient.clientId],\n }),\n session: one(session, {\n fields: [oauthRefreshToken.sessionId],\n references: [session.id],\n }),\n user: one(user, {\n fields: [oauthRefreshToken.userId],\n references: [user.id],\n }),\n oauthAccessTokens: many(oauthAccessToken),\n }),\n);\n\nexport const oauthAccessTokenRelations = relations(oauthAccessToken, ({ one }) => ({\n oauthClient: one(oauthClient, {\n fields: [oauthAccessToken.clientId],\n references: [oauthClient.clientId],\n }),\n session: one(session, {\n fields: [oauthAccessToken.sessionId],\n references: [session.id],\n }),\n user: one(user, {\n fields: [oauthAccessToken.userId],\n references: [user.id],\n }),\n oauthRefreshToken: one(oauthRefreshToken, {\n fields: [oauthAccessToken.refreshId],\n references: [oauthRefreshToken.id],\n }),\n}));\n\nexport const oauthConsentRelations = relations(oauthConsent, ({ one }) => ({\n oauthClient: one(oauthClient, {\n fields: [oauthConsent.clientId],\n references: [oauthClient.clientId],\n }),\n user: one(user, {\n fields: [oauthConsent.userId],\n references: [user.id],\n }),\n}));\n"]}
@@ -0,0 +1,92 @@
1
+ import type { DeviceSignature, PresenceSignature } from "@parlor/capabilities";
2
+ import type { AnswerToSign, LoggedItem, PromptToSign } from "@parlor/chat";
3
+ import type { DeviceId } from "@parlor/core";
4
+ import type { PresenceKey } from "@parlor/server";
5
+ export interface PromptStatement {
6
+ readonly v: 1;
7
+ readonly kind: "prompt";
8
+ /** The app's origin: a statement for one app is worthless to another. */
9
+ readonly app: string;
10
+ readonly threadId: string;
11
+ readonly turnId: string;
12
+ /** `<hostId>/<agentId>`: a prompt cannot be replayed to another agent. */
13
+ readonly agent: string;
14
+ /** base64url SHA-256 of the prompt text */
15
+ readonly digest: string;
16
+ readonly at: number;
17
+ }
18
+ export interface AnswerStatement {
19
+ readonly v: 1;
20
+ readonly kind: "answer";
21
+ readonly app: string;
22
+ readonly threadId: string;
23
+ readonly askId: string;
24
+ /** An option id, `"declined"`, or the digest of a form's values. */
25
+ readonly choice: string;
26
+ readonly at: number;
27
+ }
28
+ /** A linked device's word that the device behind `commitment` is the user's. */
29
+ export interface VouchStatement {
30
+ readonly v: 1;
31
+ readonly kind: "vouch";
32
+ readonly app: string;
33
+ readonly voucher: string;
34
+ readonly device: string;
35
+ /** `deviceCommitment` of the new device's keys, as the voucher checked it. */
36
+ readonly commitment: string;
37
+ readonly at: number;
38
+ }
39
+ /** A linked device's word, with presence, that `device` should no longer use the user's agents. */
40
+ export interface RemoveStatement {
41
+ readonly v: 1;
42
+ readonly kind: "remove";
43
+ readonly app: string;
44
+ readonly actor: string;
45
+ readonly device: string;
46
+ readonly at: number;
47
+ }
48
+ export type Statement = PromptStatement | AnswerStatement | VouchStatement | RemoveStatement;
49
+ export interface Signed<S extends Statement> {
50
+ readonly statement: S;
51
+ readonly deviceId: DeviceId;
52
+ readonly signature: S extends AnswerStatement ? DeviceSignature | PresenceSignature : S extends VouchStatement | RemoveStatement ? PresenceSignature : DeviceSignature;
53
+ }
54
+ /** A device key the verifier pinned itself, never one that travelled with the statement. */
55
+ export interface PinnedDevice {
56
+ readonly deviceId: DeviceId;
57
+ readonly signingKey: JsonWebKey;
58
+ readonly presenceKey?: PresenceKey | undefined;
59
+ }
60
+ export type VerifyOutcome = "valid" | "invalid" | "stale" | "presence_required";
61
+ export interface VerifyOptions {
62
+ readonly requirePresence: boolean;
63
+ readonly now: number;
64
+ readonly maxAgeMs: number;
65
+ }
66
+ export declare function promptStatement(app: string, prompt: PromptToSign, at: number): Promise<PromptStatement>;
67
+ export declare function answerStatement(app: string, answer: AnswerToSign, at: number): Promise<AnswerStatement>;
68
+ export declare function signedPrompt(app: string, item: LoggedItem<"prompt">): Promise<Signed<PromptStatement> | undefined>;
69
+ export declare function statementBytes(statement: Statement): Uint8Array;
70
+ export declare const LINK_CODE_LENGTH = 10;
71
+ /**
72
+ * What a new device shows to be linked: a hash of its keys, so whoever links it checks the
73
+ * keys the backend hands over are the ones this device holds.
74
+ */
75
+ export declare function deviceCommitment(app: string, deviceId: string, signingKey: JsonWebKey, presenceKey: JsonWebKey | undefined): Promise<string>;
76
+ /** The commitment's first 50 bits in Crockford base32, short enough to type. */
77
+ export declare function linkCode(commitment: string): string;
78
+ /** Upper case, no separators, the letters Crockford reads as digits mapped back. */
79
+ export declare function normalizeLinkCode(typed: string): string;
80
+ export declare function formatLinkCode(code: string): string;
81
+ export declare function vouchStatement(app: string, voucher: string, device: string, commitment: string, at: number): VouchStatement;
82
+ export declare function removeStatement(app: string, actor: string, device: string, at: number): RemoveStatement;
83
+ /** The fragment Parlor Host's loopback redirect carries back to the browser that approved `connect`. */
84
+ export declare const HOST_PAIRING_FRAGMENT = "parlor-host-pairing";
85
+ /**
86
+ * The browser that approved `connect` gets the host's pairing secret through the loopback
87
+ * redirect, never through the app; this binds it to one device's keys.
88
+ */
89
+ export declare function pairingProof(secret: string, deviceId: string, signingKey: JsonWebKey): Promise<string>;
90
+ export declare function checkPairingProof(secret: string, proof: string, deviceId: string, signingKey: JsonWebKey): Promise<boolean>;
91
+ export declare function verifyStatement(signed: Signed<Statement>, pinned: PinnedDevice, options: VerifyOptions): Promise<VerifyOutcome>;
92
+ //# sourceMappingURL=statements.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statements.d.ts","sourceRoot":"","sources":["../src/statements.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAM/E,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IACd,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,yEAAyE;IACzE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;IACd,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC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