@spfn/auth 0.3.0-beta.27 → 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,
@@ -615,6 +672,13 @@ var routeMap = {
615
672
  getDeviceAuthInfo: { method: "POST", path: "/_auth/device/info" },
616
673
  approveDeviceAuth: { method: "POST", path: "/_auth/device/approve" },
617
674
  denyDeviceAuth: { method: "POST", path: "/_auth/device/deny" },
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" },
618
682
  passkeyRegisterOptions: { method: "POST", path: "/_auth/passkeys/register/options" },
619
683
  passkeyRegisterVerify: { method: "POST", path: "/_auth/passkeys/register/verify" },
620
684
  passkeyLoginOptions: { method: "POST", path: "/_auth/passkeys/login/options" },
@@ -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"),