@drfed/graphql 0.0.0-stage → 0.1.0-dev.561

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 (45) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +254 -2
  3. package/dist/account.d.mts +6 -0
  4. package/dist/account.d.mts.map +1 -0
  5. package/dist/account.mjs +168 -0
  6. package/dist/account.mjs.map +1 -0
  7. package/dist/activity-delivery/entry.d.mts +6 -0
  8. package/dist/activity-delivery/entry.d.mts.map +1 -0
  9. package/dist/activity-delivery/entry.mjs +291 -0
  10. package/dist/activity-delivery/entry.mjs.map +1 -0
  11. package/dist/actor-BJvviz6Q.mjs +600 -0
  12. package/dist/actor-BJvviz6Q.mjs.map +1 -0
  13. package/dist/actor.d.mts +7 -0
  14. package/dist/actor.d.mts.map +1 -0
  15. package/dist/actor.mjs +2 -0
  16. package/dist/builder-BLioFAdv.mjs +152 -0
  17. package/dist/builder-BLioFAdv.mjs.map +1 -0
  18. package/dist/builder-CSxRffRp.d.mts +134 -0
  19. package/dist/builder-CSxRffRp.d.mts.map +1 -0
  20. package/dist/builder.d.mts +2 -0
  21. package/dist/builder.mjs +2 -0
  22. package/dist/classification.d.mts +62 -0
  23. package/dist/classification.d.mts.map +1 -0
  24. package/dist/classification.mjs +65 -0
  25. package/dist/classification.mjs.map +1 -0
  26. package/dist/index.d.mts +55 -0
  27. package/dist/index.d.mts.map +1 -0
  28. package/dist/index.mjs +86 -0
  29. package/dist/index.mjs.map +1 -0
  30. package/dist/instance.d.mts +32 -0
  31. package/dist/instance.d.mts.map +1 -0
  32. package/dist/instance.mjs +176 -0
  33. package/dist/instance.mjs.map +1 -0
  34. package/dist/object.d.mts +6 -0
  35. package/dist/object.d.mts.map +1 -0
  36. package/dist/object.mjs +321 -0
  37. package/dist/object.mjs.map +1 -0
  38. package/dist/readable-CSN0MPlO.mjs +140 -0
  39. package/dist/readable-CSN0MPlO.mjs.map +1 -0
  40. package/dist/schema-ZeV-COPn.mjs +275 -0
  41. package/dist/schema-ZeV-COPn.mjs.map +1 -0
  42. package/dist/schema.d.mts +11 -0
  43. package/dist/schema.d.mts.map +1 -0
  44. package/dist/schema.mjs +2 -0
  45. package/package.json +154 -3
