@account-kit/signer 4.16.1-alpha.3 → 4.18.0-alpha.3

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 (80) hide show
  1. package/dist/esm/base.d.ts +16 -32
  2. package/dist/esm/base.js +127 -122
  3. package/dist/esm/base.js.map +1 -1
  4. package/dist/esm/client/base.d.ts +3 -36
  5. package/dist/esm/client/base.js +15 -20
  6. package/dist/esm/client/base.js.map +1 -1
  7. package/dist/esm/client/index.d.ts +27 -40
  8. package/dist/esm/client/index.js +41 -164
  9. package/dist/esm/client/index.js.map +1 -1
  10. package/dist/esm/client/types.d.ts +27 -65
  11. package/dist/esm/client/types.js.map +1 -1
  12. package/dist/esm/errors.d.ts +0 -6
  13. package/dist/esm/errors.js +0 -18
  14. package/dist/esm/errors.js.map +1 -1
  15. package/dist/esm/index.d.ts +1 -1
  16. package/dist/esm/index.js +1 -1
  17. package/dist/esm/index.js.map +1 -1
  18. package/dist/esm/metrics.d.ts +3 -0
  19. package/dist/esm/metrics.js.map +1 -1
  20. package/dist/esm/oauth.d.ts +5 -4
  21. package/dist/esm/oauth.js +16 -6
  22. package/dist/esm/oauth.js.map +1 -1
  23. package/dist/esm/session/manager.d.ts +0 -1
  24. package/dist/esm/session/manager.js +4 -0
  25. package/dist/esm/session/manager.js.map +1 -1
  26. package/dist/esm/session/types.d.ts +1 -1
  27. package/dist/esm/session/types.js.map +1 -1
  28. package/dist/esm/signer.d.ts +8 -5
  29. package/dist/esm/signer.js.map +1 -1
  30. package/dist/esm/types.d.ts +2 -9
  31. package/dist/esm/types.js +1 -5
  32. package/dist/esm/types.js.map +1 -1
  33. package/dist/esm/version.d.ts +1 -1
  34. package/dist/esm/version.js +1 -1
  35. package/dist/esm/version.js.map +1 -1
  36. package/dist/types/base.d.ts +16 -32
  37. package/dist/types/base.d.ts.map +1 -1
  38. package/dist/types/client/base.d.ts +3 -36
  39. package/dist/types/client/base.d.ts.map +1 -1
  40. package/dist/types/client/index.d.ts +27 -40
  41. package/dist/types/client/index.d.ts.map +1 -1
  42. package/dist/types/client/types.d.ts +27 -65
  43. package/dist/types/client/types.d.ts.map +1 -1
  44. package/dist/types/errors.d.ts +0 -6
  45. package/dist/types/errors.d.ts.map +1 -1
  46. package/dist/types/index.d.ts +1 -1
  47. package/dist/types/index.d.ts.map +1 -1
  48. package/dist/types/metrics.d.ts +3 -0
  49. package/dist/types/metrics.d.ts.map +1 -1
  50. package/dist/types/oauth.d.ts +5 -4
  51. package/dist/types/oauth.d.ts.map +1 -1
  52. package/dist/types/session/manager.d.ts +0 -1
  53. package/dist/types/session/manager.d.ts.map +1 -1
  54. package/dist/types/session/types.d.ts +1 -1
  55. package/dist/types/session/types.d.ts.map +1 -1
  56. package/dist/types/signer.d.ts +8 -5
  57. package/dist/types/signer.d.ts.map +1 -1
  58. package/dist/types/types.d.ts +2 -9
  59. package/dist/types/types.d.ts.map +1 -1
  60. package/dist/types/version.d.ts +1 -1
  61. package/package.json +4 -4
  62. package/src/base.ts +120 -166
  63. package/src/client/base.ts +26 -65
  64. package/src/client/index.ts +46 -174
  65. package/src/client/types.ts +31 -75
  66. package/src/errors.ts +1 -11
  67. package/src/index.ts +1 -5
  68. package/src/metrics.ts +2 -1
  69. package/src/oauth.ts +22 -8
  70. package/src/session/manager.ts +8 -7
  71. package/src/session/types.ts +1 -1
  72. package/src/signer.ts +13 -7
  73. package/src/types.ts +1 -9
  74. package/src/version.ts +1 -1
  75. package/dist/esm/utils/parseMfaError.d.ts +0 -2
  76. package/dist/esm/utils/parseMfaError.js +0 -15
  77. package/dist/esm/utils/parseMfaError.js.map +0 -1
  78. package/dist/types/utils/parseMfaError.d.ts +0 -3
  79. package/dist/types/utils/parseMfaError.d.ts.map +0 -1
  80. package/src/utils/parseMfaError.ts +0 -15
