@seamless-auth/types 0.30.0 → 0.32.0

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.
@@ -107,8 +107,55 @@ export const AccountRecoveryStatusSchema = z.object({
107
107
  export type AccountRecoveryStatus = z.infer<typeof AccountRecoveryStatusSchema>;
108
108
 
109
109
  /**
110
- * `POST /recovery/cancel`. Either the token from the notice sent to the other
111
- * channels, or no body with an access session for the account.
110
+ * `POST /recovery/verify`. `deliveries` carries the "recovery opened" notices only for a
111
+ * credentialed caller that owns delivery and names their kinds in
112
+ * `x-seamless-auth-delivery-kinds`; each can hold a cancel link for the owner alone.
113
+ */
114
+ export const AccountRecoveryVerifyResponseSchema = AccountRecoveryStatusSchema.extend({
115
+ deliveries: z.array(AuthDeliverySchema).optional(),
116
+ });
117
+
118
+ export type AccountRecoveryVerifyResponse = z.infer<typeof AccountRecoveryVerifyResponseSchema>;
119
+
120
+ /** One open request, as `GET /recovery/requests` lists it for the signed-in owner. */
121
+ export const AccountRecoveryRequestSchema = AccountRecoveryStatusSchema.extend({
122
+ id: z.string().uuid(),
123
+ channel: AccountRecoveryChannelSchema,
124
+ });
125
+
126
+ export type AccountRecoveryRequest = z.infer<typeof AccountRecoveryRequestSchema>;
127
+
128
+ export const AccountRecoveryRequestsResponseSchema = z.object({
129
+ requests: z.array(AccountRecoveryRequestSchema),
130
+ });
131
+
132
+ export type AccountRecoveryRequestsResponse = z.infer<typeof AccountRecoveryRequestsResponseSchema>;
133
+
134
+ /** `DELETE /recovery/requests/:id`. */
135
+ export const AccountRecoveryRequestIdParamSchema = z.object({ id: z.string().uuid() });
136
+
137
+ export type AccountRecoveryRequestIdParam = z.infer<typeof AccountRecoveryRequestIdParamSchema>;
138
+
139
+ /**
140
+ * The `error` values the recovery code and account recovery routes answer with, so a
141
+ * client can tell them apart without matching strings of its own.
142
+ */
143
+ export const RecoveryErrorCodeSchema = z.enum([
144
+ 'invalid_recovery_code',
145
+ 'recovery_codes_disabled',
146
+ 'cancel_token_required',
147
+ 'recovery_notice_failed',
148
+ 'account_recovery_disabled',
149
+ 'recovery_not_found',
150
+ 'recovery_not_ready',
151
+ 'enrollment_required',
152
+ ]);
153
+
154
+ export type RecoveryErrorCode = z.infer<typeof RecoveryErrorCodeSchema>;
155
+
156
+ /**
157
+ * `POST /recovery/cancel` with the token from the "recovery opened" notice. A signed-in
158
+ * owner cancels without it through `DELETE /recovery/requests/:id`.
112
159
  */
113
160
  export const AccountRecoveryCancelRequestSchema = z.object({
114
161
  cancelToken: z.string().trim().min(1).optional(),