@@ -0,0 +1,275 @@
1
+ import { n as builder } from "./builder-BLioFAdv.mjs";
2
+ import "./instance.mjs";
3
+ import "./account.mjs";
4
+ import "./actor-BJvviz6Q.mjs";
5
+ import "./object.mjs";
6
+ import "./activity-delivery/entry.mjs";
7
+ import { getLogger } from "@logtape/logtape";
8
+ import { sessions } from "@drfed/models/schema";
9
+ import { eq } from "drizzle-orm/sql/expressions";
10
+ import { schema } from "@drfed/models";
11
+ import "@fedify/uri-template";
12
+ import { GraphQLError } from "graphql";
13
+ import { uuidV7 } from "@drfed/models/uuid";
14
+ import { createMessage } from "@upyo/core";
15
+ import { Buffer } from "node:buffer";
16
+ import { timingSafeEqual } from "node:crypto";
17
+ import { LoginChallengeError, consumeLoginChallenge, findLoginChallenge } from "@drfed/models/login";
18
+ //#region src/auth/hash.ts
19
+ const BASE36_CHAR = "0123456789abcdefghijklmnopqrstuvwxyz";
20
+ const generateBase36Code = (len) => Array.from(crypto.getRandomValues(new Uint16Array(len)), (num) => BASE36_CHAR[num % 36]).join("");
21
+ const hashSecret = async (raw) => new Uint8Array(await crypto.subtle.digest("SHA-256", textEncoder.encode(raw))).toHex();
22
+ const textEncoder = new TextEncoder();
23
+ const ACCESS_TOKEN_BYTES = 32;
24
+ const generateAccessToken = () => crypto.getRandomValues(new Uint8Array(ACCESS_TOKEN_BYTES)).toBase64({
25
+ alphabet: "base64url",
26
+ omitPadding: true
27
+ });
28
+ //#endregion
29
+ //#region src/auth/expand.ts
30
+ function expandVerifyUrl({ template, challengeId, code, loginOrigins }) {
31
+ assertVariable(template, "challengeId");
32
+ assertVariable(template, "code");
33
+ let url;
34
+ try {
35
+ url = new URL(template.expand({
36
+ challengeId,
37
+ code
38
+ }));
39
+ } catch {
40
+ throw invalidVerifyUrl("Verify URL template must expand to an absolute URL.");
41
+ }
42
+ if (url.protocol !== "https:" && url.protocol !== "http:") throw invalidVerifyUrl("Verify URL must use HTTP or HTTPS.");
43
+ if (!loginOrigins.has(url.origin)) throw invalidVerifyUrl(`Verify URL origin is not allowed: ${url.origin}.`);
44
+ return url.href;
45
+ }
46
+ function assertVariable(template, name) {
47
+ if (!template.tokens.some((token) => token.kind === "expression" && token.vars.some((variable) => variable.name === name && variable.prefix == null))) throw invalidVerifyUrl(`Verify URL template must include {${name}}.`);
48
+ }
49
+ const invalidVerifyUrl = (message) => new GraphQLError(message, { extensions: { code: "BAD_USER_INPUT" } });
50
+ //#endregion
51
+ //#region src/auth/mail.ts
52
+ /** Send login mail without exposing non-cancellation provider failures. */
53
+ async function sendMail(to, loginUrl, ctx) {
54
+ const signal = ctx.operationSignal ?? ctx.request.signal;
55
+ if (signal.aborted) throw new DOMException("Mail sending cancelled.", "AbortError");
56
+ try {
57
+ const receipt = await ctx.mailer.send(createMessage({
58
+ from: ctx.emailFrom,
59
+ to,
60
+ subject: "Sign in to DrFed",
61
+ content: renderLoginEmail(loginUrl)
62
+ }), { signal });
63
+ if (signal.aborted) throw new DOMException("Mail sending cancelled.", "AbortError");
64
+ logReceipt(receipt);
65
+ } catch {
66
+ if (signal.aborted) throw new DOMException("Mail sending cancelled.", "AbortError");
67
+ logger.warn("Login mail delivery failed.", { outcome: "exception" });
68
+ }
69
+ }
70
+ const renderLoginEmail = (loginUrl) => ({ text: `Hello, Welcome to DrFed! If you request to login to DrFed, please visit:
71
+
72
+ open ${loginUrl}
73
+
74
+ Otherwise, please just ignore this mail.` });
75
+ function logReceipt(receipt) {
76
+ if (receipt.successful) {
77
+ logger.debug("Login mail delivery succeeded.", { outcome: "sent" });
78
+ return;
79
+ }
80
+ logger.warn("Login mail delivery failed.", { outcome: "failed" });
81
+ }
82
+ const logger = getLogger([
83
+ "drfed",
84
+ "graphql",
85
+ "auth"
86
+ ]);
87
+ //#endregion
88
+ //#region src/auth/magic-link.ts
89
+ const LoginChallengeRef = builder.objectRef("LoginChallenge").implement({
90
+ description: "An email login challenge.",
91
+ fields: (t) => ({ challengeId: t.expose("challengeId", {
92
+ type: "UUID",
93
+ description: "The public identifier of the login challenge."
94
+ }) })
95
+ });
96
+ builder.mutationFields((t) => ({ loginByEmail: t.field({
97
+ type: LoginChallengeRef,
98
+ description: "Send a magic link without revealing whether the account exists.",
99
+ args: {
100
+ email: t.arg({
101
+ type: "Email",
102
+ required: true,
103
+ description: "The email address of the `Account`."
104
+ }),
105
+ verifyUrl: t.arg({
106
+ type: "URITemplate",
107
+ required: true,
108
+ description: "Use {challengeId} and {code} variables. The URL's origin must be in the server's login allowlist."
109
+ })
110
+ },
111
+ async resolve(_root, { email, verifyUrl }, ctx) {
112
+ const challengeId = uuidV7();
113
+ const code = generateBase36Code(schema.LOGIN_CHALLENGE_CODE_LENGTH);
114
+ const loginUrl = expandVerifyUrl({
115
+ challengeId,
116
+ code,
117
+ loginOrigins: ctx.loginOrigins,
118
+ template: verifyUrl
119
+ });
120
+ const account = await findAccount(email, ctx);
121
+ if (account == null) return { challengeId };
122
+ const verifier = {
123
+ challengeId,
124
+ code
125
+ };
126
+ await insertChallenge(account.id, verifier, ctx);
127
+ await sendMail(account.email, loginUrl, ctx);
128
+ return { challengeId };
129
+ }
130
+ }) }));
131
+ const findAccount = async (email, ctx) => await ctx.db.query.accounts.findFirst({ where: { email } });
132
+ const insertChallenge = async (accountId, { challengeId, code }, ctx) => await ctx.db.insert(schema.loginChallenges).values({
133
+ id: challengeId,
134
+ accountId,
135
+ code
136
+ });
137
+ //#endregion
138
+ //#region src/auth/challenge.ts
139
+ const SessionRef = builder.drizzleObject("sessions", {
140
+ name: "Session",
141
+ fields: (t) => ({
142
+ id: t.expose("id", { type: "UUID" }),
143
+ accessToken: t.string({
144
+ nullable: true,
145
+ resolve(session) {
146
+ const accessToken = "accessToken" in session ? session.accessToken : null;
147
+ return typeof accessToken === "string" ? accessToken : null;
148
+ }
149
+ }),
150
+ account: t.relation("account", { grantScopes: ["ownAccount"] }),
151
+ created: t.expose("created", { type: "DateTime" }),
152
+ expires: t.expose("expires", { type: "DateTime" })
153
+ })
154
+ });
155
+ builder.mutationFields((t) => ({ completeLoginChallenge: t.drizzleField({
156
+ type: SessionRef,
157
+ nullable: true,
158
+ description: "Complete login challenge.",
159
+ args: {
160
+ challengeId: t.arg({
161
+ type: "UUID",
162
+ required: true
163
+ }),
164
+ code: t.arg({
165
+ type: "String",
166
+ required: true
167
+ })
168
+ },
169
+ async resolve(query, _root, { challengeId, code }, ctx) {
170
+ try {
171
+ const now = Temporal.Now.instant();
172
+ const row = await findLoginChallenge(ctx.db, challengeId, now);
173
+ const id = crypto.randomUUID();
174
+ const accessToken = generateAccessToken();
175
+ const accessHash = await hashSecret(accessToken);
176
+ const providedCode = Buffer.from(code.toLowerCase());
177
+ const expectedCode = Buffer.from(row.code);
178
+ if (providedCode.length !== expectedCode.length || !timingSafeEqual(providedCode, expectedCode)) throw new LoginChallengeError("The provided code does not match.");
179
+ await ctx.db.transaction(async (tx) => {
180
+ await consumeLoginChallenge(tx, row.id, now);
181
+ await insertSession(id, row.accountId, accessHash, tx);
182
+ });
183
+ const session = await ctx.db.query.sessions.findFirst(query({ where: { id } }));
184
+ return session == null ? null : {
185
+ ...session,
186
+ accessToken
187
+ };
188
+ } catch (error) {
189
+ if (error instanceof LoginChallengeError) return null;
190
+ throw error;
191
+ }
192
+ }
193
+ }) }));
194
+ const insertSession = async (id, accountId, tokenHash, tx) => await tx.insert(sessions).values({
195
+ id,
196
+ accountId,
197
+ tokenHash
198
+ });
199
+ //#endregion
200
+ //#region src/auth/revoke.ts
201
+ builder.mutationFields((t) => ({ revokeSession: t.field({
202
+ type: LogoutSuccessRef,
203
+ description: "Revokes a session. Return always `revoke: true`.",
204
+ authScopes: { authenticated: true },
205
+ async resolve(_query, _, ctx) {
206
+ if (ctx.session?.id) await deleteSession(ctx);
207
+ return { revoke: true };
208
+ }
209
+ }) }));
210
+ const LogoutSuccessRef = builder.objectRef("LogoutSuccess").implement({
211
+ description: "The session revoked.",
212
+ fields: (t) => ({ revoke: t.expose("revoke", {
213
+ type: "Boolean",
214
+ description: "Revoking status."
215
+ }) })
216
+ });
217
+ const deleteSession = (ctx) => ctx.db.delete(sessions).where(eq(sessions.id, ctx.session.id));
218
+ //#endregion
219
+ //#region src/auth/entry.ts
220
+ builder.queryFields((t) => ({ viewer: t.drizzleField({
221
+ type: "accounts",
222
+ nullable: true,
223
+ description: "`Account` if authorized, else `null`",
224
+ resolve: (query, _root, _args, ctx) => ctx.session == null ? null : ctx.db.query.accounts.findFirst(query({ where: { id: ctx.session.accountId } }))
225
+ }) }));
226
+ builder.drizzleNode("keys", {
227
+ name: "Key",
228
+ description: "A remote public key, identified by its IRI. Readable by any authenticated viewer, since it holds public material only.",
229
+ authScopes: { authenticated: true },
230
+ runScopesOnType: true,
231
+ id: { column: (key) => key.id },
232
+ fields: (t) => ({
233
+ uuid: t.expose("id", { type: "UUID" }),
234
+ iri: t.expose("iri", { type: "URL" }),
235
+ created: t.expose("created", { type: "DateTime" }),
236
+ versions: t.relatedConnection("versions", {
237
+ description: "The observed versions of the key, oldest first.",
238
+ query: { orderBy: {
239
+ firstSeen: "asc",
240
+ id: "asc"
241
+ } }
242
+ })
243
+ })
244
+ });
245
+ const observationDescription = "DrFed observation time, not the remote key rotation time; does not imply continuous use between observations.";
246
+ builder.drizzleNode("keyVersions", {
247
+ name: "KeyVersion",
248
+ description: "Immutable public key material observed under a `Key`. Readable by any authenticated viewer.",
249
+ authScopes: { authenticated: true },
250
+ runScopesOnType: true,
251
+ id: { column: (version) => version.id },
252
+ fields: (t) => ({
253
+ uuid: t.expose("id", { type: "UUID" }),
254
+ key: t.relation("key"),
255
+ publicKey: t.expose("publicKey", { type: "JSON" }),
256
+ fingerprint: t.exposeString("fingerprint"),
257
+ firstSeen: t.expose("firstSeen", {
258
+ type: "DateTime",
259
+ description: `First ${observationDescription}`
260
+ }),
261
+ lastSeen: t.expose("lastSeen", {
262
+ type: "DateTime",
263
+ description: `Last ${observationDescription}`
264
+ })
265
+ })
266
+ });
267
+ //#endregion
268
+ //#region src/schema.ts
269
+ builder.queryType({});
270
+ builder.mutationType({});
271
+ const schema$1 = builder.toSchema();
272
+ //#endregion
273
+ export { hashSecret as n, schema$1 as t };
274
+
275
+ //# sourceMappingURL=schema-ZeV-COPn.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema-ZeV-COPn.mjs","names":["schema"],"sources":["../src/auth/hash.ts","../src/auth/expand.ts","../src/auth/mail.ts","../src/auth/magic-link.ts","../src/auth/challenge.ts","../src/auth/revoke.ts","../src/auth/entry.ts","../src/key.ts","../src/schema.ts"],"sourcesContent":["// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n// oxlint-disable func-names func-style id-length\n\n// oxlint-disable no-magic-numbers\nconst BASE36_CHAR = \"0123456789abcdefghijklmnopqrstuvwxyz\";\n\n// It's not strictly uniform random sampling, but it's negligible enough.\nexport const generateBase36Code = (len: number): string =>\n Array.from(\n // Choose `Uint16Array` cause `2 ** 16 % 36 = 16`\n // It's greater than `2 ** 8 % 36 = 2 ** 32 % 36 = 4`.\n crypto.getRandomValues(new Uint16Array(len)),\n (num) => BASE36_CHAR[num % BASE36_CHAR.length],\n ).join(\"\");\n\nexport const hashSecret = async (raw: string): Promise<string> =>\n new Uint8Array(\n await crypto.subtle.digest(\"SHA-256\", textEncoder.encode(raw)),\n ).toHex();\n\nconst textEncoder = new TextEncoder();\n\nconst ACCESS_TOKEN_BYTES = 32;\n\nexport const generateAccessToken = (): string =>\n crypto.getRandomValues(new Uint8Array(ACCESS_TOKEN_BYTES)).toBase64({\n alphabet: \"base64url\",\n omitPadding: true,\n });\n","// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\nimport { Template } from \"@fedify/uri-template\";\nimport { GraphQLError } from \"graphql\";\n\nexport interface ExpandVerifyUrlParams {\n template: Template;\n challengeId: `${string}-${string}-${string}-${string}-${string}`;\n code: string;\n loginOrigins: ReadonlySet<string>;\n}\n\nexport default function expandVerifyUrl({\n template,\n challengeId,\n code,\n loginOrigins,\n}: ExpandVerifyUrlParams): string {\n assertVariable(template, \"challengeId\");\n assertVariable(template, \"code\");\n\n let url: URL;\n try {\n url = new URL(template.expand({ challengeId, code }));\n } catch {\n throw invalidVerifyUrl(\n \"Verify URL template must expand to an absolute URL.\",\n );\n }\n\n if (url.protocol !== \"https:\" && url.protocol !== \"http:\") {\n throw invalidVerifyUrl(\"Verify URL must use HTTP or HTTPS.\");\n }\n if (!loginOrigins.has(url.origin)) {\n throw invalidVerifyUrl(`Verify URL origin is not allowed: ${url.origin}.`);\n }\n return url.href;\n}\n\nfunction assertVariable(template: Template, name: string): void {\n const found = template.tokens.some(\n (token) =>\n token.kind === \"expression\" &&\n token.vars.some(\n (variable) => variable.name === name && variable.prefix == null,\n ),\n );\n if (!found) {\n throw invalidVerifyUrl(`Verify URL template must include {${name}}.`);\n }\n}\n\nconst invalidVerifyUrl = (message: string) =>\n new GraphQLError(message, { extensions: { code: \"BAD_USER_INPUT\" } });\n","// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\nimport { getLogger } from \"@logtape/logtape\";\nimport { type MessageContent, type Receipt, createMessage } from \"@upyo/core\";\n\nimport type { UserContext } from \"../builder.ts\";\n\n/** Send login mail without exposing non-cancellation provider failures. */\nexport async function sendMail(\n to: string,\n loginUrl: string,\n ctx: UserContext,\n): Promise<void> {\n const signal = ctx.operationSignal ?? ctx.request.signal;\n if (signal.aborted) {\n throw new DOMException(\"Mail sending cancelled.\", \"AbortError\");\n }\n try {\n const receipt = await ctx.mailer.send(\n createMessage({\n from: ctx.emailFrom,\n to,\n // FIXME: https://github.com/fedify-dev/drfed/issues/35\n subject: \"Sign in to DrFed\",\n content: renderLoginEmail(loginUrl),\n }),\n { signal },\n );\n if (signal.aborted) {\n throw new DOMException(\"Mail sending cancelled.\", \"AbortError\");\n }\n logReceipt(receipt);\n } catch {\n if (signal.aborted) {\n throw new DOMException(\"Mail sending cancelled.\", \"AbortError\");\n }\n logger.warn(\"Login mail delivery failed.\", { outcome: \"exception\" });\n }\n}\n\nconst renderLoginEmail = (loginUrl: string): MessageContent => ({\n // FIXME: https://github.com/fedify-dev/drfed/issues/35\n text: `Hello, Welcome to DrFed! If you request to login to DrFed, please visit:\n\nopen ${loginUrl}\n\nOtherwise, please just ignore this mail.`,\n});\n\nexport function logReceipt(receipt: Receipt<string>): void {\n if (receipt.successful) {\n logger.debug(\"Login mail delivery succeeded.\", { outcome: \"sent\" });\n return;\n }\n logger.warn(\"Login mail delivery failed.\", { outcome: \"failed\" });\n}\n\nconst logger = getLogger([\"drfed\", \"graphql\", \"auth\"]);\n","// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\n// oxlint-disable no-magic-numbers\n\nimport { schema } from \"@drfed/models\";\nimport { type Uuid, uuidV7 } from \"@drfed/models/uuid\";\n\nimport builder, { type UserContext } from \"../builder.ts\";\nimport expandVerifyUrl from \"./expand.ts\";\nimport { generateBase36Code } from \"./hash.ts\";\nimport { sendMail } from \"./mail.ts\";\n\ninterface LoginChallengeShape {\n readonly challengeId: Uuid;\n}\n\nconst LoginChallengeRef = builder\n .objectRef<LoginChallengeShape>(\"LoginChallenge\")\n .implement({\n description: \"An email login challenge.\",\n fields: (t) => ({\n challengeId: t.expose(\"challengeId\", {\n type: \"UUID\",\n description: \"The public identifier of the login challenge.\",\n }),\n }),\n });\n\nbuilder.mutationFields((t) => ({\n loginByEmail: t.field({\n type: LoginChallengeRef,\n description:\n \"Send a magic link without revealing whether the account exists.\",\n args: {\n email: t.arg({\n type: \"Email\",\n required: true,\n description: \"The email address of the `Account`.\",\n }),\n verifyUrl: t.arg({\n type: \"URITemplate\",\n required: true,\n description:\n \"Use {challengeId} and {code} variables. \" +\n \"The URL's origin must be in the server's login allowlist.\",\n }),\n },\n async resolve(_root, { email, verifyUrl }, ctx) {\n const challengeId = uuidV7();\n const code = generateBase36Code(schema.LOGIN_CHALLENGE_CODE_LENGTH);\n const loginUrl = expandVerifyUrl({\n challengeId,\n code,\n loginOrigins: ctx.loginOrigins,\n template: verifyUrl,\n });\n const account = await findAccount(email, ctx);\n if (account == null) {\n // Return an ID even for an unknown account to prevent account\n // enumeration. Consider mailing in a worker to prevent timing attacks.\n return { challengeId };\n }\n const verifier = {\n challengeId,\n code,\n };\n\n await insertChallenge(account.id, verifier, ctx);\n // Do not check the email was sent. Instructs users to request a resend if\n // the email does not arrive after a few minutes at the web page.\n await sendMail(account.email, loginUrl, ctx);\n\n return { challengeId };\n },\n }),\n}));\n\nconst findAccount = async (email: string, ctx: UserContext) =>\n await ctx.db.query.accounts.findFirst({\n where: { email },\n });\n\nconst insertChallenge = async (\n accountId: Uuid,\n { challengeId, code }: { challengeId: Uuid; code: string },\n ctx: UserContext,\n) =>\n await ctx.db.insert(schema.loginChallenges).values({\n id: challengeId,\n accountId,\n code,\n });\n","// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\n// oxlint-disable no-magic-numbers\n\nimport { Buffer } from \"node:buffer\";\nimport { timingSafeEqual } from \"node:crypto\";\n\nimport type { Database } from \"@drfed/models\";\nimport {\n LoginChallengeError,\n consumeLoginChallenge,\n findLoginChallenge,\n} from \"@drfed/models/login\";\nimport { sessions } from \"@drfed/models/schema\";\nimport type { Uuid } from \"@drfed/models/uuid\";\n\nimport builder from \"../builder.ts\";\nimport { generateAccessToken, hashSecret } from \"./hash.ts\";\n\nconst SessionRef = builder.drizzleObject(\"sessions\", {\n name: \"Session\",\n fields: (t) => ({\n id: t.expose(\"id\", { type: \"UUID\" }),\n accessToken: t.string({\n nullable: true,\n resolve(session) {\n const accessToken =\n \"accessToken\" in session ? session.accessToken : null;\n return typeof accessToken === \"string\" ? accessToken : null;\n },\n }),\n // The only `Session` a client can obtain is the one `completeLoginChallenge`\n // just created for it, and `Session` is not a `Node`, so the account behind\n // a session is always the viewer's own. Granting `ownAccount` here lets\n // the login response carry the viewer's private fields even though the\n // request that produced it had no session yet.\n account: t.relation(\"account\", { grantScopes: [\"ownAccount\"] }),\n created: t.expose(\"created\", { type: \"DateTime\" }),\n expires: t.expose(\"expires\", { type: \"DateTime\" }),\n }),\n});\n\nbuilder.mutationFields((t) => ({\n completeLoginChallenge: t.drizzleField({\n type: SessionRef,\n nullable: true,\n description: \"Complete login challenge.\",\n args: {\n challengeId: t.arg({ type: \"UUID\", required: true }),\n code: t.arg({ type: \"String\", required: true }),\n },\n async resolve(query, _root, { challengeId, code }, ctx) {\n try {\n const now = Temporal.Now.instant();\n const row = await findLoginChallenge(ctx.db, challengeId, now);\n const id = crypto.randomUUID();\n const accessToken = generateAccessToken();\n const accessHash = await hashSecret(accessToken);\n\n const providedCode = Buffer.from(code.toLowerCase());\n const expectedCode = Buffer.from(row.code);\n if (\n providedCode.length !== expectedCode.length ||\n !timingSafeEqual(providedCode, expectedCode)\n ) {\n throw new LoginChallengeError(\"The provided code does not match.\");\n }\n await ctx.db.transaction(async (tx) => {\n await consumeLoginChallenge(tx, row.id, now);\n await insertSession(id, row.accountId, accessHash, tx);\n });\n\n const session = await ctx.db.query.sessions.findFirst(\n query({ where: { id } }),\n );\n return session == null ? null : { ...session, accessToken };\n } catch (error) {\n if (error instanceof LoginChallengeError) {\n return null;\n }\n throw error;\n }\n },\n }),\n}));\n\nconst insertSession = async (\n id: Uuid,\n accountId: Uuid,\n tokenHash: string,\n tx: Database,\n) => await tx.insert(sessions).values({ id, accountId, tokenHash });\n","// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\n// oxlint-disable no-magic-numbers\n\nimport { sessions } from \"@drfed/models/schema\";\nimport { eq } from \"drizzle-orm/sql/expressions\";\n\nimport builder, { type UserContext } from \"../builder.ts\";\n\nbuilder.mutationFields((t) => ({\n revokeSession: t.field({\n type: LogoutSuccessRef,\n description: \"Revokes a session. Return always `revoke: true`.\",\n authScopes: {\n authenticated: true,\n },\n async resolve(_query, _, ctx) {\n const sessionId = ctx.session?.id;\n if (sessionId) {\n await deleteSession(ctx);\n }\n // Return always true to prevent brute-force attack.\n return { revoke: true };\n },\n }),\n}));\n\ninterface LogoutSuccessShape {\n revoke: boolean;\n}\n\nconst LogoutSuccessRef = builder\n .objectRef<LogoutSuccessShape>(\"LogoutSuccess\")\n .implement({\n description: \"The session revoked.\",\n fields: (t) => ({\n revoke: t.expose(\"revoke\", {\n type: \"Boolean\",\n description: \"Revoking status.\",\n }),\n }),\n });\n\nconst deleteSession = (ctx: UserContext) =>\n ctx.db.delete(sessions).where(eq(sessions.id, ctx.session!.id));\n","// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\n// oxlint-disable import/no-unassigned-import\nimport \"./magic-link.ts\";\nimport \"./challenge.ts\";\nimport \"./revoke.ts\";\nimport builder from \"../builder.ts\";\n\nbuilder.queryFields((t) => ({\n viewer: t.drizzleField({\n type: \"accounts\",\n nullable: true,\n description: \"`Account` if authorized, else `null`\",\n resolve: (query, _root, _args, ctx) =>\n ctx.session == null\n ? null\n : ctx.db.query.accounts.findFirst(\n query({ where: { id: ctx.session.accountId } }),\n ),\n }),\n}));\n","// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n\nimport builder, { type DrFedObjectRef } from \"./builder.ts\";\n\nconst KeyRef = builder.drizzleNode(\"keys\", {\n name: \"Key\",\n description:\n \"A remote public key, identified by its IRI. Readable by any \" +\n \"authenticated viewer, since it holds public material only.\",\n authScopes: { authenticated: true },\n runScopesOnType: true,\n id: { column: (key) => key.id },\n fields: (t) => ({\n uuid: t.expose(\"id\", { type: \"UUID\" }),\n iri: t.expose(\"iri\", { type: \"URL\" }),\n created: t.expose(\"created\", { type: \"DateTime\" }),\n versions: t.relatedConnection(\"versions\", {\n description: \"The observed versions of the key, oldest first.\",\n query: { orderBy: { firstSeen: \"asc\", id: \"asc\" } },\n }),\n }),\n});\nexport const Key: DrFedObjectRef = KeyRef;\nconst observationDescription =\n \"DrFed observation time, not the remote key rotation time; \" +\n \"does not imply continuous use between observations.\";\nconst KeyVersionRef = builder.drizzleNode(\"keyVersions\", {\n name: \"KeyVersion\",\n description:\n \"Immutable public key material observed under a `Key`. Readable by \" +\n \"any authenticated viewer.\",\n authScopes: { authenticated: true },\n runScopesOnType: true,\n id: { column: (version) => version.id },\n fields: (t) => ({\n uuid: t.expose(\"id\", { type: \"UUID\" }),\n key: t.relation(\"key\"),\n publicKey: t.expose(\"publicKey\", { type: \"JSON\" }),\n fingerprint: t.exposeString(\"fingerprint\"),\n firstSeen: t.expose(\"firstSeen\", {\n type: \"DateTime\",\n description: `First ${observationDescription}`,\n }),\n lastSeen: t.expose(\"lastSeen\", {\n type: \"DateTime\",\n description: `Last ${observationDescription}`,\n }),\n }),\n});\nexport const KeyVersion: DrFedObjectRef = KeyVersionRef;\n","// DrFed: A web-based platform for developing and debugging ActivityPub apps\n// Copyright (C) 2026 DrFed team\n//\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU Affero General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU Affero General Public License for more details.\n//\n// You should have received a copy of the GNU Affero General Public License\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\n// oxlint-disable import/no-unassigned-import\nimport \"./account.ts\";\nimport \"./instance.ts\";\nimport \"./auth/entry.ts\";\nimport \"./actor.ts\";\nimport \"./object.ts\";\nimport \"./activity-delivery/entry.ts\";\nimport \"./key.ts\";\nimport builder from \"./builder.ts\";\n\nbuilder.queryType({});\nbuilder.mutationType({});\n\nexport const schema = builder.toSchema();\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,MAAM,cAAc;AAGpB,MAAa,sBAAsB,QACjC,MAAM,KAGJ,OAAO,gBAAgB,IAA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MAAM,OAAO,CAAC;EACjD,aAAa,EAAE,aAAa,aAAa;EACzC,WAAW,EAAE,OAAO,aAAa;GAC/B,MAAM;GACN,aAAa,SAAS;EACxB,CAAC;EACD,UAAU,EAAE,OAAO,YAAY;GAC7B,MAAM;GACN,aAAa,QAAQ;EACvB,CAAC;CACH;AACF,CAAC;;;ACrCD,QAAQ,UAAU,CAAC,CAAC;AACpB,QAAQ,aAAa,CAAC,CAAC;AAEvB,MAAaA,WAAS,QAAQ,SAAS"}
@@ -0,0 +1,11 @@
1
+ import "./builder-CSxRffRp.mjs";
2
+ import "./account.mjs";
3
+ import "./activity-delivery/entry.mjs";
4
+ import "./actor.mjs";
5
+ import "./instance.mjs";
6
+ import "./object.mjs";
7
+ //#region src/schema.d.ts
8
+ declare const schema: import("graphql").GraphQLSchema;
9
+ //#endregion
10
+ export { schema };
11
+ //# sourceMappingURL=schema.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.mts","names":[],"sources":["../src/schema.ts"],"mappings":";;;;;;;cA4Ba,0BAAM"}
@@ -0,0 +1,2 @@
1
+ import { t as schema } from "./schema-ZeV-COPn.mjs";
2
+ export { schema };
package/package.json CHANGED
@@ -1,6 +1,157 @@
1
1
  {
2
2
  "name": "@drfed/graphql",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.1.0-dev.561",
4
+ "description": "A GraphQL server for DrFed.",
5
+ "keywords": [
6
+ "ActivityPub",
7
+ "fediverse",
8
+ "federation",
9
+ "debugger"
10
+ ],
11
+ "author": {
12
+ "name": "DrFed team",
13
+ "url": "https://drfed.org/"
14
+ },
15
+ "maintainers": [
16
+ {
17
+ "name": "ChanHaeng Lee",
18
+ "email": "2chanhaeng@gmail.com",
19
+ "url": "https://chomu.dev/"
20
+ },
21
+ {
22
+ "name": "Hong Minhee",
23
+ "email": "hong@minhee.org",
24
+ "url": "https://hongminhee.org/"
25
+ },
26
+ {
27
+ "name": "Hyeonseo Kim",
28
+ "email": "dodok8@gmail.com",
29
+ "url": "https://hackers.pub/@gaebalgom"
30
+ },
31
+ {
32
+ "name": "Jiwon Kwon",
33
+ "email": "work@kwonjiwon.org",
34
+ "url": "https://kwonjiwon.org/"
35
+ }
36
+ ],
37
+ "license": "AGPL-3.0-only",
38
+ "engines": {
39
+ "node": ">=26.0.0"
40
+ },
41
+ "type": "module",
42
+ "main": "dist/index.mjs",
43
+ "types": "dist/index.d.mts",
44
+ "exports": {
45
+ ".": {
46
+ "types": "./dist/index.d.mts",
47
+ "default": "./dist/index.mjs"
48
+ },
49
+ "./account": {
50
+ "types": "./dist/account.d.mts",
51
+ "default": "./dist/account.mjs"
52
+ },
53
+ "./actor": {
54
+ "types": "./dist/actor.d.mts",
55
+ "default": "./dist/actor.mjs"
56
+ },
57
+ "./builder": {
58
+ "types": "./dist/builder.d.mts",
59
+ "default": "./dist/builder.mjs"
60
+ },
61
+ "./classification": {
62
+ "types": "./dist/classification.d.mts",
63
+ "default": "./dist/classification.mjs"
64
+ },
65
+ "./instance": {
66
+ "types": "./dist/instance.d.mts",
67
+ "default": "./dist/instance.mjs"
68
+ },
69
+ "./schema": {
70
+ "types": "./dist/schema.d.mts",
71
+ "default": "./dist/schema.mjs"
72
+ },
73
+ "./object": {
74
+ "types": "./dist/object.d.mts",
75
+ "default": "./dist/object.mjs"
76
+ },
77
+ "./activity-delivery": {
78
+ "types": "./dist/activity-delivery/entry.d.mts",
79
+ "default": "./dist/activity-delivery/entry.mjs"
80
+ }
81
+ },
82
+ "files": [
83
+ "dist/",
84
+ "README.md"
85
+ ],
86
+ "tsdown": {
87
+ "entry": [
88
+ "src/index.ts",
89
+ "src/account.ts",
90
+ "src/actor.ts",
91
+ "src/builder.ts",
92
+ "src/classification.ts",
93
+ "src/instance.ts",
94
+ "src/schema.ts",
95
+ "src/object.ts",
96
+ "src/activity-delivery/entry.ts"
97
+ ],
98
+ "dts": {
99
+ "sourcemap": true,
100
+ "tsconfig": "../../tsconfig.graphql.json"
101
+ },
102
+ "sourcemap": true
103
+ },
104
+ "devDependencies": {
105
+ "@electric-sql/pglite": "^0.5.3",
106
+ "@logtape/testing-node": "2.3.0-dev.840",
107
+ "@types/node": "^26.0.0",
108
+ "tsdown": "^0.22.14",
109
+ "typescript": "^7.0.2"
110
+ },
111
+ "dependencies": {
112
+ "@drfed/federation": "0.1.0-dev.561",
113
+ "@drfed/models": "0.1.0-dev.561",
114
+ "@faker-js/faker": "^10.5.0",
115
+ "@fedify/uri-template": "^2.3.1",
116
+ "@fedify/fedify": "2.4.3",
117
+ "@fedify/vocab": "2.4.3",
118
+ "@logtape/graphql-yoga": "2.3.0-dev.840",
119
+ "@logtape/logtape": "2.3.0-dev.840",
120
+ "@pothos/core": "^4.13.0",
121
+ "@pothos/plugin-drizzle": "^0.17.4",
122
+ "@pothos/plugin-errors": "^4.9.1",
123
+ "@pothos/plugin-relay": "^4.7.0",
124
+ "@pothos/plugin-scope-auth": "^4.1.7",
125
+ "@upyo/core": "0.6.0",
126
+ "@upyo/mock": "0.6.0",
127
+ "drizzle-orm": "1.0.0-beta.22",
128
+ "graphql": "^16.14.2",
129
+ "graphql-scalars": "^1.25.0",
130
+ "graphql-yoga": "^5.21.2",
131
+ "uuid": "^14.0.1"
132
+ },
133
+ "repository": {
134
+ "type": "git",
135
+ "url": "https://github.com/fedify-dev/drfed.git",
136
+ "directory": "packages/graphql"
137
+ },
138
+ "publishConfig": {
139
+ "access": "public"
140
+ },
141
+ "drfedBuild": {
142
+ "enabled": true,
143
+ "version": "0.1.0-dev.561",
144
+ "fullVersion": "0.1.0-dev.561+d25a0137",
145
+ "baseVersion": "0.1.0",
146
+ "channel": "dev",
147
+ "sha": "d25a0137f5c21c6d3dd90efeff9889acae2ef250",
148
+ "runNumber": "561",
149
+ "runId": "38254736986",
150
+ "ref": "refs/heads/main",
151
+ "workflow": ".github/workflows/main.yaml"
152
+ },
153
+ "scripts": {
154
+ "build": "tsdown",
155
+ "test": "node --test"
156
+ }
6
157
  }