@@ -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;
@@ -96,6 +92,7 @@ export class SessionManager {
96
92
  switch (existingSession.type) {
97
93
  case "email":
98
94
  case "oauth":
95
+ case "custom-jwt":
99
96
  case "otp": {
100
97
  const connectedEventName = (() => {
101
98
  switch (existingSession.type) {
@@ -105,6 +102,8 @@ export class SessionManager {
105
102
  return "connectedOauth";
106
103
  case "otp":
107
104
  return "connectedOtp";
105
+ case "custom-jwt":
106
+ return "connectedJwt";
108
107
  }
109
108
  })();
110
109
  const result = await this.client
@@ -207,7 +206,7 @@ export class SessionManager {
207
206
  private setSession = (
208
207
  session_:
209
208
  | Omit<
210
- Extract<Session, { type: "email" | "oauth" | "otp" }>,
209
+ Extract<Session, { type: "email" | "oauth" | "otp" | "custom-jwt" }>,
211
210
  "expirationDateMs"
212
211
  >
213
212
  | Omit<Extract<Session, { type: "passkey" }>, "expirationDateMs">
@@ -280,6 +279,8 @@ export class SessionManager {
280
279
  },
281
280
  connectedOauth: (user, bundle) =>
282
281
  this.setSessionWithUserAndBundle({ type: "oauth", user, bundle }),
282
+ connectedJwt: (user, bundle) =>
283
+ this.setSessionWithUserAndBundle({ type: "custom-jwt", user, bundle }),
283
284
  connectedOtp: (user, bundle) => {
284
285
  this.setSessionWithUserAndBundle({ type: "otp", user, bundle });
285
286
  },
@@ -335,7 +336,7 @@ export class SessionManager {
335
336
  user,
336
337
  bundle,
337
338
  }: {
338
- type: "email" | "oauth" | "otp";
339
+ type: "email" | "oauth" | "otp" | "custom-jwt";
339
340
  user: User;
340
341
  bundle: string;
341
342
  }) => {
@@ -2,7 +2,7 @@ import type { User } from "../client/types";
2
2
 
3
3
  export type Session =
4
4
  | {
5
- type: "email" | "oauth" | "otp";
5
+ type: "email" | "oauth" | "otp" | "custom-jwt";
6
6
  bundle: string;
7
7
  expirationDateMs: number;
8
8
  user: User;
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
  | {
@@ -38,8 +35,13 @@ export type AuthParams =
38
35
  type: "oauth";
39
36
  scope?: string;
40
37
  claims?: string;
38
+ otherParameters?: Record<string, string>;
41
39
  } & OauthProviderConfig &
42
40
  OauthRedirectConfig)
41
+ | ({
42
+ type: "custom-jwt";
43
+ jwt: string;
44
+ } & OauthProviderConfig)
43
45
  | {
44
46
  type: "oauthReturn";
45
47
  bundle: string;
@@ -50,7 +52,6 @@ export type AuthParams =
50
52
  | {
51
53
  type: "otp";
52
54
  otpCode: string;
53
- multiFactors?: VerifyMfaParams[];
54
55
  };
55
56
 
56
57
  export type OauthProviderConfig =
@@ -74,7 +75,12 @@ export type OauthRedirectConfig =
74
75
  | { mode: "redirect"; redirectUrl: string }
75
76
  | { mode: "popup"; redirectUrl?: never };
76
77
 
77
- export type KnownAuthProvider = "google" | "apple" | "facebook" | "auth0";
78
+ export type KnownAuthProvider =
79
+ | "google"
80
+ | "apple"
81
+ | "facebook"
82
+ | "twitch"
83
+ | "auth0";
78
84
 
79
85
  export type OauthMode = "redirect" | "popup";
80
86
 
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;
@@ -23,11 +19,7 @@ export enum AlchemySignerStatus {
23
19
  AUTHENTICATING_OAUTH = "AUTHENTICATING_OAUTH",
24
20
  AWAITING_EMAIL_AUTH = "AWAITING_EMAIL_AUTH",
25
21
  AWAITING_OTP_AUTH = "AWAITING_OTP_AUTH",
26
- }
27
-
28
- export enum AlchemyMfaStatus {
29
- NOT_REQUIRED = "not_required",
30
- REQUIRED = "required",
22
+ AUTHENTICATING_JWT = "AUTHENTICATING_JWT",
31
23
  }
32
24
 
33
25
  export interface ErrorInfo {
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.18.0-alpha.3";
@@ -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
- }