@getpara/user-management-client 1.2.0 → 1.3.1

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,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.API_KEY_HEADER_NAME = exports.PARTNER_ID_HEADER_NAME = exports.VERSION_HEADER_NAME = exports.SESSION_COOKIE_HEADER_NAME = void 0;
4
- exports.SESSION_COOKIE_HEADER_NAME = 'x-capsule-sid';
5
- exports.VERSION_HEADER_NAME = 'x-para-version';
6
- exports.PARTNER_ID_HEADER_NAME = 'x-partner-id';
7
- exports.API_KEY_HEADER_NAME = 'X-External-API-Key';
package/dist/cjs/error.js DELETED
@@ -1,19 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ParaApiError = ParaApiError;
4
- function ParaApiError(message, code, status, responseURL) {
5
- Error.call(this);
6
- if (Error.captureStackTrace) {
7
- Error.captureStackTrace(this, this.constructor);
8
- }
9
- else {
10
- this.stack = new Error().stack;
11
- }
12
- this.message = message;
13
- this.name = 'ParaApiError';
14
- code && (this.code = code);
15
- status && (this.status = status);
16
- responseURL && (this.responseURL = responseURL);
17
- }
18
- const prototype = ParaApiError.prototype;
19
- Object.defineProperty(prototype, 'isParaApiError', { value: true });
@@ -1 +0,0 @@
1
- {"type":"commonjs"}
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AuthMethod = exports.OAuthMethod = exports.PublicKeyType = exports.PublicKeyStatus = exports.PasswordStatus = exports.KeyShareType = exports.EncryptorType = void 0;
4
- var EncryptorType;
5
- (function (EncryptorType) {
6
- EncryptorType["USER"] = "USER";
7
- EncryptorType["RECOVERY"] = "RECOVERY";
8
- EncryptorType["BIOMETRICS"] = "BIOMETRICS";
9
- EncryptorType["PASSWORD"] = "PASSWORD";
10
- })(EncryptorType || (exports.EncryptorType = EncryptorType = {}));
11
- var KeyShareType;
12
- (function (KeyShareType) {
13
- KeyShareType["USER"] = "USER";
14
- KeyShareType["RECOVERY"] = "RECOVERY";
15
- })(KeyShareType || (exports.KeyShareType = KeyShareType = {}));
16
- var PasswordStatus;
17
- (function (PasswordStatus) {
18
- PasswordStatus["PENDING"] = "PENDING";
19
- PasswordStatus["COMPLETE"] = "COMPLETE";
20
- })(PasswordStatus || (exports.PasswordStatus = PasswordStatus = {}));
21
- var PublicKeyStatus;
22
- (function (PublicKeyStatus) {
23
- PublicKeyStatus["PENDING"] = "PENDING";
24
- PublicKeyStatus["COMPLETE"] = "COMPLETE";
25
- })(PublicKeyStatus || (exports.PublicKeyStatus = PublicKeyStatus = {}));
26
- var PublicKeyType;
27
- (function (PublicKeyType) {
28
- PublicKeyType["MOBILE"] = "MOBILE";
29
- PublicKeyType["WEB"] = "WEB";
30
- })(PublicKeyType || (exports.PublicKeyType = PublicKeyType = {}));
31
- var OAuthMethod;
32
- (function (OAuthMethod) {
33
- OAuthMethod["GOOGLE"] = "GOOGLE";
34
- OAuthMethod["TWITTER"] = "TWITTER";
35
- OAuthMethod["APPLE"] = "APPLE";
36
- OAuthMethod["DISCORD"] = "DISCORD";
37
- OAuthMethod["FACEBOOK"] = "FACEBOOK";
38
- OAuthMethod["FARCASTER"] = "FARCASTER";
39
- OAuthMethod["TELEGRAM"] = "TELEGRAM";
40
- })(OAuthMethod || (exports.OAuthMethod = OAuthMethod = {}));
41
- var AuthMethod;
42
- (function (AuthMethod) {
43
- AuthMethod["PASSWORD"] = "PASSWORD";
44
- AuthMethod["PASSKEY"] = "PASSKEY";
45
- })(AuthMethod || (exports.AuthMethod = AuthMethod = {}));
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.EmailTheme = void 0;
4
- var EmailTheme;
5
- (function (EmailTheme) {
6
- EmailTheme["LIGHT"] = "light";
7
- EmailTheme["DARK"] = "dark";
8
- })(EmailTheme || (exports.EmailTheme = EmailTheme = {}));
@@ -1,21 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./auth.js"), exports);
18
- __exportStar(require("./email.js"), exports);
19
- __exportStar(require("./onRamp.js"), exports);
20
- __exportStar(require("./partner.js"), exports);
21
- __exportStar(require("./wallet.js"), exports);
@@ -1,33 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.OnRampPurchaseType = exports.OnRampPurchaseStatus = exports.OnRampAsset = exports.OnRampProvider = void 0;
4
- var OnRampProvider;
5
- (function (OnRampProvider) {
6
- OnRampProvider["RAMP"] = "RAMP";
7
- OnRampProvider["STRIPE"] = "STRIPE";
8
- OnRampProvider["MOONPAY"] = "MOONPAY";
9
- })(OnRampProvider || (exports.OnRampProvider = OnRampProvider = {}));
10
- var OnRampAsset;
11
- (function (OnRampAsset) {
12
- OnRampAsset["ETHEREUM"] = "ETHEREUM";
13
- OnRampAsset["USDC"] = "USDC";
14
- OnRampAsset["TETHER"] = "TETHER";
15
- OnRampAsset["POLYGON"] = "POLYGON";
16
- OnRampAsset["SOLANA"] = "SOLANA";
17
- OnRampAsset["ATOM"] = "ATOM";
18
- OnRampAsset["CELO"] = "CELO";
19
- OnRampAsset["CUSD"] = "CUSD";
20
- OnRampAsset["CEUR"] = "CEUR";
21
- OnRampAsset["CREAL"] = "CREAL";
22
- })(OnRampAsset || (exports.OnRampAsset = OnRampAsset = {}));
23
- var OnRampPurchaseStatus;
24
- (function (OnRampPurchaseStatus) {
25
- OnRampPurchaseStatus["INITIATED"] = "INITIATED";
26
- OnRampPurchaseStatus["FINISHED"] = "FINISHED";
27
- OnRampPurchaseStatus["CANCELLED"] = "CANCELLED";
28
- })(OnRampPurchaseStatus || (exports.OnRampPurchaseStatus = OnRampPurchaseStatus = {}));
29
- var OnRampPurchaseType;
30
- (function (OnRampPurchaseType) {
31
- OnRampPurchaseType["BUY"] = "BUY";
32
- OnRampPurchaseType["SELL"] = "SELL";
33
- })(OnRampPurchaseType || (exports.OnRampPurchaseType = OnRampPurchaseType = {}));
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,44 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.NON_ED25519 = exports.PREGEN_IDENTIFIER_TYPES = exports.Network = exports.Chain = exports.WalletType = exports.WalletScheme = void 0;
4
- const auth_js_1 = require("./auth.js");
5
- var WalletScheme;
6
- (function (WalletScheme) {
7
- WalletScheme["DKLS"] = "DKLS";
8
- WalletScheme["CGGMP"] = "CGGMP";
9
- WalletScheme["ED25519"] = "ED25519";
10
- })(WalletScheme || (exports.WalletScheme = WalletScheme = {}));
11
- var WalletType;
12
- (function (WalletType) {
13
- WalletType["EVM"] = "EVM";
14
- WalletType["SOLANA"] = "SOLANA";
15
- WalletType["COSMOS"] = "COSMOS";
16
- })(WalletType || (exports.WalletType = WalletType = {}));
17
- var Chain;
18
- (function (Chain) {
19
- Chain["ETH"] = "ETH";
20
- Chain["CELO"] = "CELO";
21
- Chain["MATIC"] = "MATIC";
22
- })(Chain || (exports.Chain = Chain = {}));
23
- var Network;
24
- (function (Network) {
25
- Network["ETHEREUM"] = "ETHEREUM";
26
- Network["SEPOLIA"] = "SEPOLIA";
27
- Network["ARBITRUM"] = "ARBITRUM";
28
- Network["BASE"] = "BASE";
29
- Network["OPTIMISM"] = "OPTIMISM";
30
- Network["POLYGON"] = "POLYGON";
31
- Network["SOLANA"] = "SOLANA";
32
- Network["COSMOS"] = "COSMOS";
33
- Network["CELO"] = "CELO";
34
- Network["NOBLE"] = "NOBLE";
35
- })(Network || (exports.Network = Network = {}));
36
- exports.PREGEN_IDENTIFIER_TYPES = [
37
- 'EMAIL',
38
- 'PHONE',
39
- 'CUSTOM_ID',
40
- auth_js_1.OAuthMethod.DISCORD,
41
- auth_js_1.OAuthMethod.TWITTER,
42
- auth_js_1.OAuthMethod.TELEGRAM,
43
- ];
44
- exports.NON_ED25519 = [WalletScheme.DKLS, WalletScheme.CGGMP];
package/dist/cjs/utils.js DELETED
@@ -1,99 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isWalletId = isWalletId;
4
- exports.isExternalWalletAddress = isExternalWalletAddress;
5
- exports.extractWalletRef = extractWalletRef;
6
- exports.isEmail = isEmail;
7
- exports.isPhone = isPhone;
8
- exports.isFarcaster = isFarcaster;
9
- exports.isTelegram = isTelegram;
10
- exports.isUserId = isUserId;
11
- exports.extractAuthInfo = extractAuthInfo;
12
- function isWalletId(params) {
13
- return !!params.walletId && !params.externalWalletAddress;
14
- }
15
- function isExternalWalletAddress(params) {
16
- return !!params.externalWalletAddress && !params.walletId;
17
- }
18
- function extractWalletRef(params) {
19
- if (isWalletId(params)) {
20
- return ['walletId', params.walletId];
21
- }
22
- else if (isExternalWalletAddress(params)) {
23
- return ['externalWalletAddress', params.externalWalletAddress];
24
- }
25
- throw new Error('invalid wallet params');
26
- }
27
- function isValid(s) {
28
- return !!s && s !== 'null' && s !== 'undefined' && s !== '';
29
- }
30
- function isEmail(params) {
31
- return (isValid(params.email) &&
32
- !isValid(params.phone) &&
33
- !isValid(params.countryCode) &&
34
- !isValid(params.farcasterUsername) &&
35
- !isValid(params.telegramUserId));
36
- }
37
- function isPhone(params) {
38
- return (isValid(params.phone) &&
39
- isValid(params.countryCode) &&
40
- !isValid(params.email) &&
41
- !isValid(params.farcasterUsername) &&
42
- !isValid(params.telegramUserId));
43
- }
44
- function isFarcaster(params) {
45
- return (isValid(params.farcasterUsername) &&
46
- !isValid(params.email) &&
47
- !isValid(params.phone) &&
48
- !isValid(params.countryCode) &&
49
- !isValid(params.telegramUserId));
50
- }
51
- function isTelegram(params) {
52
- return (isValid(params.telegramUserId) &&
53
- !isValid(params.email) &&
54
- !isValid(params.phone) &&
55
- !isValid(params.countryCode) &&
56
- !isValid(params.farcasterUsername));
57
- }
58
- function isUserId(params) {
59
- return (isValid(params.userId) &&
60
- !isValid(params.email) &&
61
- !isValid(params.phone) &&
62
- !isValid(params.countryCode) &&
63
- !isValid(params.farcasterUsername) &&
64
- !isValid(params.telegramUserId));
65
- }
66
- function extractAuthInfo(obj, { allowUserId = false, isRequired = false } = {}) {
67
- switch (true) {
68
- case isEmail(obj):
69
- return { auth: { email: obj.email }, authType: 'email', identifier: obj.email, publicKeyIdentifier: obj.email };
70
- case isPhone(obj):
71
- return {
72
- auth: { phone: obj.phone, countryCode: obj.countryCode },
73
- authType: 'phone',
74
- identifier: `${obj.countryCode}${obj.phone}`,
75
- publicKeyIdentifier: `${obj.countryCode}${obj.phone}`,
76
- };
77
- case isFarcaster(obj):
78
- return {
79
- auth: { farcasterUsername: obj.farcasterUsername },
80
- authType: 'farcaster',
81
- identifier: obj.farcasterUsername,
82
- publicKeyIdentifier: `${obj.farcasterUsername}-farcaster`,
83
- };
84
- case isTelegram(obj):
85
- return {
86
- auth: { telegramUserId: obj.telegramUserId },
87
- authType: 'telegram',
88
- identifier: obj.telegramUserId,
89
- publicKeyIdentifier: `${obj.telegramUserId}-telegram`,
90
- };
91
- case isUserId(obj) && allowUserId:
92
- return { auth: { userId: obj.userId }, authType: 'userId', identifier: obj.userId, publicKeyIdentifier: obj.userId };
93
- default:
94
- if (isRequired) {
95
- throw new Error('invalid auth object');
96
- }
97
- return undefined;
98
- }
99
- }