@spfn/auth 0.3.0-beta.26 → 0.3.0-beta.28

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.js CHANGED
@@ -191,6 +191,57 @@ var DeviceAuthDeniedError = class extends ForbiddenError {
191
191
  this.name = "DeviceAuthDeniedError";
192
192
  }
193
193
  };
194
+ var DeviceLinkNotFoundError = class extends NotFoundError {
195
+ constructor(data = {}) {
196
+ super({ message: data.message || "Device link not found", details: data.details });
197
+ this.name = "DeviceLinkNotFoundError";
198
+ }
199
+ };
200
+ var DeviceLinkExpiredError = class extends ValidationError {
201
+ constructor(data = {}) {
202
+ super({
203
+ message: data.message || "This link code has expired. Show a new code on the signed-in device.",
204
+ details: data.details
205
+ });
206
+ this.name = "DeviceLinkExpiredError";
207
+ }
208
+ };
209
+ var DeviceLinkNotRedeemedError = class extends ConflictError {
210
+ constructor(data = {}) {
211
+ super({
212
+ message: data.message || "No device has used this link code yet",
213
+ details: data.details
214
+ });
215
+ this.name = "DeviceLinkNotRedeemedError";
216
+ }
217
+ };
218
+ var DeviceLinkAlreadyHandledError = class extends ConflictError {
219
+ constructor(data = {}) {
220
+ super({
221
+ message: data.message || "This device link has already been answered",
222
+ details: data.details
223
+ });
224
+ this.name = "DeviceLinkAlreadyHandledError";
225
+ }
226
+ };
227
+ var DeviceLinkWrongMatchError = class extends ValidationError {
228
+ constructor(data = {}) {
229
+ super({
230
+ message: data.message || "That is not the number on the new device. The link was refused; show a new code to try again.",
231
+ details: data.details
232
+ });
233
+ this.name = "DeviceLinkWrongMatchError";
234
+ }
235
+ };
236
+ var DeviceLinkDeniedError = class extends ForbiddenError {
237
+ constructor(data = {}) {
238
+ super({
239
+ message: data.message || "This device link was denied",
240
+ details: data.details
241
+ });
242
+ this.name = "DeviceLinkDeniedError";
243
+ }
244
+ };
194
245
  var NonceKeyBindingError = class extends ValidationError {
195
246
  constructor(data = {}) {
196
247
  super({
@@ -569,6 +620,12 @@ authErrorRegistry.append([
569
620
  DeviceAuthExpiredError,
570
621
  DeviceAuthAlreadyHandledError,
571
622
  DeviceAuthDeniedError,
623
+ DeviceLinkNotFoundError,
624
+ DeviceLinkExpiredError,
625
+ DeviceLinkNotRedeemedError,
626
+ DeviceLinkAlreadyHandledError,
627
+ DeviceLinkWrongMatchError,
628
+ DeviceLinkDeniedError,
572
629
  VerificationTokenPurposeMismatchError,
573
630
  VerificationTokenTargetMismatchError,
574
631
  InsufficientPermissionsError,
@@ -606,59 +663,56 @@ var routeMap = {
606
663
  requestSignupLink: { method: "POST", path: "/_auth/signup/email" },
607
664
  confirmSignupLink: { method: "POST", path: "/_auth/signup/email/confirm" },
608
665
  completeSignup: { method: "POST", path: "/_auth/signup/password" },
666
+ requestPasswordReset: { method: "POST", path: "/_auth/password/reset" },
667
+ confirmPasswordReset: { method: "POST", path: "/_auth/password/reset/confirm" },
668
+ completePasswordReset: { method: "POST", path: "/_auth/password/reset/complete" },
609
669
  login: { method: "POST", path: "/_auth/login" },
610
670
  startDeviceAuth: { method: "POST", path: "/_auth/device/start" },
611
671
  pollDeviceAuth: { method: "POST", path: "/_auth/device/poll" },
612
672
  getDeviceAuthInfo: { method: "POST", path: "/_auth/device/info" },
613
673
  approveDeviceAuth: { method: "POST", path: "/_auth/device/approve" },
614
674
  denyDeviceAuth: { method: "POST", path: "/_auth/device/deny" },
615
- logout: { method: "POST", path: "/_auth/logout" },
616
- rotateKey: { method: "POST", path: "/_auth/keys/rotate" },
617
- listKeys: { method: "POST", path: "/_auth/keys/list" },
618
- revokeKey: { method: "POST", path: "/_auth/keys/revoke" },
619
- revokeAllKeys: { method: "POST", path: "/_auth/keys/revoke-all" },
620
- changePassword: { method: "PUT", path: "/_auth/password" },
621
- getAuthSession: { method: "GET", path: "/_auth/session" },
622
- issueOneTimeToken: { method: "POST", path: "/_auth/tokens" },
623
- requestPasswordReset: { method: "POST", path: "/_auth/password/reset" },
624
- confirmPasswordReset: { method: "POST", path: "/_auth/password/reset/confirm" },
625
- completePasswordReset: { method: "POST", path: "/_auth/password/reset/complete" },
626
- confirmRevokeAllLink: { method: "POST", path: "/_auth/keys/revoke-all/confirm" },
627
- consumeRevokeAllLink: { method: "POST", path: "/_auth/keys/revoke-all/consume" },
675
+ issueDeviceLink: { method: "POST", path: "/_auth/device/link/issue" },
676
+ redeemDeviceLink: { method: "POST", path: "/_auth/device/link/redeem" },
677
+ getDeviceLinkStatus: { method: "POST", path: "/_auth/device/link/status" },
678
+ confirmDeviceLink: { method: "POST", path: "/_auth/device/link/confirm" },
679
+ denyDeviceLink: { method: "POST", path: "/_auth/device/link/deny" },
680
+ cancelDeviceLink: { method: "POST", path: "/_auth/device/link/cancel" },
681
+ pollDeviceLink: { method: "POST", path: "/_auth/device/link/poll" },
682
+ passkeyRegisterOptions: { method: "POST", path: "/_auth/passkeys/register/options" },
683
+ passkeyRegisterVerify: { method: "POST", path: "/_auth/passkeys/register/verify" },
684
+ passkeyLoginOptions: { method: "POST", path: "/_auth/passkeys/login/options" },
685
+ passkeyLoginVerify: { method: "POST", path: "/_auth/passkeys/login/verify" },
686
+ listPasskeys: { method: "POST", path: "/_auth/passkeys/list" },
687
+ renamePasskey: { method: "POST", path: "/_auth/passkeys/rename" },
688
+ revokePasskey: { method: "POST", path: "/_auth/passkeys/revoke" },
628
689
  mfaTotpEnroll: { method: "POST", path: "/_auth/mfa/totp/enroll" },
629
690
  mfaTotpConfirm: { method: "POST", path: "/_auth/mfa/totp/confirm" },
630
691
  mfaDisable: { method: "POST", path: "/_auth/mfa/disable" },
631
692
  mfaMarkPasskey: { method: "POST", path: "/_auth/mfa/passkey/mark" },
632
693
  mfaRegenerateRecoveryCodes: { method: "POST", path: "/_auth/mfa/recovery/regenerate" },
633
694
  mfaStatus: { method: "GET", path: "/_auth/mfa/status" },
634
- mfaVerify: { method: "POST", path: "/_auth/mfa/verify" },
635
- mfaVerifyOptions: { method: "POST", path: "/_auth/mfa/verify/options" },
636
695
  mfaStepUp: { method: "POST", path: "/_auth/mfa/step-up" },
637
696
  mfaStepUpOptions: { method: "POST", path: "/_auth/mfa/step-up/options" },
697
+ mfaVerify: { method: "POST", path: "/_auth/mfa/verify" },
698
+ mfaVerifyOptions: { method: "POST", path: "/_auth/mfa/verify/options" },
699
+ logout: { method: "POST", path: "/_auth/logout" },
700
+ rotateKey: { method: "POST", path: "/_auth/keys/rotate" },
701
+ listKeys: { method: "POST", path: "/_auth/keys/list" },
702
+ revokeKey: { method: "POST", path: "/_auth/keys/revoke" },
703
+ revokeAllKeys: { method: "POST", path: "/_auth/keys/revoke-all" },
704
+ confirmRevokeAllLink: { method: "POST", path: "/_auth/keys/revoke-all/confirm" },
705
+ consumeRevokeAllLink: { method: "POST", path: "/_auth/keys/revoke-all/consume" },
706
+ changePassword: { method: "PUT", path: "/_auth/password" },
707
+ getAuthSession: { method: "GET", path: "/_auth/session" },
638
708
  setSessionBinding: { method: "POST", path: "/_auth/session/binding" },
639
709
  getSessionBinding: { method: "GET", path: "/_auth/session/binding" },
640
710
  sessionBindingDisableOptions: { method: "POST", path: "/_auth/session/binding/disable/options" },
641
711
  sessionRenewOptions: { method: "POST", path: "/_auth/session/renew/options" },
642
712
  sessionRenewVerify: { method: "POST", path: "/_auth/session/renew/verify" },
643
- passkeyRegisterOptions: { method: "POST", path: "/_auth/passkeys/register/options" },
644
- passkeyRegisterVerify: { method: "POST", path: "/_auth/passkeys/register/verify" },
645
- passkeyLoginOptions: { method: "POST", path: "/_auth/passkeys/login/options" },
646
- passkeyLoginVerify: { method: "POST", path: "/_auth/passkeys/login/verify" },
647
- listPasskeys: { method: "POST", path: "/_auth/passkeys/list" },
648
- renamePasskey: { method: "POST", path: "/_auth/passkeys/rename" },
649
- revokePasskey: { method: "POST", path: "/_auth/passkeys/revoke" },
650
- getInvitation: { method: "GET", path: "/_auth/invitations/:token" },
651
- acceptInvitation: { method: "POST", path: "/_auth/invitations/accept" },
652
- createInvitation: { method: "POST", path: "/_auth/invitations" },
653
- listInvitations: { method: "GET", path: "/_auth/invitations" },
654
- cancelInvitation: { method: "POST", path: "/_auth/invitations/cancel" },
655
- resendInvitation: { method: "POST", path: "/_auth/invitations/resend" },
656
- deleteInvitation: { method: "POST", path: "/_auth/invitations/delete" },
657
- getUserProfile: { method: "GET", path: "/_auth/users/profile" },
658
- updateUserProfile: { method: "PATCH", path: "/_auth/users/profile" },
659
- checkUsername: { method: "GET", path: "/_auth/users/username/check" },
660
- updateUsername: { method: "PATCH", path: "/_auth/users/username" },
661
- updateLocale: { method: "PATCH", path: "/_auth/users/locale" },
713
+ issueOneTimeToken: { method: "POST", path: "/_auth/tokens" },
714
+ requestAccountDeletion: { method: "POST", path: "/_auth/deletion/request" },
715
+ cancelAccountDeletion: { method: "POST", path: "/_auth/deletion/cancel" },
662
716
  oauthGoogleStart: { method: "GET", path: "/_auth/oauth/google" },
663
717
  oauthGoogleCallback: { method: "GET", path: "/_auth/oauth/google/callback" },
664
718
  oauthStart: { method: "POST", path: "/_auth/oauth/start" },
@@ -671,24 +725,34 @@ var routeMap = {
671
725
  oauthNative: { method: "POST", path: "/_auth/oauth/:provider/native" },
672
726
  oauthUnlinkNotify: { method: "POST", path: "/_auth/oauth/:provider/unlink-notify" },
673
727
  oauthUnlinkNotifyGet: { method: "GET", path: "/_auth/oauth/:provider/unlink-notify" },
728
+ getInvitation: { method: "GET", path: "/_auth/invitations/:token" },
729
+ acceptInvitation: { method: "POST", path: "/_auth/invitations/accept" },
730
+ createInvitation: { method: "POST", path: "/_auth/invitations" },
731
+ listInvitations: { method: "GET", path: "/_auth/invitations" },
732
+ cancelInvitation: { method: "POST", path: "/_auth/invitations/cancel" },
733
+ resendInvitation: { method: "POST", path: "/_auth/invitations/resend" },
734
+ deleteInvitation: { method: "POST", path: "/_auth/invitations/delete" },
735
+ getUserProfile: { method: "GET", path: "/_auth/users/profile" },
736
+ updateUserProfile: { method: "PATCH", path: "/_auth/users/profile" },
737
+ checkUsername: { method: "GET", path: "/_auth/users/username/check" },
738
+ updateUsername: { method: "PATCH", path: "/_auth/users/username" },
739
+ updateLocale: { method: "PATCH", path: "/_auth/users/locale" },
674
740
  listRoles: { method: "GET", path: "/_auth/admin/roles" },
675
741
  createAdminRole: { method: "POST", path: "/_auth/admin/roles" },
676
742
  updateAdminRole: { method: "PATCH", path: "/_auth/admin/roles/:id" },
677
743
  deleteAdminRole: { method: "DELETE", path: "/_auth/admin/roles/:id" },
678
744
  updateUserRole: { method: "PATCH", path: "/_auth/admin/users/:userId/role" },
679
- requestAccountDeletion: { method: "POST", path: "/_auth/deletion/request" },
680
- cancelAccountDeletion: { method: "POST", path: "/_auth/deletion/cancel" },
681
745
  issueOpsToken: { method: "POST", path: "/_auth/ops-tokens" },
682
746
  listOpsTokens: { method: "GET", path: "/_auth/ops-tokens" },
683
747
  revokeOpsToken: { method: "DELETE", path: "/_auth/ops-tokens/:id" },
684
748
  registerOAuth2Client: { method: "POST", path: "/_auth/oauth2/register" },
685
- listOAuth2Grants: { method: "GET", path: "/_auth/oauth2/grants" },
686
- revokeOAuth2Grant: { method: "DELETE", path: "/_auth/oauth2/grants/:id" },
687
- oauth2AuthorizationServerMetadata: { method: "GET", path: "/.well-known/oauth-authorization-server" },
688
749
  getOAuth2Authorize: { method: "GET", path: "/_auth/oauth2/authorize" },
689
750
  createOAuth2AuthorizationCode: { method: "POST", path: "/_auth/oauth2/authorize" },
690
751
  oauth2Token: { method: "POST", path: "/_auth/oauth2/token" },
691
- oauth2Revoke: { method: "POST", path: "/_auth/oauth2/revoke" }
752
+ oauth2Revoke: { method: "POST", path: "/_auth/oauth2/revoke" },
753
+ listOAuth2Grants: { method: "GET", path: "/_auth/oauth2/grants" },
754
+ revokeOAuth2Grant: { method: "DELETE", path: "/_auth/oauth2/grants/:id" },
755
+ oauth2AuthorizationServerMetadata: { method: "GET", path: "/.well-known/oauth-authorization-server" }
692
756
  };
693
757
 
694
758
  // src/lib/types.ts
@@ -3480,6 +3544,16 @@ var UserCodeSchema = Type.String({
3480
3544
  maxLength: 16,
3481
3545
  description: "Device user code as displayed, e.g. WXYZ-2345. Dashes, spaces and case are ignored."
3482
3546
  });
3547
+ var LinkIdSchema = Type.String({
3548
+ minLength: 1,
3549
+ maxLength: 64,
3550
+ description: "Device link handle returned by /_auth/device/link/issue"
3551
+ });
3552
+ var MatchChoiceSchema = Type.Integer({
3553
+ minimum: 10,
3554
+ maximum: 99,
3555
+ description: "The number the issuer picked \u2014 the one the new device shows"
3556
+ });
3483
3557
  var DeviceAuthPollResponseSchema = Type.Union([
3484
3558
  Type.Object({
3485
3559
  status: Type.Literal("pending"),