@getpara/shared 1.23.0 → 1.25.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.
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/schemas/permissionsV2.js +188 -0
- package/dist/cjs/types/assets.js +5 -1
- package/dist/cjs/types/auth.js +19 -1
- package/dist/cjs/types/authState.js +7 -2
- package/dist/cjs/types/index.js +2 -0
- package/dist/cjs/types/permissions.js +2 -0
- package/dist/cjs/types/signing.js +2 -0
- package/dist/cjs/types/wallet.js +8 -1
- package/dist/cjs/utils/index.js +3 -0
- package/dist/esm/index.js +2 -0
- package/dist/esm/schemas/permissionsV2.js +185 -0
- package/dist/esm/types/assets.js +4 -0
- package/dist/esm/types/auth.js +18 -0
- package/dist/esm/types/authState.js +7 -2
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/permissions.js +1 -0
- package/dist/esm/types/signing.js +1 -0
- package/dist/esm/types/wallet.js +8 -1
- package/dist/esm/utils/index.js +3 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/schemas/permissionsV2.d.ts +1642 -0
- package/dist/types/schemas/permissionsV2.d.ts.map +1 -0
- package/dist/types/types/assets.d.ts +7 -1
- package/dist/types/types/assets.d.ts.map +1 -1
- package/dist/types/types/auth.d.ts +8 -2
- package/dist/types/types/auth.d.ts.map +1 -1
- package/dist/types/types/authState.d.ts +48 -3
- package/dist/types/types/authState.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/partner.d.ts +5 -0
- package/dist/types/types/partner.d.ts.map +1 -1
- package/dist/types/types/permissions.d.ts +96 -0
- package/dist/types/types/permissions.d.ts.map +1 -0
- package/dist/types/types/signing.d.ts +27 -0
- package/dist/types/types/signing.d.ts.map +1 -0
- package/dist/types/types/transaction.d.ts +1 -1
- package/dist/types/types/transaction.d.ts.map +1 -1
- package/dist/types/types/wallet.d.ts +8 -4
- package/dist/types/types/wallet.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts.map +1 -1
- package/package.json +5 -4
package/dist/cjs/index.js
CHANGED
|
@@ -38,6 +38,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
39
|
exports.transactionTypes = void 0;
|
|
40
40
|
__exportStar(require("./types/index.js"), exports);
|
|
41
|
+
__exportStar(require("./types/permissions.js"), exports);
|
|
42
|
+
__exportStar(require("./schemas/permissionsV2.js"), exports);
|
|
41
43
|
__exportStar(require("./utils/index.js"), exports);
|
|
42
44
|
const transactionTypes = __importStar(require("./types/transaction.js"));
|
|
43
45
|
exports.transactionTypes = transactionTypes;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.permissionsV2ValidationErrorSchema = exports.permissionsV2DelegationConsentDiscoveryResponseSchema = exports.permissionsV2DelegationConsentRequestSchema = exports.permissionsV2DelegationConsentViewSchema = exports.permissionsV2DelegationConsentStandingMutationSchema = exports.permissionsV2DelegationConsentMutationSchema = exports.permissionsV2DelegationConsentApiStatusSchema = exports.permissionsV2DelegationPolicyDefinitionSchema = exports.permissionsV2PartnerAuthoredPolicyDefinitionSchema = exports.permissionsV2PartnerPolicyCandidateSchema = exports.permissionsV2PolicyRuleSchema = exports.permissionsV2PartnerPolicyMetadataSchema = exports.permissionsV2PolicyMetadataSchema = exports.permissionsV2PartnerAuthoredPolicySelectorSchema = exports.permissionsV2ConditionSchema = exports.policyAuthoringJsonObjectSchema = exports.policyAuthoringJsonValueSchema = exports.policyAuthoringJsonPrimitiveSchema = exports.permissionsV2SigningRequestTypeSchema = exports.permissionsV2SigningRequestRouteSchema = exports.permissionsV2SigningWalletTypeSchema = exports.permissionsV2AggregateOperatorSchema = exports.permissionsV2CompareOperatorSchema = exports.permissionsV2PolicyEffectSchema = exports.permissionsV2PolicyModeSchema = exports.permissionsV2PolicyLayerSchema = exports.permissionsV2SigningRequestTypes = exports.policyAuthoringSigningRequestRoutes = exports.policyAuthoringSigningWalletTypes = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
exports.policyAuthoringSigningWalletTypes = ['EVM'];
|
|
6
|
+
exports.policyAuthoringSigningRequestRoutes = [
|
|
7
|
+
'evm.sign_transaction',
|
|
8
|
+
'evm.sign_raw',
|
|
9
|
+
'evm.sign_typed_data',
|
|
10
|
+
'evm.sign_authorization',
|
|
11
|
+
'evm.sign_message',
|
|
12
|
+
'smart_account.user_operation',
|
|
13
|
+
];
|
|
14
|
+
exports.permissionsV2SigningRequestTypes = [
|
|
15
|
+
'evm_transaction',
|
|
16
|
+
'evm_message',
|
|
17
|
+
'evm_raw',
|
|
18
|
+
'evm_typed_data',
|
|
19
|
+
'evm_authorization',
|
|
20
|
+
'smart_account_user_operation',
|
|
21
|
+
];
|
|
22
|
+
const nonEmptyStringSchema = zod_1.z.string().min(1);
|
|
23
|
+
const uniqueNonEmptyStringsSchema = zod_1.z
|
|
24
|
+
.array(nonEmptyStringSchema)
|
|
25
|
+
.min(1)
|
|
26
|
+
.refine((values) => new Set(values).size === values.length, 'values must be unique');
|
|
27
|
+
exports.permissionsV2PolicyLayerSchema = zod_1.z.enum(['para', 'partner']);
|
|
28
|
+
exports.permissionsV2PolicyModeSchema = zod_1.z.enum(['guardrail', 'delegation']);
|
|
29
|
+
exports.permissionsV2PolicyEffectSchema = zod_1.z.enum(['allow', 'deny', 'require_approval']);
|
|
30
|
+
exports.permissionsV2CompareOperatorSchema = zod_1.z.enum(['eq', 'ne', 'lt', 'lte', 'gt', 'gte', 'in']);
|
|
31
|
+
exports.permissionsV2AggregateOperatorSchema = zod_1.z.enum(['lt', 'lte', 'gt', 'gte']);
|
|
32
|
+
exports.permissionsV2SigningWalletTypeSchema = zod_1.z.enum(exports.policyAuthoringSigningWalletTypes);
|
|
33
|
+
exports.permissionsV2SigningRequestRouteSchema = zod_1.z.enum(exports.policyAuthoringSigningRequestRoutes);
|
|
34
|
+
exports.permissionsV2SigningRequestTypeSchema = zod_1.z.enum(exports.permissionsV2SigningRequestTypes);
|
|
35
|
+
exports.policyAuthoringJsonPrimitiveSchema = zod_1.z.union([
|
|
36
|
+
zod_1.z.string(),
|
|
37
|
+
zod_1.z.number(),
|
|
38
|
+
zod_1.z.boolean(),
|
|
39
|
+
zod_1.z.null(),
|
|
40
|
+
]);
|
|
41
|
+
exports.policyAuthoringJsonValueSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
42
|
+
exports.policyAuthoringJsonPrimitiveSchema,
|
|
43
|
+
zod_1.z.array(exports.policyAuthoringJsonValueSchema),
|
|
44
|
+
zod_1.z.record(exports.policyAuthoringJsonValueSchema),
|
|
45
|
+
]));
|
|
46
|
+
exports.policyAuthoringJsonObjectSchema = zod_1.z.record(exports.policyAuthoringJsonValueSchema);
|
|
47
|
+
exports.permissionsV2ConditionSchema = zod_1.z.lazy(() => zod_1.z.discriminatedUnion('kind', [
|
|
48
|
+
zod_1.z
|
|
49
|
+
.object({
|
|
50
|
+
kind: zod_1.z.literal('compare'),
|
|
51
|
+
fact: nonEmptyStringSchema,
|
|
52
|
+
op: exports.permissionsV2CompareOperatorSchema,
|
|
53
|
+
value: exports.policyAuthoringJsonValueSchema,
|
|
54
|
+
})
|
|
55
|
+
.strict(),
|
|
56
|
+
zod_1.z
|
|
57
|
+
.object({
|
|
58
|
+
kind: zod_1.z.literal('aggregate'),
|
|
59
|
+
fact: nonEmptyStringSchema,
|
|
60
|
+
op: exports.permissionsV2AggregateOperatorSchema,
|
|
61
|
+
value: nonEmptyStringSchema,
|
|
62
|
+
window: nonEmptyStringSchema,
|
|
63
|
+
asset: nonEmptyStringSchema.optional(),
|
|
64
|
+
})
|
|
65
|
+
.strict(),
|
|
66
|
+
zod_1.z
|
|
67
|
+
.object({
|
|
68
|
+
kind: zod_1.z.literal('all'),
|
|
69
|
+
of: zod_1.z.array(exports.permissionsV2ConditionSchema).min(1),
|
|
70
|
+
})
|
|
71
|
+
.strict(),
|
|
72
|
+
zod_1.z
|
|
73
|
+
.object({
|
|
74
|
+
kind: zod_1.z.literal('any'),
|
|
75
|
+
of: zod_1.z.array(exports.permissionsV2ConditionSchema).min(1),
|
|
76
|
+
})
|
|
77
|
+
.strict(),
|
|
78
|
+
zod_1.z
|
|
79
|
+
.object({
|
|
80
|
+
kind: zod_1.z.literal('not'),
|
|
81
|
+
of: exports.permissionsV2ConditionSchema,
|
|
82
|
+
})
|
|
83
|
+
.strict(),
|
|
84
|
+
]));
|
|
85
|
+
exports.permissionsV2PartnerAuthoredPolicySelectorSchema = zod_1.z
|
|
86
|
+
.object({
|
|
87
|
+
walletId: nonEmptyStringSchema.optional(),
|
|
88
|
+
chainId: zod_1.z.union([nonEmptyStringSchema, uniqueNonEmptyStringsSchema]).optional(),
|
|
89
|
+
walletType: exports.permissionsV2SigningWalletTypeSchema.optional(),
|
|
90
|
+
requestRoute: exports.permissionsV2SigningRequestRouteSchema.optional(),
|
|
91
|
+
requestType: exports.permissionsV2SigningRequestTypeSchema.optional(),
|
|
92
|
+
})
|
|
93
|
+
.strict();
|
|
94
|
+
exports.permissionsV2PolicyMetadataSchema = zod_1.z
|
|
95
|
+
.object({
|
|
96
|
+
label: zod_1.z.string().optional(),
|
|
97
|
+
productMode: exports.permissionsV2PolicyModeSchema.optional(),
|
|
98
|
+
description: zod_1.z.string().optional(),
|
|
99
|
+
annotations: exports.policyAuthoringJsonObjectSchema.optional(),
|
|
100
|
+
})
|
|
101
|
+
.strict();
|
|
102
|
+
exports.permissionsV2PartnerPolicyMetadataSchema = exports.permissionsV2PolicyMetadataSchema.extend({
|
|
103
|
+
productMode: exports.permissionsV2PolicyModeSchema,
|
|
104
|
+
});
|
|
105
|
+
exports.permissionsV2PolicyRuleSchema = zod_1.z
|
|
106
|
+
.object({
|
|
107
|
+
id: nonEmptyStringSchema,
|
|
108
|
+
effect: exports.permissionsV2PolicyEffectSchema,
|
|
109
|
+
when: exports.permissionsV2ConditionSchema,
|
|
110
|
+
})
|
|
111
|
+
.strict();
|
|
112
|
+
const partnerPolicyCandidateFields = {
|
|
113
|
+
id: nonEmptyStringSchema,
|
|
114
|
+
schemaVersion: zod_1.z.literal('permissions.policy.v1'),
|
|
115
|
+
version: nonEmptyStringSchema,
|
|
116
|
+
selector: exports.permissionsV2PartnerAuthoredPolicySelectorSchema,
|
|
117
|
+
rules: zod_1.z.array(exports.permissionsV2PolicyRuleSchema).min(1),
|
|
118
|
+
metadata: exports.permissionsV2PolicyMetadataSchema.optional(),
|
|
119
|
+
};
|
|
120
|
+
exports.permissionsV2PartnerPolicyCandidateSchema = zod_1.z.object(partnerPolicyCandidateFields).strict();
|
|
121
|
+
exports.permissionsV2PartnerAuthoredPolicyDefinitionSchema = exports.permissionsV2PartnerPolicyCandidateSchema.extend({
|
|
122
|
+
metadata: exports.permissionsV2PartnerPolicyMetadataSchema,
|
|
123
|
+
});
|
|
124
|
+
exports.permissionsV2DelegationPolicyDefinitionSchema = exports.permissionsV2PartnerAuthoredPolicyDefinitionSchema.extend({
|
|
125
|
+
layer: zod_1.z.literal('partner'),
|
|
126
|
+
selector: exports.permissionsV2PartnerAuthoredPolicySelectorSchema.extend({
|
|
127
|
+
partnerId: nonEmptyStringSchema,
|
|
128
|
+
appId: nonEmptyStringSchema,
|
|
129
|
+
}),
|
|
130
|
+
metadata: exports.permissionsV2PartnerPolicyMetadataSchema.extend({
|
|
131
|
+
productMode: zod_1.z.literal('delegation'),
|
|
132
|
+
}),
|
|
133
|
+
});
|
|
134
|
+
exports.permissionsV2DelegationConsentApiStatusSchema = zod_1.z.enum([
|
|
135
|
+
'pending',
|
|
136
|
+
'standing',
|
|
137
|
+
'manual_review',
|
|
138
|
+
'revoked',
|
|
139
|
+
'expired',
|
|
140
|
+
]);
|
|
141
|
+
exports.permissionsV2DelegationConsentMutationSchema = zod_1.z
|
|
142
|
+
.object({
|
|
143
|
+
partnerId: nonEmptyStringSchema,
|
|
144
|
+
appId: nonEmptyStringSchema,
|
|
145
|
+
walletId: nonEmptyStringSchema,
|
|
146
|
+
policyVersion: nonEmptyStringSchema,
|
|
147
|
+
policyHash: nonEmptyStringSchema,
|
|
148
|
+
expiresAt: zod_1.z.string().datetime().optional(),
|
|
149
|
+
})
|
|
150
|
+
.strict();
|
|
151
|
+
exports.permissionsV2DelegationConsentStandingMutationSchema = exports.permissionsV2DelegationConsentMutationSchema
|
|
152
|
+
.extend({
|
|
153
|
+
pendingTransactionId: nonEmptyStringSchema,
|
|
154
|
+
})
|
|
155
|
+
.strict();
|
|
156
|
+
exports.permissionsV2DelegationConsentViewSchema = zod_1.z
|
|
157
|
+
.object({
|
|
158
|
+
status: exports.permissionsV2DelegationConsentApiStatusSchema,
|
|
159
|
+
userId: nonEmptyStringSchema,
|
|
160
|
+
partnerId: nonEmptyStringSchema,
|
|
161
|
+
appId: nonEmptyStringSchema,
|
|
162
|
+
walletId: nonEmptyStringSchema,
|
|
163
|
+
policyId: nonEmptyStringSchema,
|
|
164
|
+
policyVersion: nonEmptyStringSchema,
|
|
165
|
+
policyHash: nonEmptyStringSchema,
|
|
166
|
+
grantedAt: zod_1.z.string().datetime().optional(),
|
|
167
|
+
expiresAt: zod_1.z.string().datetime().optional(),
|
|
168
|
+
revokedAt: zod_1.z.string().datetime().optional(),
|
|
169
|
+
})
|
|
170
|
+
.strict();
|
|
171
|
+
exports.permissionsV2DelegationConsentRequestSchema = zod_1.z
|
|
172
|
+
.object({
|
|
173
|
+
policy: exports.permissionsV2DelegationPolicyDefinitionSchema,
|
|
174
|
+
consent: exports.permissionsV2DelegationConsentViewSchema,
|
|
175
|
+
})
|
|
176
|
+
.strict();
|
|
177
|
+
exports.permissionsV2DelegationConsentDiscoveryResponseSchema = zod_1.z
|
|
178
|
+
.object({
|
|
179
|
+
requests: zod_1.z.array(exports.permissionsV2DelegationConsentRequestSchema),
|
|
180
|
+
})
|
|
181
|
+
.strict();
|
|
182
|
+
exports.permissionsV2ValidationErrorSchema = zod_1.z
|
|
183
|
+
.object({
|
|
184
|
+
code: zod_1.z.string(),
|
|
185
|
+
path: zod_1.z.string(),
|
|
186
|
+
message: zod_1.z.string(),
|
|
187
|
+
})
|
|
188
|
+
.strict();
|
package/dist/cjs/types/assets.js
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.OnRampMethod = exports.OnRampPurchaseStatus = exports.OnRampPurchaseType = exports.ON_RAMP_ASSETS = exports.OnRampAsset = exports.OnRampProvider = void 0;
|
|
3
|
+
exports.OnRampMethod = exports.OnRampPurchaseStatus = exports.OnRampPurchaseType = exports.ON_RAMP_ASSETS = exports.OnRampAsset = exports.ON_RAMP_PROVIDERS = exports.OnRampProvider = void 0;
|
|
4
|
+
/** @deprecated use `OnRampProvider` string union instead */
|
|
4
5
|
var OnRampProvider;
|
|
5
6
|
(function (OnRampProvider) {
|
|
6
7
|
OnRampProvider["RAMP"] = "RAMP";
|
|
7
8
|
OnRampProvider["STRIPE"] = "STRIPE";
|
|
8
9
|
OnRampProvider["MOONPAY"] = "MOONPAY";
|
|
10
|
+
OnRampProvider["CDP"] = "CDP";
|
|
11
|
+
OnRampProvider["MERCURYO"] = "MERCURYO";
|
|
9
12
|
})(OnRampProvider || (exports.OnRampProvider = OnRampProvider = {}));
|
|
13
|
+
exports.ON_RAMP_PROVIDERS = ['RAMP', 'STRIPE', 'MOONPAY', 'CDP', 'MERCURYO'];
|
|
10
14
|
/** @deprecated use `TOnRampAsset` string union instead */
|
|
11
15
|
var OnRampAsset;
|
|
12
16
|
(function (OnRampAsset) {
|
package/dist/cjs/types/auth.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RecoveryStatus = exports.LegacyAuthMethod = exports.AUTH_METHODS = exports.AuthMethod = exports.LINKED_ACCOUNT_TYPES = exports.OAUTH_METHODS = exports.OAuthMethod = exports.PublicKeyType = exports.AuthMethodStatus = exports.KeyShareType = exports.EncryptorType = exports.AUTH_TYPES = void 0;
|
|
3
|
+
exports.RecoveryStatus = exports.LOGIN_METHODS = exports.LegacyAuthMethod = exports.AUTH_METHODS = exports.AuthMethod = exports.LINKED_ACCOUNT_TYPES = exports.OAUTH_METHODS = exports.OAuthMethod = exports.PublicKeyType = exports.AuthMethodStatus = exports.KeyShareType = exports.EncryptorType = exports.AUTH_TYPES = void 0;
|
|
4
4
|
exports.AUTH_TYPES = [
|
|
5
5
|
'email',
|
|
6
6
|
'phone',
|
|
@@ -57,6 +57,10 @@ exports.OAUTH_METHODS = [
|
|
|
57
57
|
'FARCASTER',
|
|
58
58
|
'TELEGRAM',
|
|
59
59
|
'CUSTOM_OIDC',
|
|
60
|
+
// A partner-configured OAuth2 provider Para ships no first-party adapter for (e.g. Spotify). The specific
|
|
61
|
+
// connection rides on the flow's providerConfigHandle; the generic OAuth2 client uses the connection's
|
|
62
|
+
// stored endpoints. (ENG-7008)
|
|
63
|
+
'CUSTOM_OAUTH',
|
|
60
64
|
];
|
|
61
65
|
exports.LINKED_ACCOUNT_TYPES = [
|
|
62
66
|
'EMAIL',
|
|
@@ -84,6 +88,20 @@ var LegacyAuthMethod;
|
|
|
84
88
|
LegacyAuthMethod["PASSWORD"] = "PASSWORD";
|
|
85
89
|
LegacyAuthMethod["BIOMETRIC"] = "BIOMETRIC";
|
|
86
90
|
})(LegacyAuthMethod || (exports.LegacyAuthMethod = LegacyAuthMethod = {}));
|
|
91
|
+
/**
|
|
92
|
+
* Every way a user row can be established/authenticated. Runtime tuple (mirrors OAUTH_METHODS) so code
|
|
93
|
+
* can iterate the canonical set instead of hand-maintaining parallel lists. OAuth providers are folded
|
|
94
|
+
* in from OAUTH_METHODS; the tail is the non-OAuth methods + the non-login events (PREGEN/REST_API).
|
|
95
|
+
*/
|
|
96
|
+
exports.LOGIN_METHODS = [
|
|
97
|
+
...exports.OAUTH_METHODS,
|
|
98
|
+
'EMAIL',
|
|
99
|
+
'PHONE',
|
|
100
|
+
'EXTERNAL_WALLET',
|
|
101
|
+
'PASSKEY',
|
|
102
|
+
'PREGEN',
|
|
103
|
+
'REST_API',
|
|
104
|
+
];
|
|
87
105
|
var RecoveryStatus;
|
|
88
106
|
(function (RecoveryStatus) {
|
|
89
107
|
RecoveryStatus["INITIATED"] = "INITIATED";
|
|
@@ -23,5 +23,10 @@ exports.AUTH_STATUSES = [
|
|
|
23
23
|
'needs_second_factor', // first factor passed; awaiting a login-time MFA challenge (ENG-6906)
|
|
24
24
|
'authenticated', // done; a session has been established
|
|
25
25
|
];
|
|
26
|
-
/**
|
|
27
|
-
|
|
26
|
+
/**
|
|
27
|
+
* First-factor methods the `/v2/auth` flow handles. Email/phone authenticate via a delivered
|
|
28
|
+
* one-time code; external-wallet by signing a SIWE challenge; passkey by a WebAuthn assertion
|
|
29
|
+
* (usernameless — resolved from the credential at `continue`); oauth by a provider redirect
|
|
30
|
+
* (the specific provider rides on the flow; the account is resolved at `continue`). (ENG-6911)
|
|
31
|
+
*/
|
|
32
|
+
exports.AUTH_FLOW_METHODS = ['EMAIL', 'PHONE', 'EXTERNAL_WALLET', 'PASSKEY', 'OAUTH'];
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -24,6 +24,8 @@ __exportStar(require("./params.js"), exports);
|
|
|
24
24
|
__exportStar(require("./partner.js"), exports);
|
|
25
25
|
__exportStar(require("./partnerAppConfig.js"), exports);
|
|
26
26
|
__exportStar(require("./pending-transaction.js"), exports);
|
|
27
|
+
__exportStar(require("./permissions.js"), exports);
|
|
28
|
+
__exportStar(require("./signing.js"), exports);
|
|
27
29
|
__exportStar(require("./theme.js"), exports);
|
|
28
30
|
__exportStar(require("./transaction.js"), exports);
|
|
29
31
|
__exportStar(require("./wallet.js"), exports);
|
package/dist/cjs/types/wallet.js
CHANGED
|
@@ -16,8 +16,9 @@ var WalletType;
|
|
|
16
16
|
WalletType["SOLANA"] = "SOLANA";
|
|
17
17
|
WalletType["COSMOS"] = "COSMOS";
|
|
18
18
|
WalletType["STELLAR"] = "STELLAR";
|
|
19
|
+
WalletType["SUI"] = "SUI";
|
|
19
20
|
})(WalletType || (exports.WalletType = WalletType = {}));
|
|
20
|
-
exports.WALLET_TYPES = ['EVM', 'SOLANA', 'COSMOS', 'STELLAR'];
|
|
21
|
+
exports.WALLET_TYPES = ['EVM', 'SOLANA', 'COSMOS', 'STELLAR', 'SUI'];
|
|
21
22
|
/* @deprecated */
|
|
22
23
|
var Chain;
|
|
23
24
|
(function (Chain) {
|
|
@@ -42,6 +43,9 @@ var Network;
|
|
|
42
43
|
Network["BERACHAIN"] = "BERACHAIN";
|
|
43
44
|
Network["STELLAR"] = "STELLAR";
|
|
44
45
|
Network["STELLAR_TESTNET"] = "STELLAR_TESTNET";
|
|
46
|
+
Network["SUI"] = "SUI";
|
|
47
|
+
Network["SUI_TESTNET"] = "SUI_TESTNET";
|
|
48
|
+
Network["SUI_DEVNET"] = "SUI_DEVNET";
|
|
45
49
|
})(Network || (exports.Network = Network = {}));
|
|
46
50
|
exports.NETWORKS = [
|
|
47
51
|
'ETHEREUM',
|
|
@@ -56,6 +60,9 @@ exports.NETWORKS = [
|
|
|
56
60
|
'SOLANA_DEVNET',
|
|
57
61
|
'STELLAR',
|
|
58
62
|
'STELLAR_TESTNET',
|
|
63
|
+
'SUI',
|
|
64
|
+
'SUI_TESTNET',
|
|
65
|
+
'SUI_DEVNET',
|
|
59
66
|
'COSMOS',
|
|
60
67
|
'NOBLE',
|
|
61
68
|
];
|
package/dist/cjs/utils/index.js
CHANGED
|
@@ -449,6 +449,9 @@ exports.NETWORK_METADATA = [
|
|
|
449
449
|
},
|
|
450
450
|
{ type: 'STELLAR', internalId: 'STELLAR', name: 'Stellar' },
|
|
451
451
|
{ type: 'STELLAR', internalId: 'STELLAR_TESTNET', name: 'Stellar Testnet' },
|
|
452
|
+
{ type: 'SUI', internalId: 'SUI', name: 'Sui' },
|
|
453
|
+
{ type: 'SUI', internalId: 'SUI_TESTNET', name: 'Sui Testnet' },
|
|
454
|
+
{ type: 'SUI', internalId: 'SUI_DEVNET', name: 'Sui Devnet' },
|
|
452
455
|
{ type: 'COSMOS', internalId: 'COSMOS', name: 'Cosmos' },
|
|
453
456
|
];
|
|
454
457
|
function getChainId(network) {
|
package/dist/esm/index.js
CHANGED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const policyAuthoringSigningWalletTypes = ['EVM'];
|
|
3
|
+
export const policyAuthoringSigningRequestRoutes = [
|
|
4
|
+
'evm.sign_transaction',
|
|
5
|
+
'evm.sign_raw',
|
|
6
|
+
'evm.sign_typed_data',
|
|
7
|
+
'evm.sign_authorization',
|
|
8
|
+
'evm.sign_message',
|
|
9
|
+
'smart_account.user_operation',
|
|
10
|
+
];
|
|
11
|
+
export const permissionsV2SigningRequestTypes = [
|
|
12
|
+
'evm_transaction',
|
|
13
|
+
'evm_message',
|
|
14
|
+
'evm_raw',
|
|
15
|
+
'evm_typed_data',
|
|
16
|
+
'evm_authorization',
|
|
17
|
+
'smart_account_user_operation',
|
|
18
|
+
];
|
|
19
|
+
const nonEmptyStringSchema = z.string().min(1);
|
|
20
|
+
const uniqueNonEmptyStringsSchema = z
|
|
21
|
+
.array(nonEmptyStringSchema)
|
|
22
|
+
.min(1)
|
|
23
|
+
.refine((values) => new Set(values).size === values.length, 'values must be unique');
|
|
24
|
+
export const permissionsV2PolicyLayerSchema = z.enum(['para', 'partner']);
|
|
25
|
+
export const permissionsV2PolicyModeSchema = z.enum(['guardrail', 'delegation']);
|
|
26
|
+
export const permissionsV2PolicyEffectSchema = z.enum(['allow', 'deny', 'require_approval']);
|
|
27
|
+
export const permissionsV2CompareOperatorSchema = z.enum(['eq', 'ne', 'lt', 'lte', 'gt', 'gte', 'in']);
|
|
28
|
+
export const permissionsV2AggregateOperatorSchema = z.enum(['lt', 'lte', 'gt', 'gte']);
|
|
29
|
+
export const permissionsV2SigningWalletTypeSchema = z.enum(policyAuthoringSigningWalletTypes);
|
|
30
|
+
export const permissionsV2SigningRequestRouteSchema = z.enum(policyAuthoringSigningRequestRoutes);
|
|
31
|
+
export const permissionsV2SigningRequestTypeSchema = z.enum(permissionsV2SigningRequestTypes);
|
|
32
|
+
export const policyAuthoringJsonPrimitiveSchema = z.union([
|
|
33
|
+
z.string(),
|
|
34
|
+
z.number(),
|
|
35
|
+
z.boolean(),
|
|
36
|
+
z.null(),
|
|
37
|
+
]);
|
|
38
|
+
export const policyAuthoringJsonValueSchema = z.lazy(() => z.union([
|
|
39
|
+
policyAuthoringJsonPrimitiveSchema,
|
|
40
|
+
z.array(policyAuthoringJsonValueSchema),
|
|
41
|
+
z.record(policyAuthoringJsonValueSchema),
|
|
42
|
+
]));
|
|
43
|
+
export const policyAuthoringJsonObjectSchema = z.record(policyAuthoringJsonValueSchema);
|
|
44
|
+
export const permissionsV2ConditionSchema = z.lazy(() => z.discriminatedUnion('kind', [
|
|
45
|
+
z
|
|
46
|
+
.object({
|
|
47
|
+
kind: z.literal('compare'),
|
|
48
|
+
fact: nonEmptyStringSchema,
|
|
49
|
+
op: permissionsV2CompareOperatorSchema,
|
|
50
|
+
value: policyAuthoringJsonValueSchema,
|
|
51
|
+
})
|
|
52
|
+
.strict(),
|
|
53
|
+
z
|
|
54
|
+
.object({
|
|
55
|
+
kind: z.literal('aggregate'),
|
|
56
|
+
fact: nonEmptyStringSchema,
|
|
57
|
+
op: permissionsV2AggregateOperatorSchema,
|
|
58
|
+
value: nonEmptyStringSchema,
|
|
59
|
+
window: nonEmptyStringSchema,
|
|
60
|
+
asset: nonEmptyStringSchema.optional(),
|
|
61
|
+
})
|
|
62
|
+
.strict(),
|
|
63
|
+
z
|
|
64
|
+
.object({
|
|
65
|
+
kind: z.literal('all'),
|
|
66
|
+
of: z.array(permissionsV2ConditionSchema).min(1),
|
|
67
|
+
})
|
|
68
|
+
.strict(),
|
|
69
|
+
z
|
|
70
|
+
.object({
|
|
71
|
+
kind: z.literal('any'),
|
|
72
|
+
of: z.array(permissionsV2ConditionSchema).min(1),
|
|
73
|
+
})
|
|
74
|
+
.strict(),
|
|
75
|
+
z
|
|
76
|
+
.object({
|
|
77
|
+
kind: z.literal('not'),
|
|
78
|
+
of: permissionsV2ConditionSchema,
|
|
79
|
+
})
|
|
80
|
+
.strict(),
|
|
81
|
+
]));
|
|
82
|
+
export const permissionsV2PartnerAuthoredPolicySelectorSchema = z
|
|
83
|
+
.object({
|
|
84
|
+
walletId: nonEmptyStringSchema.optional(),
|
|
85
|
+
chainId: z.union([nonEmptyStringSchema, uniqueNonEmptyStringsSchema]).optional(),
|
|
86
|
+
walletType: permissionsV2SigningWalletTypeSchema.optional(),
|
|
87
|
+
requestRoute: permissionsV2SigningRequestRouteSchema.optional(),
|
|
88
|
+
requestType: permissionsV2SigningRequestTypeSchema.optional(),
|
|
89
|
+
})
|
|
90
|
+
.strict();
|
|
91
|
+
export const permissionsV2PolicyMetadataSchema = z
|
|
92
|
+
.object({
|
|
93
|
+
label: z.string().optional(),
|
|
94
|
+
productMode: permissionsV2PolicyModeSchema.optional(),
|
|
95
|
+
description: z.string().optional(),
|
|
96
|
+
annotations: policyAuthoringJsonObjectSchema.optional(),
|
|
97
|
+
})
|
|
98
|
+
.strict();
|
|
99
|
+
export const permissionsV2PartnerPolicyMetadataSchema = permissionsV2PolicyMetadataSchema.extend({
|
|
100
|
+
productMode: permissionsV2PolicyModeSchema,
|
|
101
|
+
});
|
|
102
|
+
export const permissionsV2PolicyRuleSchema = z
|
|
103
|
+
.object({
|
|
104
|
+
id: nonEmptyStringSchema,
|
|
105
|
+
effect: permissionsV2PolicyEffectSchema,
|
|
106
|
+
when: permissionsV2ConditionSchema,
|
|
107
|
+
})
|
|
108
|
+
.strict();
|
|
109
|
+
const partnerPolicyCandidateFields = {
|
|
110
|
+
id: nonEmptyStringSchema,
|
|
111
|
+
schemaVersion: z.literal('permissions.policy.v1'),
|
|
112
|
+
version: nonEmptyStringSchema,
|
|
113
|
+
selector: permissionsV2PartnerAuthoredPolicySelectorSchema,
|
|
114
|
+
rules: z.array(permissionsV2PolicyRuleSchema).min(1),
|
|
115
|
+
metadata: permissionsV2PolicyMetadataSchema.optional(),
|
|
116
|
+
};
|
|
117
|
+
export const permissionsV2PartnerPolicyCandidateSchema = z.object(partnerPolicyCandidateFields).strict();
|
|
118
|
+
export const permissionsV2PartnerAuthoredPolicyDefinitionSchema = permissionsV2PartnerPolicyCandidateSchema.extend({
|
|
119
|
+
metadata: permissionsV2PartnerPolicyMetadataSchema,
|
|
120
|
+
});
|
|
121
|
+
export const permissionsV2DelegationPolicyDefinitionSchema = permissionsV2PartnerAuthoredPolicyDefinitionSchema.extend({
|
|
122
|
+
layer: z.literal('partner'),
|
|
123
|
+
selector: permissionsV2PartnerAuthoredPolicySelectorSchema.extend({
|
|
124
|
+
partnerId: nonEmptyStringSchema,
|
|
125
|
+
appId: nonEmptyStringSchema,
|
|
126
|
+
}),
|
|
127
|
+
metadata: permissionsV2PartnerPolicyMetadataSchema.extend({
|
|
128
|
+
productMode: z.literal('delegation'),
|
|
129
|
+
}),
|
|
130
|
+
});
|
|
131
|
+
export const permissionsV2DelegationConsentApiStatusSchema = z.enum([
|
|
132
|
+
'pending',
|
|
133
|
+
'standing',
|
|
134
|
+
'manual_review',
|
|
135
|
+
'revoked',
|
|
136
|
+
'expired',
|
|
137
|
+
]);
|
|
138
|
+
export const permissionsV2DelegationConsentMutationSchema = z
|
|
139
|
+
.object({
|
|
140
|
+
partnerId: nonEmptyStringSchema,
|
|
141
|
+
appId: nonEmptyStringSchema,
|
|
142
|
+
walletId: nonEmptyStringSchema,
|
|
143
|
+
policyVersion: nonEmptyStringSchema,
|
|
144
|
+
policyHash: nonEmptyStringSchema,
|
|
145
|
+
expiresAt: z.string().datetime().optional(),
|
|
146
|
+
})
|
|
147
|
+
.strict();
|
|
148
|
+
export const permissionsV2DelegationConsentStandingMutationSchema = permissionsV2DelegationConsentMutationSchema
|
|
149
|
+
.extend({
|
|
150
|
+
pendingTransactionId: nonEmptyStringSchema,
|
|
151
|
+
})
|
|
152
|
+
.strict();
|
|
153
|
+
export const permissionsV2DelegationConsentViewSchema = z
|
|
154
|
+
.object({
|
|
155
|
+
status: permissionsV2DelegationConsentApiStatusSchema,
|
|
156
|
+
userId: nonEmptyStringSchema,
|
|
157
|
+
partnerId: nonEmptyStringSchema,
|
|
158
|
+
appId: nonEmptyStringSchema,
|
|
159
|
+
walletId: nonEmptyStringSchema,
|
|
160
|
+
policyId: nonEmptyStringSchema,
|
|
161
|
+
policyVersion: nonEmptyStringSchema,
|
|
162
|
+
policyHash: nonEmptyStringSchema,
|
|
163
|
+
grantedAt: z.string().datetime().optional(),
|
|
164
|
+
expiresAt: z.string().datetime().optional(),
|
|
165
|
+
revokedAt: z.string().datetime().optional(),
|
|
166
|
+
})
|
|
167
|
+
.strict();
|
|
168
|
+
export const permissionsV2DelegationConsentRequestSchema = z
|
|
169
|
+
.object({
|
|
170
|
+
policy: permissionsV2DelegationPolicyDefinitionSchema,
|
|
171
|
+
consent: permissionsV2DelegationConsentViewSchema,
|
|
172
|
+
})
|
|
173
|
+
.strict();
|
|
174
|
+
export const permissionsV2DelegationConsentDiscoveryResponseSchema = z
|
|
175
|
+
.object({
|
|
176
|
+
requests: z.array(permissionsV2DelegationConsentRequestSchema),
|
|
177
|
+
})
|
|
178
|
+
.strict();
|
|
179
|
+
export const permissionsV2ValidationErrorSchema = z
|
|
180
|
+
.object({
|
|
181
|
+
code: z.string(),
|
|
182
|
+
path: z.string(),
|
|
183
|
+
message: z.string(),
|
|
184
|
+
})
|
|
185
|
+
.strict();
|
package/dist/esm/types/assets.js
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
/** @deprecated use `OnRampProvider` string union instead */
|
|
1
2
|
export var OnRampProvider;
|
|
2
3
|
(function (OnRampProvider) {
|
|
3
4
|
OnRampProvider["RAMP"] = "RAMP";
|
|
4
5
|
OnRampProvider["STRIPE"] = "STRIPE";
|
|
5
6
|
OnRampProvider["MOONPAY"] = "MOONPAY";
|
|
7
|
+
OnRampProvider["CDP"] = "CDP";
|
|
8
|
+
OnRampProvider["MERCURYO"] = "MERCURYO";
|
|
6
9
|
})(OnRampProvider || (OnRampProvider = {}));
|
|
10
|
+
export const ON_RAMP_PROVIDERS = ['RAMP', 'STRIPE', 'MOONPAY', 'CDP', 'MERCURYO'];
|
|
7
11
|
/** @deprecated use `TOnRampAsset` string union instead */
|
|
8
12
|
export var OnRampAsset;
|
|
9
13
|
(function (OnRampAsset) {
|
package/dist/esm/types/auth.js
CHANGED
|
@@ -54,6 +54,10 @@ export const OAUTH_METHODS = [
|
|
|
54
54
|
'FARCASTER',
|
|
55
55
|
'TELEGRAM',
|
|
56
56
|
'CUSTOM_OIDC',
|
|
57
|
+
// A partner-configured OAuth2 provider Para ships no first-party adapter for (e.g. Spotify). The specific
|
|
58
|
+
// connection rides on the flow's providerConfigHandle; the generic OAuth2 client uses the connection's
|
|
59
|
+
// stored endpoints. (ENG-7008)
|
|
60
|
+
'CUSTOM_OAUTH',
|
|
57
61
|
];
|
|
58
62
|
export const LINKED_ACCOUNT_TYPES = [
|
|
59
63
|
'EMAIL',
|
|
@@ -81,6 +85,20 @@ export var LegacyAuthMethod;
|
|
|
81
85
|
LegacyAuthMethod["PASSWORD"] = "PASSWORD";
|
|
82
86
|
LegacyAuthMethod["BIOMETRIC"] = "BIOMETRIC";
|
|
83
87
|
})(LegacyAuthMethod || (LegacyAuthMethod = {}));
|
|
88
|
+
/**
|
|
89
|
+
* Every way a user row can be established/authenticated. Runtime tuple (mirrors OAUTH_METHODS) so code
|
|
90
|
+
* can iterate the canonical set instead of hand-maintaining parallel lists. OAuth providers are folded
|
|
91
|
+
* in from OAUTH_METHODS; the tail is the non-OAuth methods + the non-login events (PREGEN/REST_API).
|
|
92
|
+
*/
|
|
93
|
+
export const LOGIN_METHODS = [
|
|
94
|
+
...OAUTH_METHODS,
|
|
95
|
+
'EMAIL',
|
|
96
|
+
'PHONE',
|
|
97
|
+
'EXTERNAL_WALLET',
|
|
98
|
+
'PASSKEY',
|
|
99
|
+
'PREGEN',
|
|
100
|
+
'REST_API',
|
|
101
|
+
];
|
|
84
102
|
export var RecoveryStatus;
|
|
85
103
|
(function (RecoveryStatus) {
|
|
86
104
|
RecoveryStatus["INITIATED"] = "INITIATED";
|
|
@@ -20,5 +20,10 @@ export const AUTH_STATUSES = [
|
|
|
20
20
|
'needs_second_factor', // first factor passed; awaiting a login-time MFA challenge (ENG-6906)
|
|
21
21
|
'authenticated', // done; a session has been established
|
|
22
22
|
];
|
|
23
|
-
/**
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* First-factor methods the `/v2/auth` flow handles. Email/phone authenticate via a delivered
|
|
25
|
+
* one-time code; external-wallet by signing a SIWE challenge; passkey by a WebAuthn assertion
|
|
26
|
+
* (usernameless — resolved from the credential at `continue`); oauth by a provider redirect
|
|
27
|
+
* (the specific provider rides on the flow; the account is resolved at `continue`). (ENG-6911)
|
|
28
|
+
*/
|
|
29
|
+
export const AUTH_FLOW_METHODS = ['EMAIL', 'PHONE', 'EXTERNAL_WALLET', 'PASSKEY', 'OAUTH'];
|
package/dist/esm/types/index.js
CHANGED
|
@@ -8,6 +8,8 @@ export * from './params.js';
|
|
|
8
8
|
export * from './partner.js';
|
|
9
9
|
export * from './partnerAppConfig.js';
|
|
10
10
|
export * from './pending-transaction.js';
|
|
11
|
+
export * from './permissions.js';
|
|
12
|
+
export * from './signing.js';
|
|
11
13
|
export * from './theme.js';
|
|
12
14
|
export * from './transaction.js';
|
|
13
15
|
export * from './wallet.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/esm/types/wallet.js
CHANGED
|
@@ -13,8 +13,9 @@ export var WalletType;
|
|
|
13
13
|
WalletType["SOLANA"] = "SOLANA";
|
|
14
14
|
WalletType["COSMOS"] = "COSMOS";
|
|
15
15
|
WalletType["STELLAR"] = "STELLAR";
|
|
16
|
+
WalletType["SUI"] = "SUI";
|
|
16
17
|
})(WalletType || (WalletType = {}));
|
|
17
|
-
export const WALLET_TYPES = ['EVM', 'SOLANA', 'COSMOS', 'STELLAR'];
|
|
18
|
+
export const WALLET_TYPES = ['EVM', 'SOLANA', 'COSMOS', 'STELLAR', 'SUI'];
|
|
18
19
|
/* @deprecated */
|
|
19
20
|
export var Chain;
|
|
20
21
|
(function (Chain) {
|
|
@@ -39,6 +40,9 @@ export var Network;
|
|
|
39
40
|
Network["BERACHAIN"] = "BERACHAIN";
|
|
40
41
|
Network["STELLAR"] = "STELLAR";
|
|
41
42
|
Network["STELLAR_TESTNET"] = "STELLAR_TESTNET";
|
|
43
|
+
Network["SUI"] = "SUI";
|
|
44
|
+
Network["SUI_TESTNET"] = "SUI_TESTNET";
|
|
45
|
+
Network["SUI_DEVNET"] = "SUI_DEVNET";
|
|
42
46
|
})(Network || (Network = {}));
|
|
43
47
|
export const NETWORKS = [
|
|
44
48
|
'ETHEREUM',
|
|
@@ -53,6 +57,9 @@ export const NETWORKS = [
|
|
|
53
57
|
'SOLANA_DEVNET',
|
|
54
58
|
'STELLAR',
|
|
55
59
|
'STELLAR_TESTNET',
|
|
60
|
+
'SUI',
|
|
61
|
+
'SUI_TESTNET',
|
|
62
|
+
'SUI_DEVNET',
|
|
56
63
|
'COSMOS',
|
|
57
64
|
'NOBLE',
|
|
58
65
|
];
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -430,6 +430,9 @@ export const NETWORK_METADATA = [
|
|
|
430
430
|
},
|
|
431
431
|
{ type: 'STELLAR', internalId: 'STELLAR', name: 'Stellar' },
|
|
432
432
|
{ type: 'STELLAR', internalId: 'STELLAR_TESTNET', name: 'Stellar Testnet' },
|
|
433
|
+
{ type: 'SUI', internalId: 'SUI', name: 'Sui' },
|
|
434
|
+
{ type: 'SUI', internalId: 'SUI_TESTNET', name: 'Sui Testnet' },
|
|
435
|
+
{ type: 'SUI', internalId: 'SUI_DEVNET', name: 'Sui Devnet' },
|
|
433
436
|
{ type: 'COSMOS', internalId: 'COSMOS', name: 'Cosmos' },
|
|
434
437
|
];
|
|
435
438
|
export function getChainId(network) {
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,kBAAkB,CAAC;AAEjC,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AAEjC,OAAO,KAAK,gBAAgB,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|