@getpara/user-management-client 2.0.0-dev.1 → 2.0.0-dev.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.
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
@@ -0,0 +1,112 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var auth_exports = {};
19
+ __export(auth_exports, {
20
+ AUTH_TYPES: () => AUTH_TYPES,
21
+ AuthMethod: () => AuthMethod,
22
+ EncryptorType: () => EncryptorType,
23
+ KeyShareType: () => KeyShareType,
24
+ LINKED_ACCOUNT_TYPES: () => LINKED_ACCOUNT_TYPES,
25
+ OAUTH_METHODS: () => OAUTH_METHODS,
26
+ OAuthMethod: () => OAuthMethod,
27
+ PasswordStatus: () => PasswordStatus,
28
+ PublicKeyStatus: () => PublicKeyStatus,
29
+ PublicKeyType: () => PublicKeyType
30
+ });
31
+ module.exports = __toCommonJS(auth_exports);
32
+ const AUTH_TYPES = [
33
+ "email",
34
+ "phone",
35
+ "phoneLegacy",
36
+ "farcaster",
37
+ "telegram",
38
+ "userId",
39
+ "externalWallet",
40
+ "discord",
41
+ "x",
42
+ "customId",
43
+ "guestId"
44
+ ];
45
+ var EncryptorType = /* @__PURE__ */ ((EncryptorType2) => {
46
+ EncryptorType2["USER"] = "USER";
47
+ EncryptorType2["RECOVERY"] = "RECOVERY";
48
+ EncryptorType2["BIOMETRICS"] = "BIOMETRICS";
49
+ EncryptorType2["PASSWORD"] = "PASSWORD";
50
+ return EncryptorType2;
51
+ })(EncryptorType || {});
52
+ var KeyShareType = /* @__PURE__ */ ((KeyShareType2) => {
53
+ KeyShareType2["USER"] = "USER";
54
+ KeyShareType2["RECOVERY"] = "RECOVERY";
55
+ return KeyShareType2;
56
+ })(KeyShareType || {});
57
+ var PasswordStatus = /* @__PURE__ */ ((PasswordStatus2) => {
58
+ PasswordStatus2["PENDING"] = "PENDING";
59
+ PasswordStatus2["COMPLETE"] = "COMPLETE";
60
+ return PasswordStatus2;
61
+ })(PasswordStatus || {});
62
+ var PublicKeyStatus = /* @__PURE__ */ ((PublicKeyStatus2) => {
63
+ PublicKeyStatus2["PENDING"] = "PENDING";
64
+ PublicKeyStatus2["COMPLETE"] = "COMPLETE";
65
+ return PublicKeyStatus2;
66
+ })(PublicKeyStatus || {});
67
+ var PublicKeyType = /* @__PURE__ */ ((PublicKeyType2) => {
68
+ PublicKeyType2["MOBILE"] = "MOBILE";
69
+ PublicKeyType2["WEB"] = "WEB";
70
+ return PublicKeyType2;
71
+ })(PublicKeyType || {});
72
+ var OAuthMethod = /* @__PURE__ */ ((OAuthMethod2) => {
73
+ OAuthMethod2["GOOGLE"] = "GOOGLE";
74
+ OAuthMethod2["TWITTER"] = "TWITTER";
75
+ OAuthMethod2["APPLE"] = "APPLE";
76
+ OAuthMethod2["DISCORD"] = "DISCORD";
77
+ OAuthMethod2["FACEBOOK"] = "FACEBOOK";
78
+ OAuthMethod2["FARCASTER"] = "FARCASTER";
79
+ OAuthMethod2["TELEGRAM"] = "TELEGRAM";
80
+ return OAuthMethod2;
81
+ })(OAuthMethod || {});
82
+ const OAUTH_METHODS = ["GOOGLE", "TWITTER", "APPLE", "DISCORD", "FACEBOOK", "FARCASTER", "TELEGRAM"];
83
+ const LINKED_ACCOUNT_TYPES = [
84
+ "EMAIL",
85
+ "PHONE",
86
+ "GOOGLE",
87
+ "FACEBOOK",
88
+ "APPLE",
89
+ "TWITTER",
90
+ "DISCORD",
91
+ "TELEGRAM",
92
+ "FARCASTER",
93
+ "EXTERNAL_WALLET"
94
+ ];
95
+ var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
96
+ AuthMethod2["PASSWORD"] = "PASSWORD";
97
+ AuthMethod2["PASSKEY"] = "PASSKEY";
98
+ return AuthMethod2;
99
+ })(AuthMethod || {});
100
+ // Annotate the CommonJS export names for ESM import in node:
101
+ 0 && (module.exports = {
102
+ AUTH_TYPES,
103
+ AuthMethod,
104
+ EncryptorType,
105
+ KeyShareType,
106
+ LINKED_ACCOUNT_TYPES,
107
+ OAUTH_METHODS,
108
+ OAuthMethod,
109
+ PasswordStatus,
110
+ PublicKeyStatus,
111
+ PublicKeyType
112
+ });
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var email_exports = {};
19
+ __export(email_exports, {
20
+ EmailTheme: () => EmailTheme
21
+ });
22
+ module.exports = __toCommonJS(email_exports);
23
+ var EmailTheme = /* @__PURE__ */ ((EmailTheme2) => {
24
+ EmailTheme2["LIGHT"] = "light";
25
+ EmailTheme2["DARK"] = "dark";
26
+ return EmailTheme2;
27
+ })(EmailTheme || {});
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ EmailTheme
31
+ });
@@ -0,0 +1,29 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
+ var types_exports = {};
16
+ module.exports = __toCommonJS(types_exports);
17
+ __reExport(types_exports, require("./auth.js"), module.exports);
18
+ __reExport(types_exports, require("./email.js"), module.exports);
19
+ __reExport(types_exports, require("./onRamp.js"), module.exports);
20
+ __reExport(types_exports, require("./partner.js"), module.exports);
21
+ __reExport(types_exports, require("./wallet.js"), module.exports);
22
+ // Annotate the CommonJS export names for ESM import in node:
23
+ 0 && (module.exports = {
24
+ ...require("./auth.js"),
25
+ ...require("./email.js"),
26
+ ...require("./onRamp.js"),
27
+ ...require("./partner.js"),
28
+ ...require("./wallet.js")
29
+ });
@@ -0,0 +1,63 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var onRamp_exports = {};
19
+ __export(onRamp_exports, {
20
+ OnRampAsset: () => OnRampAsset,
21
+ OnRampProvider: () => OnRampProvider,
22
+ OnRampPurchaseStatus: () => OnRampPurchaseStatus,
23
+ OnRampPurchaseType: () => OnRampPurchaseType
24
+ });
25
+ module.exports = __toCommonJS(onRamp_exports);
26
+ var OnRampProvider = /* @__PURE__ */ ((OnRampProvider2) => {
27
+ OnRampProvider2["RAMP"] = "RAMP";
28
+ OnRampProvider2["STRIPE"] = "STRIPE";
29
+ OnRampProvider2["MOONPAY"] = "MOONPAY";
30
+ return OnRampProvider2;
31
+ })(OnRampProvider || {});
32
+ var OnRampAsset = /* @__PURE__ */ ((OnRampAsset2) => {
33
+ OnRampAsset2["ETHEREUM"] = "ETHEREUM";
34
+ OnRampAsset2["USDC"] = "USDC";
35
+ OnRampAsset2["TETHER"] = "TETHER";
36
+ OnRampAsset2["POLYGON"] = "POLYGON";
37
+ OnRampAsset2["SOLANA"] = "SOLANA";
38
+ OnRampAsset2["ATOM"] = "ATOM";
39
+ OnRampAsset2["CELO"] = "CELO";
40
+ OnRampAsset2["CUSD"] = "CUSD";
41
+ OnRampAsset2["CEUR"] = "CEUR";
42
+ OnRampAsset2["CREAL"] = "CREAL";
43
+ OnRampAsset2["BERA"] = "BERA";
44
+ return OnRampAsset2;
45
+ })(OnRampAsset || {});
46
+ var OnRampPurchaseStatus = /* @__PURE__ */ ((OnRampPurchaseStatus2) => {
47
+ OnRampPurchaseStatus2["INITIATED"] = "INITIATED";
48
+ OnRampPurchaseStatus2["FINISHED"] = "FINISHED";
49
+ OnRampPurchaseStatus2["CANCELLED"] = "CANCELLED";
50
+ return OnRampPurchaseStatus2;
51
+ })(OnRampPurchaseStatus || {});
52
+ var OnRampPurchaseType = /* @__PURE__ */ ((OnRampPurchaseType2) => {
53
+ OnRampPurchaseType2["BUY"] = "BUY";
54
+ OnRampPurchaseType2["SELL"] = "SELL";
55
+ return OnRampPurchaseType2;
56
+ })(OnRampPurchaseType || {});
57
+ // Annotate the CommonJS export names for ESM import in node:
58
+ 0 && (module.exports = {
59
+ OnRampAsset,
60
+ OnRampProvider,
61
+ OnRampPurchaseStatus,
62
+ OnRampPurchaseType
63
+ });
@@ -0,0 +1,15 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from === "object" || typeof from === "function") {
7
+ for (let key of __getOwnPropNames(from))
8
+ if (!__hasOwnProp.call(to, key) && key !== except)
9
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
+ }
11
+ return to;
12
+ };
13
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
+ var partner_exports = {};
15
+ module.exports = __toCommonJS(partner_exports);
@@ -0,0 +1,112 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var wallet_exports = {};
19
+ __export(wallet_exports, {
20
+ COSMOS_WALLETS: () => COSMOS_WALLETS,
21
+ Chain: () => Chain,
22
+ EVM_WALLETS: () => EVM_WALLETS,
23
+ EXTERNAL_WALLET_TYPES: () => EXTERNAL_WALLET_TYPES,
24
+ NON_ED25519: () => NON_ED25519,
25
+ Network: () => Network,
26
+ PREGEN_IDENTIFIER_TYPES: () => PREGEN_IDENTIFIER_TYPES,
27
+ SOLANA_WALLETS: () => SOLANA_WALLETS,
28
+ WALLET_SCHEMES: () => WALLET_SCHEMES,
29
+ WALLET_TYPES: () => WALLET_TYPES,
30
+ WalletScheme: () => WalletScheme,
31
+ WalletType: () => WalletType
32
+ });
33
+ module.exports = __toCommonJS(wallet_exports);
34
+ var WalletScheme = /* @__PURE__ */ ((WalletScheme2) => {
35
+ WalletScheme2["DKLS"] = "DKLS";
36
+ WalletScheme2["CGGMP"] = "CGGMP";
37
+ WalletScheme2["ED25519"] = "ED25519";
38
+ return WalletScheme2;
39
+ })(WalletScheme || {});
40
+ const WALLET_SCHEMES = ["DKLS", "CGGMP", "ED25519"];
41
+ var WalletType = /* @__PURE__ */ ((WalletType2) => {
42
+ WalletType2["EVM"] = "EVM";
43
+ WalletType2["SOLANA"] = "SOLANA";
44
+ WalletType2["COSMOS"] = "COSMOS";
45
+ return WalletType2;
46
+ })(WalletType || {});
47
+ const WALLET_TYPES = ["EVM", "SOLANA", "COSMOS"];
48
+ var Chain = /* @__PURE__ */ ((Chain2) => {
49
+ Chain2["ETH"] = "ETH";
50
+ Chain2["CELO"] = "CELO";
51
+ Chain2["MATIC"] = "MATIC";
52
+ return Chain2;
53
+ })(Chain || {});
54
+ var Network = /* @__PURE__ */ ((Network2) => {
55
+ Network2["ETHEREUM"] = "ETHEREUM";
56
+ Network2["SEPOLIA"] = "SEPOLIA";
57
+ Network2["ARBITRUM"] = "ARBITRUM";
58
+ Network2["BASE"] = "BASE";
59
+ Network2["OPTIMISM"] = "OPTIMISM";
60
+ Network2["POLYGON"] = "POLYGON";
61
+ Network2["SOLANA"] = "SOLANA";
62
+ Network2["COSMOS"] = "COSMOS";
63
+ Network2["CELO"] = "CELO";
64
+ Network2["NOBLE"] = "NOBLE";
65
+ Network2["SOLANA_DEVNET"] = "SOLANA_DEVNET";
66
+ Network2["BERACHAIN"] = "BERACHAIN";
67
+ return Network2;
68
+ })(Network || {});
69
+ const PREGEN_IDENTIFIER_TYPES = [
70
+ "EMAIL",
71
+ "PHONE",
72
+ "CUSTOM_ID",
73
+ "GUEST_ID",
74
+ "DISCORD",
75
+ "TWITTER",
76
+ "TELEGRAM",
77
+ "FARCASTER"
78
+ ];
79
+ const NON_ED25519 = ["DKLS", "CGGMP"];
80
+ const EVM_WALLETS = [
81
+ "METAMASK",
82
+ "RAINBOW",
83
+ "COINBASE",
84
+ "WALLETCONNECT",
85
+ "FARCASTER",
86
+ "ZERION",
87
+ "SAFE",
88
+ "RABBY",
89
+ "OKX",
90
+ "HAHA",
91
+ "BACKPACK",
92
+ "PHANTOM",
93
+ "VALORA"
94
+ ];
95
+ const SOLANA_WALLETS = ["PHANTOM", "GLOW", "BACKPACK", "SOLFLARE"];
96
+ const COSMOS_WALLETS = ["KEPLR", "LEAP", "COSMOSTATION"];
97
+ const EXTERNAL_WALLET_TYPES = [.../* @__PURE__ */ new Set([...EVM_WALLETS, ...SOLANA_WALLETS, ...COSMOS_WALLETS])];
98
+ // Annotate the CommonJS export names for ESM import in node:
99
+ 0 && (module.exports = {
100
+ COSMOS_WALLETS,
101
+ Chain,
102
+ EVM_WALLETS,
103
+ EXTERNAL_WALLET_TYPES,
104
+ NON_ED25519,
105
+ Network,
106
+ PREGEN_IDENTIFIER_TYPES,
107
+ SOLANA_WALLETS,
108
+ WALLET_SCHEMES,
109
+ WALLET_TYPES,
110
+ WalletScheme,
111
+ WalletType
112
+ });
@@ -0,0 +1,282 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __defProps = Object.defineProperties;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
+ var __getProtoOf = Object.getPrototypeOf;
9
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
11
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
12
+ var __spreadValues = (a, b) => {
13
+ for (var prop in b || (b = {}))
14
+ if (__hasOwnProp.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ if (__getOwnPropSymbols)
17
+ for (var prop of __getOwnPropSymbols(b)) {
18
+ if (__propIsEnum.call(b, prop))
19
+ __defNormalProp(a, prop, b[prop]);
20
+ }
21
+ return a;
22
+ };
23
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
24
+ var __export = (target, all) => {
25
+ for (var name in all)
26
+ __defProp(target, name, { get: all[name], enumerable: true });
27
+ };
28
+ var __copyProps = (to, from, except, desc) => {
29
+ if (from && typeof from === "object" || typeof from === "function") {
30
+ for (let key of __getOwnPropNames(from))
31
+ if (!__hasOwnProp.call(to, key) && key !== except)
32
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
33
+ }
34
+ return to;
35
+ };
36
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
37
+ // If the importer is in node compatibility mode or this is not an ESM
38
+ // file that has been converted to a CommonJS file using a Babel-
39
+ // compatible transform (i.e. "__esModule" has not been set), then set
40
+ // "default" to the CommonJS "module.exports" for node compatibility.
41
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
42
+ mod
43
+ ));
44
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
45
+ var utils_exports = {};
46
+ __export(utils_exports, {
47
+ extractAuthInfo: () => extractAuthInfo,
48
+ extractWalletRef: () => extractWalletRef,
49
+ fromAccountMetadata: () => fromAccountMetadata,
50
+ fromLinkedAccounts: () => fromLinkedAccounts,
51
+ isCustomId: () => isCustomId,
52
+ isDiscord: () => isDiscord,
53
+ isEmail: () => isEmail,
54
+ isExternalWallet: () => isExternalWallet,
55
+ isExternalWalletAddress: () => isExternalWalletAddress,
56
+ isFarcaster: () => isFarcaster,
57
+ isGuestId: () => isGuestId,
58
+ isPhone: () => isPhone,
59
+ isPhoneLegacy: () => isPhoneLegacy,
60
+ isPregenAuth: () => isPregenAuth,
61
+ isPrimary: () => isPrimary,
62
+ isTelegram: () => isTelegram,
63
+ isUserId: () => isUserId,
64
+ isVerifiedAuth: () => isVerifiedAuth,
65
+ isWalletId: () => isWalletId,
66
+ isX: () => isX,
67
+ toPregenIds: () => toPregenIds,
68
+ toPregenTypeAndId: () => toPregenTypeAndId
69
+ });
70
+ module.exports = __toCommonJS(utils_exports);
71
+ var import_libphonenumber_js = __toESM(require("libphonenumber-js"));
72
+ function isWalletId(params) {
73
+ return !!params.walletId && !params.externalWalletAddress;
74
+ }
75
+ function isExternalWalletAddress(params) {
76
+ return !!params.externalWalletAddress && !params.walletId;
77
+ }
78
+ function extractWalletRef(params) {
79
+ if (isWalletId(params)) {
80
+ return ["walletId", params.walletId];
81
+ } else if (isExternalWalletAddress(params)) {
82
+ return ["externalWalletAddress", params.externalWalletAddress];
83
+ }
84
+ throw new Error("invalid wallet params");
85
+ }
86
+ function isValid(s) {
87
+ return !!s && s !== "null" && s !== "undefined" && s !== "";
88
+ }
89
+ function isEmail(params) {
90
+ return !!params && isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
91
+ }
92
+ function isPhone(params) {
93
+ return !!params && isValid(params.phone) && /^\+\d+$/.test(params.phone) && !isValid(params.countryCode) && !isValid(params.email) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.userId) && !isValid(params.externalWalletAddress);
94
+ }
95
+ function isPhoneLegacy(params) {
96
+ return !!params && isValid(params.phone) && isValid(params.countryCode) && !isValid(params.email) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
97
+ }
98
+ function isFarcaster(params) {
99
+ return !!params && isValid(params.farcasterUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
100
+ }
101
+ function isTelegram(params) {
102
+ return !!params && isValid(params.telegramUserId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
103
+ }
104
+ function isExternalWallet(params) {
105
+ return !!params && isValid(params.externalWalletAddress) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId);
106
+ }
107
+ function isX(params) {
108
+ return !!params && isValid(params.xUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
109
+ }
110
+ function isDiscord(params) {
111
+ return !!params && isValid(params.discordUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
112
+ }
113
+ function isCustomId(params) {
114
+ return !!params && isValid(params.customId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.externalWalletAddress);
115
+ }
116
+ function isGuestId(params) {
117
+ return !!params && isValid(params.guestId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.externalWalletAddress);
118
+ }
119
+ function isUserId(params) {
120
+ return !!params && isValid(params.userId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.xUsername) && !isValid(params.discordUsername) && !isValid(params.customId) && !isValid(params.telegramUserId) && !isValid(params.externalWalletAddress);
121
+ }
122
+ function isPrimary(params) {
123
+ return isEmail(params) || isPhone(params) || isFarcaster(params) || isTelegram(params) || isExternalWallet(params);
124
+ }
125
+ function isVerifiedAuth(params) {
126
+ return isEmail(params) || isPhone(params);
127
+ }
128
+ function isPregenAuth(params) {
129
+ return isPrimary(params) && !isExternalWallet(params) || isX(params) || isDiscord(params) || isCustomId(params);
130
+ }
131
+ function extractAuthInfo(obj, { allowUserId = false, allowPregen = false, isRequired = false } = {}) {
132
+ obj = Object.entries(obj || {}).reduce((acc, [k, v]) => {
133
+ return __spreadValues(__spreadValues({}, acc), !!v && v !== "null" && v !== "undefined" && v !== "" ? { [k]: v } : {});
134
+ }, {});
135
+ let error;
136
+ switch (true) {
137
+ case isEmail(obj):
138
+ return {
139
+ auth: { email: obj.email },
140
+ authType: "email",
141
+ identifier: obj.email
142
+ };
143
+ case isPhone(obj):
144
+ if (!(0, import_libphonenumber_js.default)(obj.phone)) {
145
+ error = "invalid phone number";
146
+ break;
147
+ }
148
+ return {
149
+ auth: { phone: obj.phone },
150
+ authType: "phone",
151
+ identifier: obj.phone
152
+ };
153
+ case isPhoneLegacy(obj):
154
+ const identifier = `${obj.countryCode.startsWith("+") ? "" : "+"}${obj.countryCode}${obj.phone}`;
155
+ if (!(0, import_libphonenumber_js.default)(identifier)) {
156
+ error = "invalid phone number";
157
+ break;
158
+ }
159
+ return {
160
+ auth: { phone: identifier },
161
+ authType: "phone",
162
+ identifier
163
+ };
164
+ case isFarcaster(obj):
165
+ return {
166
+ auth: { farcasterUsername: obj.farcasterUsername },
167
+ authType: "farcaster",
168
+ identifier: obj.farcasterUsername
169
+ };
170
+ case isTelegram(obj):
171
+ return {
172
+ auth: { telegramUserId: obj.telegramUserId },
173
+ authType: "telegram",
174
+ identifier: obj.telegramUserId
175
+ };
176
+ case isExternalWallet(obj):
177
+ return {
178
+ auth: { externalWalletAddress: obj.externalWalletAddress },
179
+ authType: "externalWallet",
180
+ identifier: obj.externalWalletAddress
181
+ };
182
+ case (allowPregen && isX(obj)):
183
+ return {
184
+ auth: { xUsername: obj.xUsername },
185
+ authType: "x",
186
+ identifier: obj.xUsername
187
+ };
188
+ case (allowPregen && isDiscord(obj)):
189
+ return {
190
+ auth: { discordUsername: obj.discordUsername },
191
+ authType: "discord",
192
+ identifier: obj.discordUsername
193
+ };
194
+ case (allowPregen && isCustomId(obj)):
195
+ return {
196
+ auth: { customId: obj.customId },
197
+ authType: "customId",
198
+ identifier: obj.customId
199
+ };
200
+ case (allowPregen && isGuestId(obj)):
201
+ return {
202
+ auth: { guestId: obj.guestId },
203
+ authType: "guestId",
204
+ identifier: obj.guestId
205
+ };
206
+ case (isUserId(obj) && allowUserId):
207
+ return {
208
+ auth: { userId: obj.userId },
209
+ authType: "userId",
210
+ identifier: obj.userId
211
+ };
212
+ default:
213
+ break;
214
+ }
215
+ if (isRequired) {
216
+ throw new Error(error != null ? error : "invalid auth object");
217
+ }
218
+ return void 0;
219
+ }
220
+ function toPregenTypeAndId(auth) {
221
+ const { authType, identifier: pregenIdentifier } = extractAuthInfo(auth, { isRequired: true, allowPregen: true });
222
+ const pregenIdentifierType = {
223
+ email: "EMAIL",
224
+ phone: "PHONE",
225
+ farcaster: "FARCASTER",
226
+ telegram: "TELEGRAM",
227
+ discord: "DISCORD",
228
+ x: "TWITTER",
229
+ customId: "CUSTOM_ID",
230
+ guestId: "GUEST_ID"
231
+ }[authType];
232
+ return [pregenIdentifierType, pregenIdentifier];
233
+ }
234
+ function toPregenIds(auth) {
235
+ const [pregenIdentifierType, pregenIdentifier] = toPregenTypeAndId(auth);
236
+ return { [pregenIdentifierType]: [pregenIdentifier] };
237
+ }
238
+ function fromAccountMetadata(obj) {
239
+ return Object.entries(obj || {}).reduce(
240
+ (acc, [method, obj2]) => __spreadProps(__spreadValues({}, acc), {
241
+ [method]: __spreadProps(__spreadValues({}, obj2), {
242
+ date: new Date(obj2.date)
243
+ })
244
+ }),
245
+ {}
246
+ );
247
+ }
248
+ function fromLinkedAccounts({ primary, linked }) {
249
+ return {
250
+ primary: primary.map((account) => __spreadProps(__spreadValues({}, account), {
251
+ date: new Date(account.date)
252
+ })),
253
+ linked: linked.map((account) => __spreadProps(__spreadValues({}, account), {
254
+ date: new Date(account.date)
255
+ }))
256
+ };
257
+ }
258
+ // Annotate the CommonJS export names for ESM import in node:
259
+ 0 && (module.exports = {
260
+ extractAuthInfo,
261
+ extractWalletRef,
262
+ fromAccountMetadata,
263
+ fromLinkedAccounts,
264
+ isCustomId,
265
+ isDiscord,
266
+ isEmail,
267
+ isExternalWallet,
268
+ isExternalWalletAddress,
269
+ isFarcaster,
270
+ isGuestId,
271
+ isPhone,
272
+ isPhoneLegacy,
273
+ isPregenAuth,
274
+ isPrimary,
275
+ isTelegram,
276
+ isUserId,
277
+ isVerifiedAuth,
278
+ isWalletId,
279
+ isX,
280
+ toPregenIds,
281
+ toPregenTypeAndId
282
+ });