@account-kit/signer 4.16.1-alpha.3 → 4.17.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.
Files changed (63) hide show
  1. package/dist/esm/base.d.ts +15 -32
  2. package/dist/esm/base.js +94 -122
  3. package/dist/esm/base.js.map +1 -1
  4. package/dist/esm/client/base.d.ts +2 -36
  5. package/dist/esm/client/base.js.map +1 -1
  6. package/dist/esm/client/index.d.ts +1 -40
  7. package/dist/esm/client/index.js +7 -164
  8. package/dist/esm/client/index.js.map +1 -1
  9. package/dist/esm/client/types.d.ts +12 -66
  10. package/dist/esm/client/types.js.map +1 -1
  11. package/dist/esm/errors.d.ts +0 -6
  12. package/dist/esm/errors.js +0 -18
  13. package/dist/esm/errors.js.map +1 -1
  14. package/dist/esm/index.d.ts +1 -1
  15. package/dist/esm/index.js +1 -1
  16. package/dist/esm/index.js.map +1 -1
  17. package/dist/esm/session/manager.d.ts +0 -1
  18. package/dist/esm/session/manager.js.map +1 -1
  19. package/dist/esm/signer.d.ts +2 -3
  20. package/dist/esm/signer.js.map +1 -1
  21. package/dist/esm/types.d.ts +0 -8
  22. package/dist/esm/types.js +0 -5
  23. package/dist/esm/types.js.map +1 -1
  24. package/dist/esm/version.d.ts +1 -1
  25. package/dist/esm/version.js +1 -1
  26. package/dist/esm/version.js.map +1 -1
  27. package/dist/types/base.d.ts +15 -32
  28. package/dist/types/base.d.ts.map +1 -1
  29. package/dist/types/client/base.d.ts +2 -36
  30. package/dist/types/client/base.d.ts.map +1 -1
  31. package/dist/types/client/index.d.ts +1 -40
  32. package/dist/types/client/index.d.ts.map +1 -1
  33. package/dist/types/client/types.d.ts +12 -66
  34. package/dist/types/client/types.d.ts.map +1 -1
  35. package/dist/types/errors.d.ts +0 -6
  36. package/dist/types/errors.d.ts.map +1 -1
  37. package/dist/types/index.d.ts +1 -1
  38. package/dist/types/index.d.ts.map +1 -1
  39. package/dist/types/session/manager.d.ts +0 -1
  40. package/dist/types/session/manager.d.ts.map +1 -1
  41. package/dist/types/signer.d.ts +2 -3
  42. package/dist/types/signer.d.ts.map +1 -1
  43. package/dist/types/types.d.ts +0 -8
  44. package/dist/types/types.d.ts.map +1 -1
  45. package/dist/types/version.d.ts +1 -1
  46. package/dist/types/version.d.ts.map +1 -1
  47. package/package.json +4 -4
  48. package/src/base.ts +87 -166
  49. package/src/client/base.ts +1 -43
  50. package/src/client/index.ts +7 -174
  51. package/src/client/types.ts +14 -76
  52. package/src/errors.ts +1 -11
  53. package/src/index.ts +1 -5
  54. package/src/session/manager.ts +1 -5
  55. package/src/signer.ts +2 -6
  56. package/src/types.ts +0 -9
  57. package/src/version.ts +1 -1
  58. package/dist/esm/utils/parseMfaError.d.ts +0 -2
  59. package/dist/esm/utils/parseMfaError.js +0 -15
  60. package/dist/esm/utils/parseMfaError.js.map +0 -1
  61. package/dist/types/utils/parseMfaError.d.ts +0 -3
  62. package/dist/types/utils/parseMfaError.d.ts.map +0 -1
  63. package/src/utils/parseMfaError.ts +0 -15
