@aindy/ui-kit 1.0.6 → 2.1.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.
@@ -1,4 +1,6 @@
1
1
  export function taggedRequest(domain: any, apiFn: any): (...args: any[]) => any;
2
+ /** Test seam: forget that the backend has been seen stamping. */
3
+ export function _resetEnvelopeDetection(): void;
2
4
  export function unwrapEnvelope(response: any): any;
3
5
  export function getStoredToken(): string;
4
6
  export function setStoredToken(token: any): void;
@@ -11,6 +13,7 @@ export class ApiError extends Error {
11
13
  status: any;
12
14
  body: any;
13
15
  }
16
+ export const ENVELOPE_HEADER: "X-AINDY-Envelope";
14
17
  export const API_BASE: any;
15
18
  export function authRequest(path: any, opts?: {}): Promise<any>;
16
19
  export function request(path: any, opts?: {}): Promise<any>;
@@ -0,0 +1 @@
1
+ export {};
@@ -9,6 +9,10 @@ export const ROUTES: Readonly<{
9
9
  LOGIN: "/auth/login";
10
10
  REGISTER: "/auth/register";
11
11
  LOGOUT: "/auth/logout";
12
+ VERIFY_EMAIL: "/auth/verify-email";
13
+ PASSWORD_CHANGE: "/auth/password/change";
14
+ PASSWORD_FORGOT: "/auth/password/forgot";
15
+ PASSWORD_RESET: "/auth/password/reset";
12
16
  }>;
13
17
  TASKS: Readonly<{
14
18
  LIST: "/tasks/list";
@@ -1,4 +1,36 @@
1
1
  export function loginUser(credentials: any): Promise<any>;
2
+ /**
3
+ * Begin registration. Against runtime >= 2.0.0 this resolves to
4
+ * `{ status: "verification_sent" }` and **carries no access token** — the response is
5
+ * deliberately identical whether or not the address was already registered, which is what
6
+ * closes the account-enumeration oracle. The token is issued by `verifyEmail` once the
7
+ * emailed link is followed.
8
+ */
2
9
  export function registerUser(credentials: any): Promise<any>;
10
+ /** Consume an emailed verification token and receive the access token. */
11
+ export function verifyEmail(token: any): Promise<any>;
12
+ /**
13
+ * Rotate the signed-in user's password.
14
+ *
15
+ * Returns a freshly-versioned access token. **It must be stored** — the change invalidates
16
+ * every session including this one, so keeping the old token 401s on the next request.
17
+ */
18
+ export function changePassword(currentPassword: any, newPassword: any, token?: string): Promise<any>;
19
+ /**
20
+ * Begin password recovery.
21
+ *
22
+ * Resolves identically whether or not the address is registered — do not branch on the
23
+ * result to tell the user whether an account exists, that is the oracle this avoids. A 503
24
+ * means the deployment has no email channel configured, which is about the deployment and
25
+ * not about any account.
26
+ */
27
+ export function forgotPassword(email: any): Promise<any>;
28
+ /**
29
+ * Complete password recovery with an emailed token.
30
+ *
31
+ * Returns no access token — unlike `changePassword`, the caller has not proven they hold a
32
+ * session, so they sign in afresh.
33
+ */
34
+ export function resetPassword(token: any, newPassword: any): Promise<any>;
3
35
  export function logoutUser(token?: string): Promise<any>;
4
36
  export function bootIdentity(token?: string): Promise<any>;
@@ -1,3 +1,3 @@
1
1
  export { ROUTES } from './_routes.js';
2
2
  export { ApiError, adminRequest, authRequest, authRequestExternal, buildApiUrl, clearStoredToken, getStoredToken, request, requestAbsolute, setStoredToken, taggedRequest, unwrapEnvelope, API_BASE } from './_core.js';
3
- export { bootIdentity, loginUser, registerUser } from './auth.js';
3
+ export { bootIdentity, changePassword, forgotPassword, loginUser, registerUser, resetPassword, verifyEmail } from './auth.js';