@pexis/auth 0.1.2 → 0.1.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/api.json ADDED
@@ -0,0 +1,2188 @@
1
+ {
2
+ "format": 1,
3
+ "package": "@pexis/auth",
4
+ "version": "0.1.3",
5
+ "entries": [
6
+ {
7
+ "import": "@pexis/auth",
8
+ "exports": [
9
+ {
10
+ "name": "apple",
11
+ "kind": "function",
12
+ "stability": "stable",
13
+ "deprecated": null,
14
+ "summary": "Sign in with Apple (OpenID Connect).",
15
+ "description": "The client secret is a short-lived\ntoken signed with your key, made for you. Apple posts the callback as a\nform, which Pexis lets past CSRF from appleid.apple.com only.",
16
+ "signatures": [
17
+ {
18
+ "text": "apple(options: AppleOptions): Provider",
19
+ "parameters": [
20
+ {
21
+ "name": "options",
22
+ "type": "AppleOptions",
23
+ "required": true,
24
+ "default": null,
25
+ "description": "Your Services ID, team id, key id and private key.",
26
+ "stability": "stable",
27
+ "deprecated": null
28
+ }
29
+ ],
30
+ "returns": {
31
+ "type": "Provider",
32
+ "description": null
33
+ }
34
+ }
35
+ ],
36
+ "examples": [],
37
+ "see": [],
38
+ "references": [
39
+ "AppleOptions",
40
+ "Provider"
41
+ ]
42
+ },
43
+ {
44
+ "name": "AppleOptions",
45
+ "kind": "interface",
46
+ "stability": "stable",
47
+ "deprecated": null,
48
+ "summary": "What apple() takes, from the Apple Developer account.",
49
+ "description": "",
50
+ "members": [
51
+ {
52
+ "name": "clientId",
53
+ "type": "string",
54
+ "required": true,
55
+ "default": null,
56
+ "description": "The Services ID.",
57
+ "stability": "stable",
58
+ "deprecated": null
59
+ },
60
+ {
61
+ "name": "teamId",
62
+ "type": "string",
63
+ "required": true,
64
+ "default": null,
65
+ "description": "Your Apple Developer team id.",
66
+ "stability": "stable",
67
+ "deprecated": null
68
+ },
69
+ {
70
+ "name": "keyId",
71
+ "type": "string",
72
+ "required": true,
73
+ "default": null,
74
+ "description": "The id of the Sign in with Apple key.",
75
+ "stability": "stable",
76
+ "deprecated": null
77
+ },
78
+ {
79
+ "name": "privateKey",
80
+ "type": "string",
81
+ "required": true,
82
+ "default": null,
83
+ "description": "The .p8 private key, as PEM text. Read it from a secret, never commit it.",
84
+ "stability": "stable",
85
+ "deprecated": null
86
+ }
87
+ ],
88
+ "examples": [],
89
+ "see": [],
90
+ "references": []
91
+ },
92
+ {
93
+ "name": "auth",
94
+ "kind": "function",
95
+ "stability": "stable",
96
+ "deprecated": null,
97
+ "summary": "Sign-in with Google, Microsoft, GitHub, Apple or any OpenID Connect provider: a sign-in page at /auth/sign-in, the callback, and sign-out.",
98
+ "description": "Needs sessions() listed before it.",
99
+ "signatures": [
100
+ {
101
+ "text": "auth(options: AuthOptions): Plugin",
102
+ "parameters": [
103
+ {
104
+ "name": "options",
105
+ "type": "AuthOptions",
106
+ "required": true,
107
+ "default": null,
108
+ "description": "The providers, and how a profile becomes your user.",
109
+ "stability": "stable",
110
+ "deprecated": null
111
+ }
112
+ ],
113
+ "returns": {
114
+ "type": "Plugin",
115
+ "description": null
116
+ }
117
+ }
118
+ ],
119
+ "examples": [
120
+ {
121
+ "code": "plugins: [\n sessions({ store: sessionStore(db) }),\n auth({ providers: [google({ clientId: process.env.GOOGLE_CLIENT_ID!, clientSecret: process.env.GOOGLE_CLIENT_SECRET! })] }),\n]"
122
+ }
123
+ ],
124
+ "see": [],
125
+ "references": [
126
+ "AuthOptions",
127
+ "Plugin"
128
+ ]
129
+ },
130
+ {
131
+ "name": "AuthOptions",
132
+ "kind": "interface",
133
+ "stability": "stable",
134
+ "deprecated": null,
135
+ "summary": "What auth() takes.",
136
+ "description": "",
137
+ "members": [
138
+ {
139
+ "name": "providers",
140
+ "type": "Provider[]",
141
+ "required": true,
142
+ "default": null,
143
+ "description": "The sign-in providers offered, such as google() and github().",
144
+ "stability": "stable",
145
+ "deprecated": null
146
+ },
147
+ {
148
+ "name": "onSignIn",
149
+ "type": "(profile: Profile & {\n provider: string;\n }, ctx: Context) => User | null | Promise<User | null>",
150
+ "required": false,
151
+ "default": null,
152
+ "description": "Turns a provider profile into your user, or returns null to refuse the\nsign-in. Use it to find or create the user in your database. Default: a\nuser whose id is \"<provider>:<subject>\".",
153
+ "stability": "stable",
154
+ "deprecated": null
155
+ },
156
+ {
157
+ "name": "basePath",
158
+ "type": "string",
159
+ "required": false,
160
+ "default": null,
161
+ "description": "Where the auth routes live. Default /auth.",
162
+ "stability": "stable",
163
+ "deprecated": null
164
+ },
165
+ {
166
+ "name": "fetch",
167
+ "type": "typeof fetch",
168
+ "required": false,
169
+ "default": null,
170
+ "description": "For tests: the fetch used to reach providers.",
171
+ "stability": "stable",
172
+ "deprecated": null
173
+ }
174
+ ],
175
+ "examples": [],
176
+ "see": [],
177
+ "references": [
178
+ "Context",
179
+ "Profile",
180
+ "Provider",
181
+ "User"
182
+ ]
183
+ },
184
+ {
185
+ "name": "base64urlEncode",
186
+ "kind": "function",
187
+ "stability": "plugins",
188
+ "deprecated": null,
189
+ "summary": "Base64url without padding, as JWTs and PKCE use.",
190
+ "description": "",
191
+ "signatures": [
192
+ {
193
+ "text": "base64urlEncode(bytes: Uint8Array | string): string",
194
+ "parameters": [
195
+ {
196
+ "name": "bytes",
197
+ "type": "Uint8Array | string",
198
+ "required": true,
199
+ "default": null,
200
+ "description": "Bytes, or text encoded as UTF-8.",
201
+ "stability": "stable",
202
+ "deprecated": null
203
+ }
204
+ ],
205
+ "returns": {
206
+ "type": "string",
207
+ "description": null
208
+ }
209
+ }
210
+ ],
211
+ "examples": [],
212
+ "see": [],
213
+ "references": []
214
+ },
215
+ {
216
+ "name": "Claims",
217
+ "kind": "type",
218
+ "stability": "plugins",
219
+ "deprecated": null,
220
+ "summary": "A JWT's claims: the registered ones typed, any others as unknown.",
221
+ "description": "",
222
+ "type": "Record<string, unknown> & {\n iss?: string;\n sub?: string;\n aud?: string | string[];\n azp?: string;\n exp?: number;\n iat?: number;\n nbf?: number;\n nonce?: string;\n}",
223
+ "examples": [],
224
+ "see": [],
225
+ "references": []
226
+ },
227
+ {
228
+ "name": "decodeJwt",
229
+ "kind": "function",
230
+ "stability": "plugins",
231
+ "deprecated": null,
232
+ "summary": "Splits a JWT into its header, claims and signature without verifying it.",
233
+ "description": "Never trust the claims from this alone; use verifyJwt(). Throws JwtError\nfor a malformed token.",
234
+ "signatures": [
235
+ {
236
+ "text": "decodeJwt(token: string): {\n header: JoseHeader;\n claims: Claims;\n signingInput: string;\n signature: Uint8Array<ArrayBuffer>;\n}",
237
+ "parameters": [
238
+ {
239
+ "name": "token",
240
+ "type": "string",
241
+ "required": true,
242
+ "default": null,
243
+ "description": "A compact JWT.",
244
+ "stability": "stable",
245
+ "deprecated": null
246
+ }
247
+ ],
248
+ "returns": {
249
+ "type": "{\n header: JoseHeader;\n claims: Claims;\n signingInput: string;\n signature: Uint8Array<ArrayBuffer>;\n}",
250
+ "description": null
251
+ }
252
+ }
253
+ ],
254
+ "examples": [],
255
+ "see": [],
256
+ "references": [
257
+ "Claims"
258
+ ]
259
+ },
260
+ {
261
+ "name": "github",
262
+ "kind": "function",
263
+ "stability": "stable",
264
+ "deprecated": null,
265
+ "summary": "Sign in with GitHub (OAuth).",
266
+ "description": "The profile comes from GitHub's API, with the\nprimary verified email.",
267
+ "signatures": [
268
+ {
269
+ "text": "github(options: Credentials): Provider",
270
+ "parameters": [
271
+ {
272
+ "name": "options",
273
+ "type": "Credentials",
274
+ "required": true,
275
+ "default": null,
276
+ "description": "Your OAuth app's client id and secret, and extra scopes.",
277
+ "stability": "stable",
278
+ "deprecated": null
279
+ }
280
+ ],
281
+ "returns": {
282
+ "type": "Provider",
283
+ "description": null
284
+ }
285
+ }
286
+ ],
287
+ "examples": [],
288
+ "see": [],
289
+ "references": [
290
+ "Provider"
291
+ ]
292
+ },
293
+ {
294
+ "name": "google",
295
+ "kind": "function",
296
+ "stability": "stable",
297
+ "deprecated": null,
298
+ "summary": "Sign in with Google (OpenID Connect).",
299
+ "description": "",
300
+ "signatures": [
301
+ {
302
+ "text": "google(options: Credentials): Provider",
303
+ "parameters": [
304
+ {
305
+ "name": "options",
306
+ "type": "Credentials",
307
+ "required": true,
308
+ "default": null,
309
+ "description": "Your client id and secret from the Google Cloud console, and extra scopes.",
310
+ "stability": "stable",
311
+ "deprecated": null
312
+ }
313
+ ],
314
+ "returns": {
315
+ "type": "Provider",
316
+ "description": null
317
+ }
318
+ }
319
+ ],
320
+ "examples": [
321
+ {
322
+ "code": "google({ clientId: process.env.GOOGLE_CLIENT_ID!, clientSecret: process.env.GOOGLE_CLIENT_SECRET! })"
323
+ }
324
+ ],
325
+ "see": [],
326
+ "references": [
327
+ "Provider"
328
+ ]
329
+ },
330
+ {
331
+ "name": "Jwk",
332
+ "kind": "interface",
333
+ "stability": "plugins",
334
+ "deprecated": null,
335
+ "summary": "A public key in JSON Web Key form, as providers publish them.",
336
+ "description": "",
337
+ "members": [
338
+ {
339
+ "name": "kty",
340
+ "type": "string",
341
+ "required": true,
342
+ "default": null,
343
+ "description": "The key type: \"RSA\" or \"EC\".",
344
+ "stability": "stable",
345
+ "deprecated": null
346
+ },
347
+ {
348
+ "name": "kid",
349
+ "type": "string",
350
+ "required": false,
351
+ "default": null,
352
+ "description": "The key's id, which tokens name in their header.",
353
+ "stability": "stable",
354
+ "deprecated": null
355
+ },
356
+ {
357
+ "name": "alg",
358
+ "type": "string",
359
+ "required": false,
360
+ "default": null,
361
+ "description": "The algorithm the key is for, such as \"RS256\".",
362
+ "stability": "stable",
363
+ "deprecated": null
364
+ },
365
+ {
366
+ "name": "use",
367
+ "type": "string",
368
+ "required": false,
369
+ "default": null,
370
+ "description": "What the key is for: \"sig\" for signatures.",
371
+ "stability": "stable",
372
+ "deprecated": null
373
+ },
374
+ {
375
+ "name": "n",
376
+ "type": "string",
377
+ "required": false,
378
+ "default": null,
379
+ "description": "An RSA key's modulus.",
380
+ "stability": "stable",
381
+ "deprecated": null
382
+ },
383
+ {
384
+ "name": "e",
385
+ "type": "string",
386
+ "required": false,
387
+ "default": null,
388
+ "description": "An RSA key's exponent.",
389
+ "stability": "stable",
390
+ "deprecated": null
391
+ },
392
+ {
393
+ "name": "crv",
394
+ "type": "string",
395
+ "required": false,
396
+ "default": null,
397
+ "description": "An EC key's curve, such as \"P-256\".",
398
+ "stability": "stable",
399
+ "deprecated": null
400
+ },
401
+ {
402
+ "name": "x",
403
+ "type": "string",
404
+ "required": false,
405
+ "default": null,
406
+ "description": "An EC key's x coordinate.",
407
+ "stability": "stable",
408
+ "deprecated": null
409
+ },
410
+ {
411
+ "name": "y",
412
+ "type": "string",
413
+ "required": false,
414
+ "default": null,
415
+ "description": "An EC key's y coordinate.",
416
+ "stability": "stable",
417
+ "deprecated": null
418
+ }
419
+ ],
420
+ "examples": [],
421
+ "see": [],
422
+ "references": []
423
+ },
424
+ {
425
+ "name": "JwtError",
426
+ "kind": "class",
427
+ "stability": "plugins",
428
+ "deprecated": null,
429
+ "summary": "A token that failed verification, or keys that could not be read.",
430
+ "description": "The\nmessage says why, never the token.",
431
+ "members": [],
432
+ "examples": [],
433
+ "see": [],
434
+ "references": []
435
+ },
436
+ {
437
+ "name": "KeySet",
438
+ "kind": "class",
439
+ "stability": "plugins",
440
+ "deprecated": null,
441
+ "summary": "Fetches and caches a provider's signing keys, fetching again when a token names a key it has not seen (at most once a minute).",
442
+ "description": "",
443
+ "members": [
444
+ {
445
+ "name": "(constructor)",
446
+ "type": "(url: string, fetcher?: typeof fetch)",
447
+ "required": true,
448
+ "default": null,
449
+ "description": "A key set read from a provider's JWKS URL, with an optional fetch for tests.",
450
+ "stability": "stable",
451
+ "deprecated": null
452
+ },
453
+ {
454
+ "name": "get",
455
+ "type": "(kid: string): Promise<Jwk>",
456
+ "required": true,
457
+ "default": null,
458
+ "description": "The key with this id, fetching the key set again if it is not known yet. Throws JwtError when there is none.",
459
+ "stability": "stable",
460
+ "deprecated": null
461
+ }
462
+ ],
463
+ "examples": [],
464
+ "see": [],
465
+ "references": [
466
+ "Jwk"
467
+ ]
468
+ },
469
+ {
470
+ "name": "microsoft",
471
+ "kind": "function",
472
+ "stability": "stable",
473
+ "deprecated": null,
474
+ "summary": "Sign in with Microsoft: work, school and personal accounts (OpenID Connect).",
475
+ "description": "Microsoft does not promise emails are verified, so they are never marked so.",
476
+ "signatures": [
477
+ {
478
+ "text": "microsoft(options: Credentials & {\n tenant?: string;\n}): Provider",
479
+ "parameters": [
480
+ {
481
+ "name": "options",
482
+ "type": "Credentials & {\n tenant?: string;\n}",
483
+ "required": true,
484
+ "default": null,
485
+ "description": "Your client id and secret, and `tenant`: \"common\" (default), \"organizations\", \"consumers\" or a tenant id.",
486
+ "stability": "stable",
487
+ "deprecated": null
488
+ }
489
+ ],
490
+ "returns": {
491
+ "type": "Provider",
492
+ "description": null
493
+ }
494
+ }
495
+ ],
496
+ "examples": [],
497
+ "see": [],
498
+ "references": [
499
+ "Provider"
500
+ ]
501
+ },
502
+ {
503
+ "name": "oidc",
504
+ "kind": "function",
505
+ "stability": "stable",
506
+ "deprecated": null,
507
+ "summary": "Any OpenID Connect provider: Okta, Auth0, Keycloak, Entra ID, Cognito, GitLab and others.",
508
+ "description": "",
509
+ "signatures": [
510
+ {
511
+ "text": "oidc(options: OidcOptions): Provider",
512
+ "parameters": [
513
+ {
514
+ "name": "options",
515
+ "type": "OidcOptions",
516
+ "required": true,
517
+ "default": null,
518
+ "description": "Its id, name, issuer, and your client id and secret.",
519
+ "stability": "stable",
520
+ "deprecated": null
521
+ }
522
+ ],
523
+ "returns": {
524
+ "type": "Provider",
525
+ "description": null
526
+ }
527
+ }
528
+ ],
529
+ "examples": [
530
+ {
531
+ "code": "oidc({ id: 'okta', name: 'Okta', issuer: 'https://dev-123.okta.com', clientId: '...', clientSecret: process.env.OKTA_SECRET! })"
532
+ }
533
+ ],
534
+ "see": [],
535
+ "references": [
536
+ "OidcOptions",
537
+ "Provider"
538
+ ]
539
+ },
540
+ {
541
+ "name": "OidcOptions",
542
+ "kind": "interface",
543
+ "stability": "stable",
544
+ "deprecated": null,
545
+ "summary": "What oidc() takes.",
546
+ "description": "",
547
+ "members": [
548
+ {
549
+ "name": "id",
550
+ "type": "string",
551
+ "required": true,
552
+ "default": null,
553
+ "description": "The provider's id, in sign-in URLs: lowercase letters, digits and hyphens.",
554
+ "stability": "stable",
555
+ "deprecated": null
556
+ },
557
+ {
558
+ "name": "name",
559
+ "type": "string",
560
+ "required": true,
561
+ "default": null,
562
+ "description": "Shown on the sign-in button: \"Continue with <name>\".",
563
+ "stability": "stable",
564
+ "deprecated": null
565
+ },
566
+ {
567
+ "name": "issuer",
568
+ "type": "string",
569
+ "required": true,
570
+ "default": null,
571
+ "description": "The issuer URL; its endpoints are read from /.well-known/openid-configuration.",
572
+ "stability": "stable",
573
+ "deprecated": null
574
+ },
575
+ {
576
+ "name": "scopes",
577
+ "type": "string[]",
578
+ "required": false,
579
+ "default": null,
580
+ "description": "Default [\"openid\", \"email\", \"profile\"].",
581
+ "stability": "stable",
582
+ "deprecated": null
583
+ }
584
+ ],
585
+ "examples": [],
586
+ "see": [],
587
+ "references": []
588
+ },
589
+ {
590
+ "name": "Profile",
591
+ "kind": "interface",
592
+ "stability": "stable",
593
+ "deprecated": null,
594
+ "summary": "What a provider tells us about the person.",
595
+ "description": "",
596
+ "members": [
597
+ {
598
+ "name": "subject",
599
+ "type": "string",
600
+ "required": true,
601
+ "default": null,
602
+ "description": "The provider's stable ID for the person.",
603
+ "stability": "stable",
604
+ "deprecated": null
605
+ },
606
+ {
607
+ "name": "email",
608
+ "type": "string",
609
+ "required": false,
610
+ "default": null,
611
+ "description": "Their email address, if the provider shared it.",
612
+ "stability": "stable",
613
+ "deprecated": null
614
+ },
615
+ {
616
+ "name": "emailVerified",
617
+ "type": "boolean",
618
+ "required": true,
619
+ "default": null,
620
+ "description": "Whether the provider verified the email. Never link accounts by an unverified email.",
621
+ "stability": "stable",
622
+ "deprecated": null
623
+ },
624
+ {
625
+ "name": "name",
626
+ "type": "string",
627
+ "required": false,
628
+ "default": null,
629
+ "description": "Their display name.",
630
+ "stability": "stable",
631
+ "deprecated": null
632
+ },
633
+ {
634
+ "name": "picture",
635
+ "type": "string",
636
+ "required": false,
637
+ "default": null,
638
+ "description": "An https URL of their picture.",
639
+ "stability": "stable",
640
+ "deprecated": null
641
+ }
642
+ ],
643
+ "examples": [],
644
+ "see": [],
645
+ "references": []
646
+ },
647
+ {
648
+ "name": "Provider",
649
+ "kind": "interface",
650
+ "stability": "plugins",
651
+ "deprecated": null,
652
+ "summary": "A sign-in provider, from google(), microsoft(), github(), apple() or oidc(): a few facts about the provider and how to read its answer.",
653
+ "description": "",
654
+ "members": [
655
+ {
656
+ "name": "id",
657
+ "type": "string",
658
+ "required": true,
659
+ "default": null,
660
+ "description": "The provider's id, in sign-in URLs: /auth/<id>.",
661
+ "stability": "stable",
662
+ "deprecated": null
663
+ },
664
+ {
665
+ "name": "name",
666
+ "type": "string",
667
+ "required": true,
668
+ "default": null,
669
+ "description": "Shown on the sign-in button: \"Continue with <name>\".",
670
+ "stability": "stable",
671
+ "deprecated": null
672
+ },
673
+ {
674
+ "name": "clientId",
675
+ "type": "string",
676
+ "required": true,
677
+ "default": null,
678
+ "description": "Your app's client id at the provider.",
679
+ "stability": "stable",
680
+ "deprecated": null
681
+ },
682
+ {
683
+ "name": "clientSecret",
684
+ "type": "string | (() => Promise<string>)",
685
+ "required": false,
686
+ "default": null,
687
+ "description": "A fixed secret, or a function for providers whose secret is a short-lived token (Apple).",
688
+ "stability": "stable",
689
+ "deprecated": null
690
+ },
691
+ {
692
+ "name": "scopes",
693
+ "type": "string[]",
694
+ "required": true,
695
+ "default": null,
696
+ "description": "The scopes asked for.",
697
+ "stability": "stable",
698
+ "deprecated": null
699
+ },
700
+ {
701
+ "name": "issuer",
702
+ "type": "string",
703
+ "required": false,
704
+ "default": null,
705
+ "description": "OpenID Connect issuer. Set this, or the endpoints below.",
706
+ "stability": "stable",
707
+ "deprecated": null
708
+ },
709
+ {
710
+ "name": "issuerCheck",
711
+ "type": "(iss: string, claims: Claims) => boolean",
712
+ "required": false,
713
+ "default": null,
714
+ "description": "For providers whose issuer varies, such as Microsoft's multi-tenant endpoint.",
715
+ "stability": "stable",
716
+ "deprecated": null
717
+ },
718
+ {
719
+ "name": "authorizationEndpoint",
720
+ "type": "string",
721
+ "required": false,
722
+ "default": null,
723
+ "description": "Where people are sent to sign in, when there is no issuer to discover it from.",
724
+ "stability": "stable",
725
+ "deprecated": null
726
+ },
727
+ {
728
+ "name": "tokenEndpoint",
729
+ "type": "string",
730
+ "required": false,
731
+ "default": null,
732
+ "description": "Where the code is exchanged for tokens, when there is no issuer.",
733
+ "stability": "stable",
734
+ "deprecated": null
735
+ },
736
+ {
737
+ "name": "jwksUri",
738
+ "type": "string",
739
+ "required": false,
740
+ "default": null,
741
+ "description": "Where the provider's signing keys are, when there is no issuer.",
742
+ "stability": "stable",
743
+ "deprecated": null
744
+ },
745
+ {
746
+ "name": "oidc",
747
+ "type": "boolean",
748
+ "required": true,
749
+ "default": null,
750
+ "description": "Whether the provider returns an ID token to verify.",
751
+ "stability": "stable",
752
+ "deprecated": null
753
+ },
754
+ {
755
+ "name": "responseMode",
756
+ "type": "'query' | 'form_post'",
757
+ "required": false,
758
+ "default": null,
759
+ "description": "Some providers post the callback as a form (Apple, when asking for name and email).",
760
+ "stability": "stable",
761
+ "deprecated": null
762
+ },
763
+ {
764
+ "name": "authorizationParams",
765
+ "type": "Record<string, string>",
766
+ "required": false,
767
+ "default": null,
768
+ "description": "Extra parameters for the authorization request, such as prompt.",
769
+ "stability": "stable",
770
+ "deprecated": null
771
+ },
772
+ {
773
+ "name": "tokenAuth",
774
+ "type": "'post' | 'basic'",
775
+ "required": false,
776
+ "default": null,
777
+ "description": "How the client secret is sent to the token endpoint: in the body, or as HTTP Basic.",
778
+ "stability": "stable",
779
+ "deprecated": null
780
+ },
781
+ {
782
+ "name": "profile",
783
+ "type": "(input: ProfileInput): Promise<Profile>",
784
+ "required": true,
785
+ "default": null,
786
+ "description": "Reads the person's profile from the verified ID token, or from the provider's API.",
787
+ "stability": "stable",
788
+ "deprecated": null
789
+ }
790
+ ],
791
+ "examples": [],
792
+ "see": [],
793
+ "references": [
794
+ "Claims",
795
+ "Profile"
796
+ ]
797
+ },
798
+ {
799
+ "name": "requireRecentSignIn",
800
+ "kind": "function",
801
+ "stability": "stable",
802
+ "deprecated": null,
803
+ "summary": "For the page in front of something sensitive (changing an email, deleting an account): sends people who signed in more than `seconds` ago (default five minutes) to sign in again, and back here afterwards.",
804
+ "description": "The provider is\nasked to make them enter their credentials again, and providers that speak\nOpenID Connect must prove it. Guard the action itself too, with\npermission: (ctx) => signedInWithin(ctx, 300) from @pexis/sessions.",
805
+ "signatures": [
806
+ {
807
+ "text": "requireRecentSignIn(ctx?: Context, seconds?: number): Redirect | null",
808
+ "parameters": [
809
+ {
810
+ "name": "ctx",
811
+ "type": "Context",
812
+ "required": false,
813
+ "default": "the current request's",
814
+ "description": "The request's context. Default: the current request's.",
815
+ "stability": "stable",
816
+ "deprecated": null
817
+ },
818
+ {
819
+ "name": "seconds",
820
+ "type": "number",
821
+ "required": false,
822
+ "default": "300",
823
+ "description": "How recent the sign-in must be. Default: 300.",
824
+ "stability": "stable",
825
+ "deprecated": null
826
+ }
827
+ ],
828
+ "returns": {
829
+ "type": "Redirect | null",
830
+ "description": "A redirect to sign in again, or null when the sign-in is recent enough."
831
+ }
832
+ }
833
+ ],
834
+ "examples": [
835
+ {
836
+ "code": "load: (ctx) => requireRecentSignIn(ctx) ?? loadSettings(ctx.user!),"
837
+ }
838
+ ],
839
+ "see": [],
840
+ "references": [
841
+ "Context",
842
+ "Redirect"
843
+ ]
844
+ },
845
+ {
846
+ "name": "requireUser",
847
+ "kind": "function",
848
+ "stability": "stable",
849
+ "deprecated": null,
850
+ "summary": "For a page's load(): sends visitors who are not signed in to the sign-in page, and back here afterwards.",
851
+ "description": "",
852
+ "signatures": [
853
+ {
854
+ "text": "requireUser(ctx?: Context): Redirect | null",
855
+ "parameters": [
856
+ {
857
+ "name": "ctx",
858
+ "type": "Context",
859
+ "required": false,
860
+ "default": "the current request's",
861
+ "description": "The request's context. Default: the current request's.",
862
+ "stability": "stable",
863
+ "deprecated": null
864
+ }
865
+ ],
866
+ "returns": {
867
+ "type": "Redirect | null",
868
+ "description": "A redirect to sign in, or null when the visitor is signed in."
869
+ }
870
+ }
871
+ ],
872
+ "examples": [
873
+ {
874
+ "code": "load: (ctx) => requireUser(ctx) ?? loadAccount(ctx.user!),"
875
+ }
876
+ ],
877
+ "see": [],
878
+ "references": [
879
+ "Context",
880
+ "Redirect"
881
+ ]
882
+ },
883
+ {
884
+ "name": "safeReturnTo",
885
+ "kind": "function",
886
+ "stability": "plugins",
887
+ "deprecated": null,
888
+ "summary": "A path to return to after sign-in, only if it is on this site: never another origin, never \"//host\".",
889
+ "description": "Anything else gives the fallback.",
890
+ "signatures": [
891
+ {
892
+ "text": "safeReturnTo(value: string | null | undefined, fallback?: string): string",
893
+ "parameters": [
894
+ {
895
+ "name": "value",
896
+ "type": "string | null | undefined",
897
+ "required": true,
898
+ "default": null,
899
+ "description": "The requested path.",
900
+ "stability": "stable",
901
+ "deprecated": null
902
+ },
903
+ {
904
+ "name": "fallback",
905
+ "type": "string",
906
+ "required": false,
907
+ "default": "\"/\"",
908
+ "description": "Where to go instead. Default: \"/\".",
909
+ "stability": "stable",
910
+ "deprecated": null
911
+ }
912
+ ],
913
+ "returns": {
914
+ "type": "string",
915
+ "description": null
916
+ }
917
+ }
918
+ ],
919
+ "examples": [],
920
+ "see": [],
921
+ "references": []
922
+ },
923
+ {
924
+ "name": "signEs256",
925
+ "kind": "function",
926
+ "stability": "plugins",
927
+ "deprecated": null,
928
+ "summary": "Signs an ES256 token with a PKCS#8 PEM private key, for Apple's client secret.",
929
+ "description": "",
930
+ "signatures": [
931
+ {
932
+ "text": "signEs256(header: Record<string, unknown>, claims: Record<string, unknown>, pem: string): Promise<string>",
933
+ "parameters": [
934
+ {
935
+ "name": "header",
936
+ "type": "Record<string, unknown>",
937
+ "required": true,
938
+ "default": null,
939
+ "description": "The JOSE header; `alg` is set to ES256.",
940
+ "stability": "stable",
941
+ "deprecated": null
942
+ },
943
+ {
944
+ "name": "claims",
945
+ "type": "Record<string, unknown>",
946
+ "required": true,
947
+ "default": null,
948
+ "description": "The claims.",
949
+ "stability": "stable",
950
+ "deprecated": null
951
+ },
952
+ {
953
+ "name": "pem",
954
+ "type": "string",
955
+ "required": true,
956
+ "default": null,
957
+ "description": "The private key, as PEM text.",
958
+ "stability": "stable",
959
+ "deprecated": null
960
+ }
961
+ ],
962
+ "returns": {
963
+ "type": "Promise<string>",
964
+ "description": null
965
+ }
966
+ }
967
+ ],
968
+ "examples": [],
969
+ "see": [],
970
+ "references": []
971
+ },
972
+ {
973
+ "name": "SignInLink",
974
+ "kind": "component",
975
+ "stability": "stable",
976
+ "deprecated": null,
977
+ "summary": "A link that starts signing in with a provider.",
978
+ "description": "",
979
+ "signatures": [
980
+ {
981
+ "text": "SignInLink({ provider, returnTo, fresh, children }: {\n provider: string;\n returnTo?: string;\n fresh?: boolean;\n children?: Child;\n}): Markup",
982
+ "parameters": [
983
+ {
984
+ "name": "props",
985
+ "type": "{\n provider: string;\n returnTo?: string;\n fresh?: boolean;\n children?: Child;\n}",
986
+ "required": true,
987
+ "default": null,
988
+ "description": "The provider, where to return, and the link's text.",
989
+ "stability": "stable",
990
+ "deprecated": null,
991
+ "members": [
992
+ {
993
+ "name": "provider",
994
+ "type": "string",
995
+ "required": true,
996
+ "default": null,
997
+ "description": "The provider's id, such as \"google\".",
998
+ "stability": "stable",
999
+ "deprecated": null
1000
+ },
1001
+ {
1002
+ "name": "returnTo",
1003
+ "type": "string",
1004
+ "required": false,
1005
+ "default": null,
1006
+ "description": "A path on this site to come back to afterwards.",
1007
+ "stability": "stable",
1008
+ "deprecated": null
1009
+ },
1010
+ {
1011
+ "name": "fresh",
1012
+ "type": "boolean",
1013
+ "required": false,
1014
+ "default": null,
1015
+ "description": "Ask the provider to make the person sign in again, even if they are signed in there.",
1016
+ "stability": "stable",
1017
+ "deprecated": null
1018
+ },
1019
+ {
1020
+ "name": "children",
1021
+ "type": "Child",
1022
+ "required": false,
1023
+ "default": null,
1024
+ "description": "The link's text. Default: \"Sign in\".",
1025
+ "stability": "stable",
1026
+ "deprecated": null
1027
+ }
1028
+ ]
1029
+ }
1030
+ ],
1031
+ "returns": {
1032
+ "type": "Markup",
1033
+ "description": null
1034
+ }
1035
+ }
1036
+ ],
1037
+ "examples": [
1038
+ {
1039
+ "code": "<SignInLink provider=\"google\" returnTo=\"/account\">Continue with Google</SignInLink>"
1040
+ }
1041
+ ],
1042
+ "see": [],
1043
+ "references": [
1044
+ "Child",
1045
+ "Markup"
1046
+ ]
1047
+ },
1048
+ {
1049
+ "name": "SignOutButton",
1050
+ "kind": "component",
1051
+ "stability": "stable",
1052
+ "deprecated": null,
1053
+ "summary": "A sign-out button.",
1054
+ "description": "Signing out is a POST, so other sites cannot sign people out.",
1055
+ "signatures": [
1056
+ {
1057
+ "text": "SignOutButton({ children }: {\n children?: Child;\n}): Markup",
1058
+ "parameters": [
1059
+ {
1060
+ "name": "props",
1061
+ "type": "{\n children?: Child;\n}",
1062
+ "required": true,
1063
+ "default": null,
1064
+ "description": "The button's text.",
1065
+ "stability": "stable",
1066
+ "deprecated": null,
1067
+ "members": [
1068
+ {
1069
+ "name": "children",
1070
+ "type": "Child",
1071
+ "required": false,
1072
+ "default": null,
1073
+ "description": "The button's text. Default: \"Sign out\".",
1074
+ "stability": "stable",
1075
+ "deprecated": null
1076
+ }
1077
+ ]
1078
+ }
1079
+ ],
1080
+ "returns": {
1081
+ "type": "Markup",
1082
+ "description": null
1083
+ }
1084
+ }
1085
+ ],
1086
+ "examples": [],
1087
+ "see": [],
1088
+ "references": [
1089
+ "Child",
1090
+ "Markup"
1091
+ ]
1092
+ },
1093
+ {
1094
+ "name": "TokenResponse",
1095
+ "kind": "interface",
1096
+ "stability": "plugins",
1097
+ "deprecated": null,
1098
+ "summary": "What a provider's token endpoint answered, as OAuth names it.",
1099
+ "description": "",
1100
+ "members": [
1101
+ {
1102
+ "name": "access_token",
1103
+ "type": "string",
1104
+ "required": false,
1105
+ "default": null,
1106
+ "description": "The access token, for calling the provider's API. Never logged.",
1107
+ "stability": "stable",
1108
+ "deprecated": null
1109
+ },
1110
+ {
1111
+ "name": "id_token",
1112
+ "type": "string",
1113
+ "required": false,
1114
+ "default": null,
1115
+ "description": "The OpenID Connect ID token, verified before use.",
1116
+ "stability": "stable",
1117
+ "deprecated": null
1118
+ },
1119
+ {
1120
+ "name": "token_type",
1121
+ "type": "string",
1122
+ "required": false,
1123
+ "default": null,
1124
+ "description": "Usually \"Bearer\".",
1125
+ "stability": "stable",
1126
+ "deprecated": null
1127
+ },
1128
+ {
1129
+ "name": "expires_in",
1130
+ "type": "number",
1131
+ "required": false,
1132
+ "default": null,
1133
+ "description": "Seconds until the access token expires.",
1134
+ "stability": "stable",
1135
+ "deprecated": null
1136
+ },
1137
+ {
1138
+ "name": "scope",
1139
+ "type": "string",
1140
+ "required": false,
1141
+ "default": null,
1142
+ "description": "The scopes granted, space-separated.",
1143
+ "stability": "stable",
1144
+ "deprecated": null
1145
+ },
1146
+ {
1147
+ "name": "[key: string]",
1148
+ "type": "unknown",
1149
+ "required": true,
1150
+ "default": null,
1151
+ "description": "Any other fields the provider sent.",
1152
+ "stability": "stable",
1153
+ "deprecated": null
1154
+ }
1155
+ ],
1156
+ "examples": [],
1157
+ "see": [],
1158
+ "references": []
1159
+ },
1160
+ {
1161
+ "name": "verifyJwt",
1162
+ "kind": "function",
1163
+ "stability": "plugins",
1164
+ "deprecated": null,
1165
+ "summary": "Verifies a JWT's signature (RS256 or ES256), issuer, audience, expiry and nonce, and returns its claims.",
1166
+ "description": "Throws JwtError when anything is wrong.",
1167
+ "signatures": [
1168
+ {
1169
+ "text": "verifyJwt(token: string, keys: {\n get(kid: string): Promise<Jwk>;\n}, expect: Expectations): Promise<Claims>",
1170
+ "parameters": [
1171
+ {
1172
+ "name": "token",
1173
+ "type": "string",
1174
+ "required": true,
1175
+ "default": null,
1176
+ "description": "A compact JWT.",
1177
+ "stability": "stable",
1178
+ "deprecated": null
1179
+ },
1180
+ {
1181
+ "name": "keys",
1182
+ "type": "{\n get(kid: string): Promise<Jwk>;\n}",
1183
+ "required": true,
1184
+ "default": null,
1185
+ "description": "Where to find the signing key by id, such as a KeySet.",
1186
+ "stability": "stable",
1187
+ "deprecated": null,
1188
+ "members": [
1189
+ {
1190
+ "name": "get",
1191
+ "type": "(kid: string): Promise<Jwk>",
1192
+ "required": true,
1193
+ "default": null,
1194
+ "description": "The key with this id.",
1195
+ "stability": "stable",
1196
+ "deprecated": null
1197
+ }
1198
+ ]
1199
+ },
1200
+ {
1201
+ "name": "expect",
1202
+ "type": "Expectations",
1203
+ "required": true,
1204
+ "default": null,
1205
+ "description": "The issuer, audience and nonce the token must have.",
1206
+ "stability": "stable",
1207
+ "deprecated": null
1208
+ }
1209
+ ],
1210
+ "returns": {
1211
+ "type": "Promise<Claims>",
1212
+ "description": null
1213
+ }
1214
+ }
1215
+ ],
1216
+ "examples": [],
1217
+ "see": [],
1218
+ "references": [
1219
+ "Claims",
1220
+ "Jwk"
1221
+ ]
1222
+ }
1223
+ ]
1224
+ },
1225
+ {
1226
+ "import": "@pexis/auth/server",
1227
+ "exports": [
1228
+ {
1229
+ "name": "bearerToken",
1230
+ "kind": "function",
1231
+ "stability": "experimental",
1232
+ "deprecated": null,
1233
+ "summary": "The Bearer token in an Authorization header, or null.",
1234
+ "description": "Other schemes (Basic) are not ours.",
1235
+ "signatures": [
1236
+ {
1237
+ "text": "bearerToken(request: Request): string | null",
1238
+ "parameters": [
1239
+ {
1240
+ "name": "request",
1241
+ "type": "Request",
1242
+ "required": true,
1243
+ "default": null,
1244
+ "description": "The request.",
1245
+ "stability": "stable",
1246
+ "deprecated": null
1247
+ }
1248
+ ],
1249
+ "returns": {
1250
+ "type": "string | null",
1251
+ "description": null
1252
+ }
1253
+ }
1254
+ ],
1255
+ "examples": [],
1256
+ "see": [],
1257
+ "references": []
1258
+ },
1259
+ {
1260
+ "name": "checkRedirectUri",
1261
+ "kind": "function",
1262
+ "stability": "experimental",
1263
+ "deprecated": null,
1264
+ "summary": "A redirect URI a client may list: https, or http on a loopback address for apps on the person's computer (RFC 8252).",
1265
+ "description": "Throws ClientError otherwise.",
1266
+ "signatures": [
1267
+ {
1268
+ "text": "checkRedirectUri(raw: string): URL",
1269
+ "parameters": [
1270
+ {
1271
+ "name": "raw",
1272
+ "type": "string",
1273
+ "required": true,
1274
+ "default": null,
1275
+ "description": "The redirect URI as listed.",
1276
+ "stability": "stable",
1277
+ "deprecated": null
1278
+ }
1279
+ ],
1280
+ "returns": {
1281
+ "type": "URL",
1282
+ "description": null
1283
+ }
1284
+ }
1285
+ ],
1286
+ "examples": [],
1287
+ "see": [],
1288
+ "references": []
1289
+ },
1290
+ {
1291
+ "name": "ClientError",
1292
+ "kind": "class",
1293
+ "stability": "experimental",
1294
+ "deprecated": null,
1295
+ "summary": "A client that cannot be used, with a reason safe to show the person.",
1296
+ "description": "",
1297
+ "members": [],
1298
+ "examples": [],
1299
+ "see": [],
1300
+ "references": []
1301
+ },
1302
+ {
1303
+ "name": "clientIdUrl",
1304
+ "kind": "function",
1305
+ "stability": "experimental",
1306
+ "deprecated": null,
1307
+ "summary": "The client_id as a URL, or a ClientError saying why it cannot be one.",
1308
+ "description": "",
1309
+ "signatures": [
1310
+ {
1311
+ "text": "clientIdUrl(raw: string): URL",
1312
+ "parameters": [
1313
+ {
1314
+ "name": "raw",
1315
+ "type": "string",
1316
+ "required": true,
1317
+ "default": null,
1318
+ "description": "The client_id as sent.",
1319
+ "stability": "stable",
1320
+ "deprecated": null
1321
+ }
1322
+ ],
1323
+ "returns": {
1324
+ "type": "URL",
1325
+ "description": null
1326
+ }
1327
+ }
1328
+ ],
1329
+ "examples": [],
1330
+ "see": [],
1331
+ "references": []
1332
+ },
1333
+ {
1334
+ "name": "clientLoader",
1335
+ "kind": "function",
1336
+ "stability": "experimental",
1337
+ "deprecated": null,
1338
+ "summary": "A cached, rate-limited loader of client metadata documents.",
1339
+ "description": "",
1340
+ "signatures": [
1341
+ {
1342
+ "text": "clientLoader(options: ClientLoaderOptions): ClientLoader",
1343
+ "parameters": [
1344
+ {
1345
+ "name": "options",
1346
+ "type": "ClientLoaderOptions",
1347
+ "required": true,
1348
+ "default": null,
1349
+ "description": "The fetch, and cache and concurrency limits.",
1350
+ "stability": "stable",
1351
+ "deprecated": null
1352
+ }
1353
+ ],
1354
+ "returns": {
1355
+ "type": "ClientLoader",
1356
+ "description": null
1357
+ }
1358
+ }
1359
+ ],
1360
+ "examples": [],
1361
+ "see": [],
1362
+ "references": [
1363
+ "ClientLoader",
1364
+ "ClientLoaderOptions"
1365
+ ]
1366
+ },
1367
+ {
1368
+ "name": "ClientLoader",
1369
+ "kind": "interface",
1370
+ "stability": "experimental",
1371
+ "deprecated": null,
1372
+ "summary": "Loads and caches client metadata, with limits on fetches at once.",
1373
+ "description": "",
1374
+ "members": [
1375
+ {
1376
+ "name": "load",
1377
+ "type": "(clientId: string): Promise<ClientMetadata>",
1378
+ "required": true,
1379
+ "default": null,
1380
+ "description": "The client, from the cache or fetched. Throws ClientError.",
1381
+ "stability": "stable",
1382
+ "deprecated": null
1383
+ }
1384
+ ],
1385
+ "examples": [],
1386
+ "see": [],
1387
+ "references": [
1388
+ "ClientMetadata"
1389
+ ]
1390
+ },
1391
+ {
1392
+ "name": "ClientLoaderOptions",
1393
+ "kind": "interface",
1394
+ "stability": "experimental",
1395
+ "deprecated": null,
1396
+ "summary": "What clientLoader() takes.",
1397
+ "description": "",
1398
+ "members": [
1399
+ {
1400
+ "name": "fetch",
1401
+ "type": "MetadataFetch",
1402
+ "required": true,
1403
+ "default": null,
1404
+ "description": "How metadata documents are fetched.",
1405
+ "stability": "stable",
1406
+ "deprecated": null
1407
+ },
1408
+ {
1409
+ "name": "maxEntries",
1410
+ "type": "number",
1411
+ "required": false,
1412
+ "default": null,
1413
+ "description": "Cached clients and failures, at most. Default 1000.",
1414
+ "stability": "stable",
1415
+ "deprecated": null
1416
+ },
1417
+ {
1418
+ "name": "concurrency",
1419
+ "type": "number",
1420
+ "required": false,
1421
+ "default": null,
1422
+ "description": "Fetches running at once, in all. Default 8.",
1423
+ "stability": "stable",
1424
+ "deprecated": null
1425
+ },
1426
+ {
1427
+ "name": "perHost",
1428
+ "type": "number",
1429
+ "required": false,
1430
+ "default": null,
1431
+ "description": "Fetches running at once to one host. Default 2.",
1432
+ "stability": "stable",
1433
+ "deprecated": null
1434
+ }
1435
+ ],
1436
+ "examples": [],
1437
+ "see": [],
1438
+ "references": [
1439
+ "MetadataFetch"
1440
+ ]
1441
+ },
1442
+ {
1443
+ "name": "ClientMetadata",
1444
+ "kind": "interface",
1445
+ "stability": "experimental",
1446
+ "deprecated": null,
1447
+ "summary": "An OAuth client, from its Client ID Metadata Document.",
1448
+ "description": "",
1449
+ "members": [
1450
+ {
1451
+ "name": "clientId",
1452
+ "type": "string",
1453
+ "required": true,
1454
+ "default": null,
1455
+ "description": "The client's id: the URL of its metadata document.",
1456
+ "stability": "stable",
1457
+ "deprecated": null
1458
+ },
1459
+ {
1460
+ "name": "name",
1461
+ "type": "string",
1462
+ "required": true,
1463
+ "default": null,
1464
+ "description": "What the client calls itself. Untrusted text: show it escaped, never as the client's identity.",
1465
+ "stability": "stable",
1466
+ "deprecated": null
1467
+ },
1468
+ {
1469
+ "name": "redirectUris",
1470
+ "type": "string[]",
1471
+ "required": true,
1472
+ "default": null,
1473
+ "description": "Where codes may be sent, as the document lists them.",
1474
+ "stability": "stable",
1475
+ "deprecated": null
1476
+ }
1477
+ ],
1478
+ "examples": [],
1479
+ "see": [],
1480
+ "references": []
1481
+ },
1482
+ {
1483
+ "name": "CodeDetails",
1484
+ "kind": "interface",
1485
+ "stability": "experimental",
1486
+ "deprecated": null,
1487
+ "summary": "What a code was issued for, checked again at the token endpoint.",
1488
+ "description": "",
1489
+ "members": [
1490
+ {
1491
+ "name": "redirectUri",
1492
+ "type": "string",
1493
+ "required": true,
1494
+ "default": null,
1495
+ "description": "The redirect URI the code was sent to; the token request must name the same one.",
1496
+ "stability": "stable",
1497
+ "deprecated": null
1498
+ },
1499
+ {
1500
+ "name": "codeChallenge",
1501
+ "type": "string",
1502
+ "required": true,
1503
+ "default": null,
1504
+ "description": "The PKCE challenge the token request's verifier must match.",
1505
+ "stability": "stable",
1506
+ "deprecated": null
1507
+ },
1508
+ {
1509
+ "name": "resource",
1510
+ "type": "string",
1511
+ "required": true,
1512
+ "default": null,
1513
+ "description": "The resource (the MCP endpoint's URL) the token is for.",
1514
+ "stability": "stable",
1515
+ "deprecated": null
1516
+ }
1517
+ ],
1518
+ "examples": [],
1519
+ "see": [],
1520
+ "references": []
1521
+ },
1522
+ {
1523
+ "name": "hashSecret",
1524
+ "kind": "function",
1525
+ "stability": "experimental",
1526
+ "deprecated": null,
1527
+ "summary": "The secret a client holds, as stored: hex SHA-256.",
1528
+ "description": "",
1529
+ "signatures": [
1530
+ {
1531
+ "text": "hashSecret(secret: string): Promise<string>",
1532
+ "parameters": [
1533
+ {
1534
+ "name": "secret",
1535
+ "type": "string",
1536
+ "required": true,
1537
+ "default": null,
1538
+ "description": "The code or token.",
1539
+ "stability": "stable",
1540
+ "deprecated": null
1541
+ }
1542
+ ],
1543
+ "returns": {
1544
+ "type": "Promise<string>",
1545
+ "description": null
1546
+ }
1547
+ }
1548
+ ],
1549
+ "examples": [],
1550
+ "see": [],
1551
+ "references": []
1552
+ },
1553
+ {
1554
+ "name": "isLoopback",
1555
+ "kind": "constant",
1556
+ "stability": "experimental",
1557
+ "deprecated": null,
1558
+ "summary": "Whether a URL is http on a loopback address: an app on the person's own computer.",
1559
+ "description": "",
1560
+ "type": "(url: URL) => boolean",
1561
+ "examples": [],
1562
+ "see": [],
1563
+ "references": []
1564
+ },
1565
+ {
1566
+ "name": "memoryOAuthStore",
1567
+ "kind": "function",
1568
+ "stability": "experimental",
1569
+ "deprecated": null,
1570
+ "summary": "Keeps grants in memory: for development and single-server sites.",
1571
+ "description": "Single\nuse is per process, so with several servers use oauthStore(db) from",
1572
+ "signatures": [
1573
+ {
1574
+ "text": "memoryOAuthStore(options?: {\n maxGrants?: number;\n}): OAuthStore",
1575
+ "parameters": [
1576
+ {
1577
+ "name": "options",
1578
+ "type": "{\n maxGrants?: number;\n}",
1579
+ "required": false,
1580
+ "default": null,
1581
+ "description": "How many grants to keep at most.",
1582
+ "stability": "stable",
1583
+ "deprecated": null,
1584
+ "members": [
1585
+ {
1586
+ "name": "maxGrants",
1587
+ "type": "number",
1588
+ "required": false,
1589
+ "default": "10000",
1590
+ "description": "The most grants kept.",
1591
+ "stability": "stable",
1592
+ "deprecated": null
1593
+ }
1594
+ ]
1595
+ }
1596
+ ],
1597
+ "returns": {
1598
+ "type": "OAuthStore",
1599
+ "description": null
1600
+ }
1601
+ }
1602
+ ],
1603
+ "examples": [],
1604
+ "see": [],
1605
+ "references": [
1606
+ "OAuthStore"
1607
+ ]
1608
+ },
1609
+ {
1610
+ "name": "MetadataFetch",
1611
+ "kind": "type",
1612
+ "stability": "experimental",
1613
+ "deprecated": null,
1614
+ "summary": "Fetches a metadata URL.",
1615
+ "description": "Must not follow redirects, and must stop at maxBytes\nand when the signal aborts. publicFetch from @pexis/node/public-fetch also\nrefuses names that resolve to non-public addresses; the default (web fetch)\ncannot see addresses, so it is accepted only for clients the app lists.",
1616
+ "type": "(url: URL, options: {\n signal: AbortSignal;\n maxBytes: number;\n}) => Promise<MetadataResponse>",
1617
+ "examples": [],
1618
+ "see": [],
1619
+ "references": [
1620
+ "MetadataResponse"
1621
+ ]
1622
+ },
1623
+ {
1624
+ "name": "MetadataResponse",
1625
+ "kind": "interface",
1626
+ "stability": "experimental",
1627
+ "deprecated": null,
1628
+ "summary": "What the loader's fetch returns.",
1629
+ "description": "",
1630
+ "members": [
1631
+ {
1632
+ "name": "status",
1633
+ "type": "number",
1634
+ "required": true,
1635
+ "default": null,
1636
+ "description": "The HTTP status.",
1637
+ "stability": "stable",
1638
+ "deprecated": null
1639
+ },
1640
+ {
1641
+ "name": "headers",
1642
+ "type": "Headers",
1643
+ "required": true,
1644
+ "default": null,
1645
+ "description": "The response headers.",
1646
+ "stability": "stable",
1647
+ "deprecated": null
1648
+ },
1649
+ {
1650
+ "name": "body",
1651
+ "type": "Uint8Array",
1652
+ "required": true,
1653
+ "default": null,
1654
+ "description": "The body, at most maxBytes.",
1655
+ "stability": "stable",
1656
+ "deprecated": null
1657
+ }
1658
+ ],
1659
+ "examples": [],
1660
+ "see": [],
1661
+ "references": []
1662
+ },
1663
+ {
1664
+ "name": "newSecret",
1665
+ "kind": "function",
1666
+ "stability": "experimental",
1667
+ "deprecated": null,
1668
+ "summary": "A new secret: 256 random bits, base64url.",
1669
+ "description": "",
1670
+ "signatures": [
1671
+ {
1672
+ "text": "newSecret(): string",
1673
+ "parameters": [],
1674
+ "returns": {
1675
+ "type": "string",
1676
+ "description": null
1677
+ }
1678
+ }
1679
+ ],
1680
+ "examples": [],
1681
+ "see": [],
1682
+ "references": []
1683
+ },
1684
+ {
1685
+ "name": "OAuthGrant",
1686
+ "kind": "interface",
1687
+ "stability": "experimental",
1688
+ "deprecated": null,
1689
+ "summary": "A person allowed a client to act for them.",
1690
+ "description": "",
1691
+ "members": [
1692
+ {
1693
+ "name": "id",
1694
+ "type": "string",
1695
+ "required": true,
1696
+ "default": null,
1697
+ "description": "The grant's id.",
1698
+ "stability": "stable",
1699
+ "deprecated": null
1700
+ },
1701
+ {
1702
+ "name": "userId",
1703
+ "type": "string",
1704
+ "required": true,
1705
+ "default": null,
1706
+ "description": "The person who allowed it.",
1707
+ "stability": "stable",
1708
+ "deprecated": null
1709
+ },
1710
+ {
1711
+ "name": "clientId",
1712
+ "type": "string",
1713
+ "required": true,
1714
+ "default": null,
1715
+ "description": "The client's metadata URL.",
1716
+ "stability": "stable",
1717
+ "deprecated": null
1718
+ },
1719
+ {
1720
+ "name": "clientName",
1721
+ "type": "string",
1722
+ "required": true,
1723
+ "default": null,
1724
+ "description": "What the client calls itself, as it said at consent. Untrusted text.",
1725
+ "stability": "stable",
1726
+ "deprecated": null
1727
+ },
1728
+ {
1729
+ "name": "redirectHost",
1730
+ "type": "string",
1731
+ "required": true,
1732
+ "default": null,
1733
+ "description": "Where the code was sent, shown on the connected-apps page.",
1734
+ "stability": "stable",
1735
+ "deprecated": null
1736
+ },
1737
+ {
1738
+ "name": "scopes",
1739
+ "type": "string[]",
1740
+ "required": true,
1741
+ "default": null,
1742
+ "description": "What the person allowed: \"actions:read\", and \"actions:write\" for changes.",
1743
+ "stability": "stable",
1744
+ "deprecated": null
1745
+ },
1746
+ {
1747
+ "name": "createdAt",
1748
+ "type": "number",
1749
+ "required": true,
1750
+ "default": null,
1751
+ "description": "When the person allowed it, in ms since the epoch.",
1752
+ "stability": "stable",
1753
+ "deprecated": null
1754
+ },
1755
+ {
1756
+ "name": "expiresAt",
1757
+ "type": "number",
1758
+ "required": true,
1759
+ "default": null,
1760
+ "description": "The grant ends then, however often it is refreshed.",
1761
+ "stability": "stable",
1762
+ "deprecated": null
1763
+ },
1764
+ {
1765
+ "name": "lastUsedAt",
1766
+ "type": "number | null",
1767
+ "required": true,
1768
+ "default": null,
1769
+ "description": "When a token from it was last used, or null.",
1770
+ "stability": "stable",
1771
+ "deprecated": null
1772
+ },
1773
+ {
1774
+ "name": "revokedAt",
1775
+ "type": "number | null",
1776
+ "required": true,
1777
+ "default": null,
1778
+ "description": "When the person or the server revoked it, or null.",
1779
+ "stability": "stable",
1780
+ "deprecated": null
1781
+ }
1782
+ ],
1783
+ "examples": [],
1784
+ "see": [],
1785
+ "references": []
1786
+ },
1787
+ {
1788
+ "name": "oauthServer",
1789
+ "kind": "function",
1790
+ "stability": "experimental",
1791
+ "deprecated": null,
1792
+ "summary": "Lets MCP clients sign in as a person with OAuth 2.1, so they can call actions that need a permission.",
1793
+ "description": "Needs sessions() and auth().",
1794
+ "signatures": [
1795
+ {
1796
+ "text": "oauthServer(options: OAuthServerOptions): Plugin",
1797
+ "parameters": [
1798
+ {
1799
+ "name": "options",
1800
+ "type": "OAuthServerOptions",
1801
+ "required": true,
1802
+ "default": null,
1803
+ "description": "How users are loaded, which clients may sign in, and where grants are kept.",
1804
+ "stability": "stable",
1805
+ "deprecated": null
1806
+ }
1807
+ ],
1808
+ "returns": {
1809
+ "type": "Plugin",
1810
+ "description": null
1811
+ }
1812
+ }
1813
+ ],
1814
+ "examples": [
1815
+ {
1816
+ "code": "oauthServer({ loadUser: (id) => findUser(db, id), clients: ['https://claude.ai/oauth/mcp-client'], store: oauthStore(db) })"
1817
+ }
1818
+ ],
1819
+ "see": [],
1820
+ "references": [
1821
+ "OAuthServerOptions",
1822
+ "Plugin"
1823
+ ]
1824
+ },
1825
+ {
1826
+ "name": "OAuthServerOptions",
1827
+ "kind": "interface",
1828
+ "stability": "experimental",
1829
+ "deprecated": null,
1830
+ "summary": "What oauthServer() takes.",
1831
+ "description": "",
1832
+ "members": [
1833
+ {
1834
+ "name": "loadUser",
1835
+ "type": "(id: string) => User | null | Promise<User | null>",
1836
+ "required": true,
1837
+ "default": null,
1838
+ "description": "The person a grant acts for, looked up again on every request (cached for\na minute), so a banned, deleted or demoted account loses its agents at\nonce. Return null to revoke the grant.",
1839
+ "stability": "stable",
1840
+ "deprecated": null
1841
+ },
1842
+ {
1843
+ "name": "clients",
1844
+ "type": "readonly string[] | 'any'",
1845
+ "required": true,
1846
+ "default": null,
1847
+ "description": "Which clients may sign in: exact client_id URLs, or host names. 'any'\nallows every public https client_id, and needs fetchMetadata from",
1848
+ "stability": "stable",
1849
+ "deprecated": null
1850
+ },
1851
+ {
1852
+ "name": "fetchMetadata",
1853
+ "type": "MetadataFetch",
1854
+ "required": false,
1855
+ "default": null,
1856
+ "description": "How client metadata is fetched. Default: web fetch, allowed only with a list of clients.",
1857
+ "stability": "stable",
1858
+ "deprecated": null
1859
+ },
1860
+ {
1861
+ "name": "store",
1862
+ "type": "OAuthStore",
1863
+ "required": false,
1864
+ "default": null,
1865
+ "description": "Where grants and tokens are kept. Default: memoryOAuthStore(), one server only; use oauthStore(db) from @pexis/data.",
1866
+ "stability": "stable",
1867
+ "deprecated": null
1868
+ },
1869
+ {
1870
+ "name": "grantDays",
1871
+ "type": "number",
1872
+ "required": false,
1873
+ "default": null,
1874
+ "description": "Days a grant lasts at most. Default 30; loopback clients (apps on the person's computer) get at most 7.",
1875
+ "stability": "stable",
1876
+ "deprecated": null
1877
+ },
1878
+ {
1879
+ "name": "connectedAppsPath",
1880
+ "type": "string",
1881
+ "required": false,
1882
+ "default": null,
1883
+ "description": "The connected-apps page. Default \"/account/connected-apps\".",
1884
+ "stability": "stable",
1885
+ "deprecated": null
1886
+ },
1887
+ {
1888
+ "name": "resourcePath",
1889
+ "type": "string",
1890
+ "required": false,
1891
+ "default": null,
1892
+ "description": "The MCP endpoint the tokens are for. Default \"/pexis/mcp\".",
1893
+ "stability": "stable",
1894
+ "deprecated": null
1895
+ }
1896
+ ],
1897
+ "examples": [],
1898
+ "see": [],
1899
+ "references": [
1900
+ "MetadataFetch",
1901
+ "OAuthStore",
1902
+ "User"
1903
+ ]
1904
+ },
1905
+ {
1906
+ "name": "OAuthStore",
1907
+ "kind": "interface",
1908
+ "stability": "experimental",
1909
+ "deprecated": null,
1910
+ "summary": "Where the OAuth server keeps grants, codes and tokens.",
1911
+ "description": "memoryOAuthStore()\nis for one server; oauthStore(db) from @pexis/data shares them.",
1912
+ "members": [
1913
+ {
1914
+ "name": "createGrant",
1915
+ "type": "(grant: OAuthGrant, code: StoredSecret): Promise<void>",
1916
+ "required": true,
1917
+ "default": null,
1918
+ "description": "A new grant and its code, at consent.",
1919
+ "stability": "stable",
1920
+ "deprecated": null
1921
+ },
1922
+ {
1923
+ "name": "getGrant",
1924
+ "type": "(id: string): Promise<OAuthGrant | undefined>",
1925
+ "required": true,
1926
+ "default": null,
1927
+ "description": "The grant with this id, or undefined.",
1928
+ "stability": "stable",
1929
+ "deprecated": null
1930
+ },
1931
+ {
1932
+ "name": "use",
1933
+ "type": "(hash: string, kind: 'code' | 'refresh', now: number): Promise<Use>",
1934
+ "required": true,
1935
+ "default": null,
1936
+ "description": "Uses a code or refresh token once. Atomic: of two callers, one gets ok.",
1937
+ "stability": "stable",
1938
+ "deprecated": null
1939
+ },
1940
+ {
1941
+ "name": "burn",
1942
+ "type": "(hash: string, now: number): Promise<void>",
1943
+ "required": true,
1944
+ "default": null,
1945
+ "description": "Marks a code as used without issuing anything, after a wrong code_verifier.",
1946
+ "stability": "stable",
1947
+ "deprecated": null
1948
+ },
1949
+ {
1950
+ "name": "issue",
1951
+ "type": "(secrets: StoredSecret[]): Promise<void>",
1952
+ "required": true,
1953
+ "default": null,
1954
+ "description": "New access and refresh tokens for a grant.",
1955
+ "stability": "stable",
1956
+ "deprecated": null
1957
+ },
1958
+ {
1959
+ "name": "lookup",
1960
+ "type": "(hash: string): Promise<StoredSecret | undefined>",
1961
+ "required": true,
1962
+ "default": null,
1963
+ "description": "Any code or token by hash, used or not, for revocation.",
1964
+ "stability": "stable",
1965
+ "deprecated": null
1966
+ },
1967
+ {
1968
+ "name": "access",
1969
+ "type": "(hash: string, now: number): Promise<StoredSecret | undefined>",
1970
+ "required": true,
1971
+ "default": null,
1972
+ "description": "An access token, if it exists and has not expired; its grant must still be checked.",
1973
+ "stability": "stable",
1974
+ "deprecated": null
1975
+ },
1976
+ {
1977
+ "name": "revoke",
1978
+ "type": "(grantId: string, now: number): Promise<void>",
1979
+ "required": true,
1980
+ "default": null,
1981
+ "description": "Ends a grant and deletes its tokens. Codes stay, so a reused code is still recognized.",
1982
+ "stability": "stable",
1983
+ "deprecated": null
1984
+ },
1985
+ {
1986
+ "name": "touch",
1987
+ "type": "(grantId: string, now: number): Promise<void>",
1988
+ "required": true,
1989
+ "default": null,
1990
+ "description": "Records when the grant was last used, at most once a minute.",
1991
+ "stability": "stable",
1992
+ "deprecated": null
1993
+ },
1994
+ {
1995
+ "name": "grantsOf",
1996
+ "type": "(userId: string, now: number): Promise<OAuthGrant[]>",
1997
+ "required": true,
1998
+ "default": null,
1999
+ "description": "A person's live grants, newest first, for the connected-apps page.",
2000
+ "stability": "stable",
2001
+ "deprecated": null
2002
+ },
2003
+ {
2004
+ "name": "recent",
2005
+ "type": "(limit: number, now: number): Promise<OAuthGrant[]>",
2006
+ "required": true,
2007
+ "default": null,
2008
+ "description": "Live grants, newest first, for the admin.",
2009
+ "stability": "stable",
2010
+ "deprecated": null
2011
+ }
2012
+ ],
2013
+ "examples": [],
2014
+ "see": [],
2015
+ "references": [
2016
+ "OAuthGrant",
2017
+ "StoredSecret",
2018
+ "Use"
2019
+ ]
2020
+ },
2021
+ {
2022
+ "name": "redirectAllowed",
2023
+ "kind": "function",
2024
+ "stability": "experimental",
2025
+ "deprecated": null,
2026
+ "summary": "Whether a requested redirect URI is one the client listed: exact, except the port of a loopback URI (RFC 8252 §7.3).",
2027
+ "description": "",
2028
+ "signatures": [
2029
+ {
2030
+ "text": "redirectAllowed(client: ClientMetadata, requested: string): boolean",
2031
+ "parameters": [
2032
+ {
2033
+ "name": "client",
2034
+ "type": "ClientMetadata",
2035
+ "required": true,
2036
+ "default": null,
2037
+ "description": "The client.",
2038
+ "stability": "stable",
2039
+ "deprecated": null
2040
+ },
2041
+ {
2042
+ "name": "requested",
2043
+ "type": "string",
2044
+ "required": true,
2045
+ "default": null,
2046
+ "description": "The redirect URI in the request.",
2047
+ "stability": "stable",
2048
+ "deprecated": null
2049
+ }
2050
+ ],
2051
+ "returns": {
2052
+ "type": "boolean",
2053
+ "description": null
2054
+ }
2055
+ }
2056
+ ],
2057
+ "examples": [],
2058
+ "see": [],
2059
+ "references": [
2060
+ "ClientMetadata"
2061
+ ]
2062
+ },
2063
+ {
2064
+ "name": "SCOPES",
2065
+ "kind": "constant",
2066
+ "stability": "experimental",
2067
+ "deprecated": null,
2068
+ "summary": "The scopes a person can grant a client: \"actions:read\" to look things up, \"actions:write\" to make changes (which includes reading).",
2069
+ "description": "",
2070
+ "type": "readonly ['actions:read', 'actions:write']",
2071
+ "examples": [],
2072
+ "see": [],
2073
+ "references": []
2074
+ },
2075
+ {
2076
+ "name": "SecretKind",
2077
+ "kind": "type",
2078
+ "stability": "experimental",
2079
+ "deprecated": null,
2080
+ "summary": "Which kind of secret: an authorization code, an access token or a refresh token.",
2081
+ "description": "",
2082
+ "type": "'code' | 'access' | 'refresh'",
2083
+ "examples": [],
2084
+ "see": [],
2085
+ "references": []
2086
+ },
2087
+ {
2088
+ "name": "StoredSecret",
2089
+ "kind": "interface",
2090
+ "stability": "experimental",
2091
+ "deprecated": null,
2092
+ "summary": "A code or token as stored: only its hash, never the secret itself.",
2093
+ "description": "",
2094
+ "members": [
2095
+ {
2096
+ "name": "hash",
2097
+ "type": "string",
2098
+ "required": true,
2099
+ "default": null,
2100
+ "description": "The secret's SHA-256 hash, as hex.",
2101
+ "stability": "stable",
2102
+ "deprecated": null
2103
+ },
2104
+ {
2105
+ "name": "grantId",
2106
+ "type": "string",
2107
+ "required": true,
2108
+ "default": null,
2109
+ "description": "The grant it belongs to.",
2110
+ "stability": "stable",
2111
+ "deprecated": null
2112
+ },
2113
+ {
2114
+ "name": "kind",
2115
+ "type": "SecretKind",
2116
+ "required": true,
2117
+ "default": null,
2118
+ "description": "What kind of secret it is.",
2119
+ "stability": "stable",
2120
+ "deprecated": null
2121
+ },
2122
+ {
2123
+ "name": "expiresAt",
2124
+ "type": "number",
2125
+ "required": true,
2126
+ "default": null,
2127
+ "description": "It may be used until then.",
2128
+ "stability": "stable",
2129
+ "deprecated": null
2130
+ },
2131
+ {
2132
+ "name": "usedAt",
2133
+ "type": "number | null",
2134
+ "required": true,
2135
+ "default": null,
2136
+ "description": "When a code or refresh token was used, or null; each is used once.",
2137
+ "stability": "stable",
2138
+ "deprecated": null
2139
+ },
2140
+ {
2141
+ "name": "details",
2142
+ "type": "CodeDetails",
2143
+ "required": false,
2144
+ "default": null,
2145
+ "description": "For codes.",
2146
+ "stability": "stable",
2147
+ "deprecated": null
2148
+ }
2149
+ ],
2150
+ "examples": [],
2151
+ "see": [],
2152
+ "references": [
2153
+ "CodeDetails",
2154
+ "SecretKind"
2155
+ ]
2156
+ },
2157
+ {
2158
+ "name": "Use",
2159
+ "kind": "type",
2160
+ "stability": "experimental",
2161
+ "deprecated": null,
2162
+ "summary": "The result of using a code or refresh token.",
2163
+ "description": "",
2164
+ "type": "{\n ok: true;\n secret: StoredSecret;\n} | {\n ok: false;\n reason: 'unknown' | 'expired';\n} | {\n ok: false;\n reason: 'reused';\n grantId: string;\n}",
2165
+ "examples": [],
2166
+ "see": [],
2167
+ "references": [
2168
+ "StoredSecret"
2169
+ ]
2170
+ },
2171
+ {
2172
+ "name": "webMetadataFetch",
2173
+ "kind": "constant",
2174
+ "stability": "experimental",
2175
+ "deprecated": null,
2176
+ "summary": "Web fetch, for clients the app lists by name.",
2177
+ "description": "No redirects, a byte limit counted after decompression.",
2178
+ "type": "MetadataFetch",
2179
+ "examples": [],
2180
+ "see": [],
2181
+ "references": [
2182
+ "MetadataFetch"
2183
+ ]
2184
+ }
2185
+ ]
2186
+ }
2187
+ ]
2188
+ }