@spfn/auth 0.3.0-beta.17 → 0.3.0-beta.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as _spfn_core_nextjs from '@spfn/core/nextjs';
2
- import { P as PermissionConfig, R as RoleConfig, m as mainAuthRouter, S as SendVerificationCodeResult, a as RegisterResult, b as RequestSignupLinkResult, C as ConfirmSignupLinkResult, c as RequestPasswordResetResult, d as ConfirmPasswordResetResult, L as LoginResult, e as StartDeviceAuthResult, D as DeviceAuthInfoResult, F as FinishPasskeyEnrollmentResult, f as PasskeySummary, g as RotateKeyResult, K as KeySummary, h as RevokeAllKeysResult, I as IssueOneTimeTokenResult, O as OAuthStartResult, i as OAuthNativeResult, U as UserProfile, j as ProfileInfo } from './machine-principals-nrpFSvvB.js';
3
- export { A as AuthInitOptions, k as AuthSession, l as PERMISSION_CATEGORIES, n as PermissionCategory, V as VERIFICATION_PURPOSES, o as VERIFICATION_TARGET_TYPES, p as VerificationPurpose, q as VerificationTargetType } from './machine-principals-nrpFSvvB.js';
2
+ import { P as PermissionConfig, R as RoleConfig, m as mainAuthRouter, S as SendVerificationCodeResult, a as RegisterResult, b as RequestSignupLinkResult, C as ConfirmSignupLinkResult, c as RequestPasswordResetResult, d as ConfirmPasswordResetResult, L as LoginResult, e as StartDeviceAuthResult, D as DeviceAuthInfoResult, F as FinishPasskeyEnrollmentResult, f as PasskeySummary, g as RotateKeyResult, K as KeySummary, h as RevokeAllKeysResult, I as IssueOneTimeTokenResult, O as OAuthStartResult, i as OAuthNativeResult, U as UserProfile, j as ProfileInfo, k as OAuth2ConsentView, l as OAuth2AuthorizationCodeIssued, n as OAuth2GrantSummary } from './machine-principals-BD4tnASp.js';
3
+ export { A as AuthInitOptions, o as AuthSession, p as PERMISSION_CATEGORIES, q as PermissionCategory, V as VERIFICATION_PURPOSES, r as VERIFICATION_TARGET_TYPES, s as VerificationPurpose, t as VerificationTargetType } from './machine-principals-BD4tnASp.js';
4
4
  import * as _simplewebauthn_server from '@simplewebauthn/server';
5
5
  import * as _spfn_core_route from '@spfn/core/route';
6
6
  import { HttpMethod } from '@spfn/core/route';
@@ -753,6 +753,43 @@ declare const authApi: _spfn_core_nextjs.Client<_spfn_core_route.Router<{
753
753
  createdAt: string | null;
754
754
  };
755
755
  }>;
756
+ registerOAuth2Client: _spfn_core_route.RouteDef<{}, {}, Response>;
757
+ getOAuth2Authorize: _spfn_core_route.RouteDef<{
758
+ query: _sinclair_typebox.TObject<{
759
+ client_id: _sinclair_typebox.TString;
760
+ redirect_uri: _sinclair_typebox.TString;
761
+ code_challenge: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
762
+ code_challenge_method: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
763
+ resource: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
764
+ scope: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
765
+ state: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
766
+ }>;
767
+ }, {}, OAuth2ConsentView>;
768
+ createOAuth2AuthorizationCode: _spfn_core_route.RouteDef<{
769
+ body: _sinclair_typebox.TObject<{
770
+ approve: _sinclair_typebox.TBoolean;
771
+ client_id: _sinclair_typebox.TString;
772
+ redirect_uri: _sinclair_typebox.TString;
773
+ code_challenge: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
774
+ code_challenge_method: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
775
+ resource: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
776
+ scope: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
777
+ state: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
778
+ }>;
779
+ }, {}, OAuth2AuthorizationCodeIssued>;
780
+ oauth2Token: _spfn_core_route.RouteDef<{}, {}, Response>;
781
+ oauth2Revoke: _spfn_core_route.RouteDef<{}, {}, Response>;
782
+ listOAuth2Grants: _spfn_core_route.RouteDef<{}, {}, {
783
+ grants: OAuth2GrantSummary[];
784
+ }>;
785
+ revokeOAuth2Grant: _spfn_core_route.RouteDef<{
786
+ params: _sinclair_typebox.TObject<{
787
+ id: _sinclair_typebox.TNumber;
788
+ }>;
789
+ }, {}, {
790
+ revoked: boolean;
791
+ }>;
792
+ oauth2AuthorizationServerMetadata: _spfn_core_route.RouteDef<{}, {}, Response>;
756
793
  }>>;
757
794
  type AuthRouter = typeof mainAuthRouter;
758
795
 
package/dist/index.js CHANGED
@@ -367,6 +367,44 @@ var PasskeyConfigError = class extends HttpError {
367
367
  this.name = "PasskeyConfigError";
368
368
  }
369
369
  };
370
+ var OAuth2UnknownClientError = class extends ValidationError {
371
+ constructor(data = {}) {
372
+ super({
373
+ message: data.message || "Unknown OAuth client",
374
+ details: { error: "unknown_client", ...data.details }
375
+ });
376
+ this.name = "OAuth2UnknownClientError";
377
+ }
378
+ };
379
+ var OAuth2RedirectUriMismatchError = class extends ValidationError {
380
+ constructor(data = {}) {
381
+ super({
382
+ message: data.message || "redirect_uri does not match a registered URI for this client",
383
+ details: { error: "redirect_uri_mismatch", ...data.details }
384
+ });
385
+ this.name = "OAuth2RedirectUriMismatchError";
386
+ }
387
+ };
388
+ var OAuth2AuthorizeRedirectError = class extends ValidationError {
389
+ constructor(data) {
390
+ super({
391
+ message: data.message || `OAuth authorize request refused: ${data.error}`,
392
+ details: {
393
+ error: data.error,
394
+ redirectUri: data.redirectUri,
395
+ state: data.state,
396
+ ...data.details
397
+ }
398
+ });
399
+ this.name = "OAuth2AuthorizeRedirectError";
400
+ }
401
+ };
402
+ var OAuth2GrantNotFoundError = class extends NotFoundError {
403
+ constructor(data = {}) {
404
+ super({ message: data.message || "No such connected application", details: data.details });
405
+ this.name = "OAuth2GrantNotFoundError";
406
+ }
407
+ };
370
408
 
371
409
  // src/errors/index.ts
372
410
  var authErrorRegistry = new ErrorRegistry();
@@ -412,7 +450,11 @@ authErrorRegistry.append([
412
450
  PasskeyAlreadyRegisteredError,
413
451
  RecentAuthenticationRequiredError,
414
452
  LastRecoveryCredentialError,
415
- PasskeyConfigError
453
+ PasskeyConfigError,
454
+ OAuth2UnknownClientError,
455
+ OAuth2RedirectUriMismatchError,
456
+ OAuth2AuthorizeRedirectError,
457
+ OAuth2GrantNotFoundError
416
458
  ]);
417
459
 
418
460
  // src/generated/route-map.ts