@@ -29,6 +29,7 @@ export type CreateAccountParams =
29
29
  | {
30
30
  type: "email";
31
31
  email: string;
32
+ /** @deprecated This option will be overriden by dashboard settings. Please use the dashboard settings instead. This option will be removed in a future release. */
32
33
  emailMode?: EmailType;
33
34
  expirationSeconds?: number;
34
35
  redirectParams?: URLSearchParams;
@@ -48,11 +49,11 @@ export type EmailType = "magicLink" | "otp";
48
49
 
49
50
  export type EmailAuthParams = {
50
51
  email: string;
52
+ /** @deprecated This option will be overriden by dashboard settings. Please use the dashboard settings instead. This option will be removed in a future release. */
51
53
  emailMode?: EmailType;
52
54
  expirationSeconds?: number;
53
55
  targetPublicKey: string;
54
56
  redirectParams?: URLSearchParams;
55
- multiFactors?: VerifyMfaParams[];
56
57
  };
57
58
 
58
59
  export type OauthParams = Extract<AuthParams, { type: "oauth" }> & {
@@ -65,7 +66,6 @@ export type OtpParams = {
65
66
  otpCode: string;
66
67
  targetPublicKey: string;
67
68
  expirationSeconds?: number;
68
- multiFactors?: VerifyMfaParams[];
69
69
  };
70
70
 
71
71
  export type SignupResponse = {
@@ -81,6 +81,14 @@ export type OauthConfig = {
81
81
  authProviders: AuthProviderConfig[];
82
82
  };
83
83
 
84
+ export type EmailConfig = {
85
+ mode?: "MAGIC_LINK" | "OTP";
86
+ };
87
+
88
+ export type SignerConfig = {
89
+ email: EmailConfig;
90
+ };
91
+
84
92
  export type AuthProviderConfig = {
85
93
  id: string;
86
94
  isCustomProvider?: boolean;
@@ -124,12 +132,10 @@ export type SignerEndpoints = [
124
132
  Route: "/v1/auth";
125
133
  Body: Omit<EmailAuthParams, "redirectParams"> & {
126
134
  redirectParams?: string;
127
- multiFactors?: VerifyMfaParams[];
128
135
  };
129
136
  Response: {
130
137
  orgId: string;
131
138
  otpId?: string;
132
- multiFactors?: MfaFactor[];
133
139
  };
134
140
  },
135
141
  {
@@ -160,45 +166,12 @@ export type SignerEndpoints = [
160
166
  {
161
167
  Route: "/v1/otp";
162
168
  Body: OtpParams;
163
- Response: {
164
- credentialBundle: string | null;
165
- };
166
- },
167
- {
168
- Route: "/v1/auth-list-multi-factors";
169
- Body: {
170
- stampedRequest: TSignedRequest;
171
- };
172
- Response: {
173
- multiFactors: MfaFactor[];
174
- };
175
- },
176
- {
177
- Route: "/v1/auth-delete-multi-factors";
178
- Body: {
179
- stampedRequest: TSignedRequest;
180
- multiFactorIds: string[];
181
- };
182
- Response: {
183
- multiFactors: MfaFactor[];
184
- };
185
- },
186
- {
187
- Route: "/v1/auth-request-multi-factor";
188
- Body: {
189
- stampedRequest: TSignedRequest;
190
- multiFactorType: MultiFactorType;
191
- };
192
- Response: EnableMfaResult;
169
+ Response: { credentialBundle: string };
193
170
  },
194
171
  {
195
- Route: "/v1/auth-verify-multi-factor";
196
- Body: VerifyMfaParams & {
197
- stampedRequest: TSignedRequest;
198
- };
199
- Response: {
200
- multiFactors: MfaFactor[];
201
- };
172
+ Route: "/v1/signer-config";
173
+ Body: {};
174
+ Response: SignerConfig;
202
175
  }
203
176
  ];
204
177
 
@@ -242,38 +215,3 @@ export type GetOauthProviderUrlArgs = {
242
215
  oauthConfig?: OauthConfig;
243
216
  usesRelativeUrl?: boolean;
244
217
  };
245
-
246
- export type MfaFactor = {
247
- multiFactorId: string;
248
- multiFactorType: string;
249
- };
250
-
251
- type MultiFactorType = "totp";
252
-
253
- export type EnableMfaParams = {
254
- multiFactorType: MultiFactorType;
255
- };
256
-
257
- export type EnableMfaResult = {
258
- multiFactorType: MultiFactorType;
259
- multiFactorId: string;
260
- multiFactorTotpUrl: string;
261
- };
262
-
263
- export type VerifyMfaParams = {
264
- multiFactorId: string;
265
- multiFactorCode: string;
266
- };
267
-
268
- export type RemoveMfaParams = {
269
- multiFactorIds: string[];
270
- };
271
-
272
- export type MfaChallenge = {
273
- multiFactorId: string;
274
- multiFactorChallenge:
275
- | {
276
- code: string;
277
- }
278
- | Record<string, any>;
279
- };
package/src/errors.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BaseError } from "@aa-sdk/core";
2
- import type { MfaFactor } from "./client/types";
2
+
3
3
  export class NotAuthenticatedError extends BaseError {
4
4
  override name = "NotAuthenticatedError";
5
5
  constructor() {
@@ -23,13 +23,3 @@ export class OAuthProvidersError extends BaseError {
23
23
  });
24
24
  }
25
25
  }
26
-
27
- export class MfaRequiredError extends BaseError {
28
- override name = "MfaRequiredError";
29
- public multiFactors: MfaFactor[];
30
-
31
- constructor(multiFactors: MfaFactor[]) {
32
- super("MFA is required for this user");
33
- this.multiFactors = multiFactors;
34
- }
35
- }
package/src/index.ts CHANGED
@@ -6,11 +6,7 @@ export {
6
6
  OauthFailedError,
7
7
  } from "./client/index.js";
8
8
  export type * from "./client/types.js";
9
- export {
10
- NotAuthenticatedError,
11
- OAuthProvidersError,
12
- MfaRequiredError,
13
- } from "./errors.js";
9
+ export { NotAuthenticatedError, OAuthProvidersError } from "./errors.js";
14
10
  export {
15
11
  DEFAULT_SESSION_MS,
16
12
  SessionManagerParamsSchema,
@@ -43,11 +43,7 @@ type Store = Mutate<
43
43
  [["zustand/subscribeWithSelector", never], ["zustand/persist", SessionState]]
44
44
  >;
45
45
 
46
- type TemporarySession = {
47
- orgId: string;
48
- isNewUser?: boolean;
49
- isMfaRequired?: boolean;
50
- };
46
+ type TemporarySession = { orgId: string; isNewUser?: boolean };
51
47
 
52
48
  export class SessionManager {
53
49
  private sessionKey: string;
package/src/signer.ts CHANGED
@@ -4,19 +4,16 @@ import {
4
4
  AlchemySignerClientParamsSchema,
5
5
  AlchemySignerWebClient,
6
6
  } from "./client/index.js";
7
- import type {
8
- CredentialCreationOptionOverrides,
9
- VerifyMfaParams,
10
- } from "./client/types.js";
7
+ import type { CredentialCreationOptionOverrides } from "./client/types.js";
11
8
  import { SessionManagerParamsSchema } from "./session/manager.js";
12
9
 
13
10
  export type AuthParams =
14
11
  | {
15
12
  type: "email";
16
13
  email: string;
14
+ /** @deprecated This option will be overriden by dashboard settings. Please use the dashboard settings instead. This option will be removed in a future release. */
17
15
  emailMode?: "magicLink" | "otp";
18
16
  redirectParams?: URLSearchParams;
19
- multiFactors?: VerifyMfaParams[];
20
17
  }
21
18
  | { type: "email"; bundle: string; orgId?: string; isNewUser?: boolean }
22
19
  | {
@@ -50,7 +47,6 @@ export type AuthParams =
50
47
  | {
51
48
  type: "otp";
52
49
  otpCode: string;
53
- multiFactors?: VerifyMfaParams[];
54
50
  };
55
51
 
56
52
  export type OauthProviderConfig =
package/src/types.ts CHANGED
@@ -6,10 +6,6 @@ export type AlchemySignerEvents = {
6
6
  disconnected(): void;
7
7
  statusChanged(status: AlchemySignerStatus): void;
8
8
  errorChanged(error: ErrorInfo | undefined): void;
9
- mfaStatusChanged(mfaStatus: {
10
- mfaRequired: boolean;
11
- mfaFactorId?: string;
12
- }): void;
13
9
  };
14
10
 
15
11
  export type AlchemySignerEvent = keyof AlchemySignerEvents;
@@ -25,11 +21,6 @@ export enum AlchemySignerStatus {
25
21
  AWAITING_OTP_AUTH = "AWAITING_OTP_AUTH",
26
22
  }
27
23
 
28
- export enum AlchemyMfaStatus {
29
- NOT_REQUIRED = "not_required",
30
- REQUIRED = "required",
31
- }
32
-
33
24
  export interface ErrorInfo {
34
25
  name: string;
35
26
  message: string;
package/src/version.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  // This file is autogenerated by inject-version.ts. Any changes will be
2
2
  // overwritten on commit!
3
- export const VERSION = "4.16.1-alpha.3";
3
+ export const VERSION = "4.17.0";
@@ -1,2 +0,0 @@
1
- import type { MfaFactor } from "../client/types.js";
2
- export declare function parseMfaError(error: unknown): MfaFactor[] | null;
@@ -1,15 +0,0 @@
1
- export function parseMfaError(error) {
2
- if (error instanceof Error) {
3
- try {
4
- const parsed = JSON.parse(error.message);
5
- if (parsed?.data?.multiFactors) {
6
- return parsed.data.multiFactors;
7
- }
8
- }
9
- catch {
10
- // ignore JSON parse failures
11
- }
12
- }
13
- return null;
14
- }
15
- //# sourceMappingURL=parseMfaError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseMfaError.js","sourceRoot":"","sources":["../../../src/utils/parseMfaError.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACzC,IAAI,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;gBAC/B,OAAO,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC;YAClC,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,6BAA6B;QAC/B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import type { MfaFactor } from \"../client/types.js\";\n\nexport function parseMfaError(error: unknown): MfaFactor[] | null {\n if (error instanceof Error) {\n try {\n const parsed = JSON.parse(error.message);\n if (parsed?.data?.multiFactors) {\n return parsed.data.multiFactors;\n }\n } catch {\n // ignore JSON parse failures\n }\n }\n return null;\n}\n"]}
@@ -1,3 +0,0 @@
1
- import type { MfaFactor } from "../client/types.js";
2
- export declare function parseMfaError(error: unknown): MfaFactor[] | null;
3
- //# sourceMappingURL=parseMfaError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseMfaError.d.ts","sourceRoot":"","sources":["../../../src/utils/parseMfaError.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,EAAE,GAAG,IAAI,CAYhE"}
@@ -1,15 +0,0 @@
1
- import type { MfaFactor } from "../client/types.js";
2
-
3
- export function parseMfaError(error: unknown): MfaFactor[] | null {
4
- if (error instanceof Error) {
5
- try {
6
- const parsed = JSON.parse(error.message);
7
- if (parsed?.data?.multiFactors) {
8
- return parsed.data.multiFactors;
9
- }
10
- } catch {
11
- // ignore JSON parse failures
12
- }
13
- }
14
- return null;
15
- }