@getpara/shared 1.33.0 → 1.35.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/schemas/permissionsV2.js +72 -12
- package/dist/cjs/schemas/permissionsV2Lifecycle.js +2 -3
- package/dist/cjs/types/auth.js +7 -1
- package/dist/cjs/types/index.js +2 -0
- package/dist/cjs/types/partner.js +8 -1
- package/dist/cjs/types/restTransfer.js +2 -0
- package/dist/cjs/types/twoFactor.js +2 -0
- package/dist/cjs/types/webhook.js +4 -0
- package/dist/esm/schemas/permissionsV2.js +70 -10
- package/dist/esm/schemas/permissionsV2Lifecycle.js +2 -3
- package/dist/esm/types/auth.js +6 -0
- package/dist/esm/types/index.js +2 -0
- package/dist/esm/types/partner.js +7 -0
- package/dist/esm/types/restTransfer.js +1 -0
- package/dist/esm/types/twoFactor.js +1 -0
- package/dist/esm/types/webhook.js +4 -0
- package/dist/types/schemas/permissionsV2.d.ts +178 -147
- package/dist/types/schemas/permissionsV2.d.ts.map +1 -1
- package/dist/types/schemas/permissionsV2Lifecycle.d.ts +170 -196
- package/dist/types/schemas/permissionsV2Lifecycle.d.ts.map +1 -1
- package/dist/types/types/auth.d.ts +55 -1
- package/dist/types/types/auth.d.ts.map +1 -1
- package/dist/types/types/authState.d.ts +6 -0
- 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 +4 -0
- package/dist/types/types/partner.d.ts.map +1 -1
- package/dist/types/types/partnerAppConfig.d.ts +14 -0
- package/dist/types/types/partnerAppConfig.d.ts.map +1 -1
- package/dist/types/types/pending-transaction.d.ts +4 -8
- package/dist/types/types/pending-transaction.d.ts.map +1 -1
- package/dist/types/types/permissions.d.ts +3 -1
- package/dist/types/types/permissions.d.ts.map +1 -1
- package/dist/types/types/restTransfer.d.ts +11 -0
- package/dist/types/types/restTransfer.d.ts.map +1 -0
- package/dist/types/types/signing.d.ts +39 -0
- package/dist/types/types/signing.d.ts.map +1 -1
- package/dist/types/types/twoFactor.d.ts +100 -0
- package/dist/types/types/twoFactor.d.ts.map +1 -0
- package/dist/types/types/webhook.d.ts +51 -3
- package/dist/types/types/webhook.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
exports.permissionsV2ValidationErrorSchema = exports.permissionsV2DelegationConsentDiscoveryResponseSchema = exports.permissionsV2DelegationConsentSubmissionResponseSchema = exports.permissionsV2DelegationConsentRequestSchema = void 0;
|
|
3
|
+
exports.permissionsV2DelegationConsentNativeStandingMutationSchema = exports.permissionsV2DelegationConsentStandingMutationSchema = exports.permissionsV2DelegationConsentMutationSchema = exports.permissionsV2DelegationConsentApiStatusSchema = exports.permissionsV2DelegationPolicyDefinitionSchema = exports.permissionsV2PartnerAuthoredPolicyDefinitionSchema = exports.permissionsV2PartnerPolicyCandidateSchema = exports.permissionsV2PolicyRuleSchema = exports.permissionsV2RuleActionsSchema = exports.permissionsV2ConditionalApprovalCaseListSchema = exports.permissionsV2TransactionSignatureCollectionSchema = exports.permissionsV2ConditionalApprovalSignatureSchema = exports.permissionsV2ConditionalApprovalDecisionSchema = exports.permissionsV2AuthorizationConfigurationViewSchema = exports.permissionsV2AuthorizationConfigurationWriteSchema = exports.permissionsV2AuthorizationScopeBindingViewSchema = exports.permissionsV2AuthorizationScopeBindingWriteSchema = exports.permissionsV2AuthoritySetViewSchema = exports.permissionsV2AuthoritySetWriteSchema = exports.permissionsV2AuthorityAssignmentSchema = exports.permissionsV2ConditionalApprovalCaseViewSchema = exports.permissionsV2ConditionalApprovalRequirementIdentitySchema = exports.permissionsV2ConditionalApprovalDecisionCapabilitySchema = exports.permissionsV2ConditionalApprovalDecisionUnavailableReasonSchema = exports.permissionsV2ConditionalApprovalCaseStatusSchema = exports.permissionsV2ConditionalApprovalRequirementSchema = exports.permissionsV2ConditionalApprovalSafeKnobSchema = exports.permissionsV2ConditionalApprovalStageSchema = exports.permissionsV2ConditionalApprovalEligibilitySchema = exports.permissionsV2PartnerPolicyMetadataSchema = exports.permissionsV2PolicyMetadataSchema = exports.permissionsV2PartnerAuthoredPolicySelectorSchema = exports.permissionsV2ConditionSchema = exports.policyAuthoringJsonObjectSchema = exports.policyAuthoringJsonValueSchema = exports.policyAuthoringJsonPrimitiveSchema = exports.permissionsV2RuleActionSchema = exports.permissionsV2SigningRequestTypeSchema = exports.permissionsV2SigningWalletTypeSchema = exports.permissionsV2AggregateOperatorSchema = exports.permissionsV2CompareOperatorSchema = exports.permissionsV2PolicyEffectSchema = exports.permissionsV2PolicyModeSchema = exports.permissionsV2PolicyLayerSchema = exports.permissionsV2ParameterDeclarationSchema = exports.permissionsV2RuleActionsByWalletType = exports.permissionsV2RuleActions = exports.permissionsV2SigningRequestTypes = exports.policyAuthoringSigningRequestRoutes = exports.policyAuthoringSigningWalletTypes = void 0;
|
|
4
|
+
exports.permissionsV2ValidationErrorSchema = exports.permissionsV2DelegationConsentDiscoveryResponseSchema = exports.permissionsV2DelegationConsentSubmissionResponseSchema = exports.permissionsV2DelegationConsentRequestSchema = exports.permissionsV2DelegationConsentViewSchema = exports.permissionsV2DelegationConsentSubmissionSchema = exports.permissionsV2DelegationConsentStandingRouteMutationSchema = void 0;
|
|
5
5
|
const zod_1 = require("zod");
|
|
6
6
|
const permissionsV2UserParameters_js_1 = require("./permissionsV2UserParameters.js");
|
|
7
7
|
exports.policyAuthoringSigningWalletTypes = ['EVM', 'SOLANA', 'COSMOS', 'STELLAR', 'SUI'];
|
|
@@ -31,6 +31,28 @@ exports.permissionsV2SigningRequestTypes = [
|
|
|
31
31
|
'sui_transaction',
|
|
32
32
|
'raw_message',
|
|
33
33
|
];
|
|
34
|
+
exports.permissionsV2RuleActions = [
|
|
35
|
+
'transfer_native',
|
|
36
|
+
'transfer_tokens',
|
|
37
|
+
'call_contract',
|
|
38
|
+
'raw_signature',
|
|
39
|
+
'approve_tokens',
|
|
40
|
+
'transfer_nfts',
|
|
41
|
+
'deploy_contract',
|
|
42
|
+
'execute_safe_transaction',
|
|
43
|
+
'sign_message',
|
|
44
|
+
'sign_typed_data',
|
|
45
|
+
'sign_authorization',
|
|
46
|
+
];
|
|
47
|
+
const everyWalletTypeRuleActions = ['transfer_native', 'transfer_tokens', 'call_contract', 'raw_signature'];
|
|
48
|
+
exports.permissionsV2RuleActionsByWalletType = {
|
|
49
|
+
EVM: exports.permissionsV2RuleActions,
|
|
50
|
+
SOLANA: everyWalletTypeRuleActions,
|
|
51
|
+
COSMOS: everyWalletTypeRuleActions,
|
|
52
|
+
STELLAR: everyWalletTypeRuleActions,
|
|
53
|
+
SUI: everyWalletTypeRuleActions,
|
|
54
|
+
};
|
|
55
|
+
const permissionsV2SelectorListMaximum = 100;
|
|
34
56
|
const nonEmptyStringSchema = zod_1.z.string().min(1);
|
|
35
57
|
exports.permissionsV2ParameterDeclarationSchema = zod_1.z
|
|
36
58
|
.object({
|
|
@@ -38,18 +60,14 @@ exports.permissionsV2ParameterDeclarationSchema = zod_1.z
|
|
|
38
60
|
label: nonEmptyStringSchema,
|
|
39
61
|
})
|
|
40
62
|
.strict();
|
|
41
|
-
const uniqueNonEmptyStringsSchema = zod_1.z
|
|
42
|
-
.array(nonEmptyStringSchema)
|
|
43
|
-
.min(1)
|
|
44
|
-
.refine((values) => new Set(values).size === values.length, 'values must be unique');
|
|
45
63
|
exports.permissionsV2PolicyLayerSchema = zod_1.z.enum(['para', 'partner']);
|
|
46
64
|
exports.permissionsV2PolicyModeSchema = zod_1.z.enum(['guardrail', 'delegation']);
|
|
47
65
|
exports.permissionsV2PolicyEffectSchema = zod_1.z.enum(['allow', 'deny', 'require_approval']);
|
|
48
66
|
exports.permissionsV2CompareOperatorSchema = zod_1.z.enum(['eq', 'ne', 'lt', 'lte', 'gt', 'gte', 'in']);
|
|
49
67
|
exports.permissionsV2AggregateOperatorSchema = zod_1.z.enum(['lt', 'lte', 'gt', 'gte']);
|
|
50
68
|
exports.permissionsV2SigningWalletTypeSchema = zod_1.z.enum(exports.policyAuthoringSigningWalletTypes);
|
|
51
|
-
exports.permissionsV2SigningRequestRouteSchema = zod_1.z.enum(exports.policyAuthoringSigningRequestRoutes);
|
|
52
69
|
exports.permissionsV2SigningRequestTypeSchema = zod_1.z.enum(exports.permissionsV2SigningRequestTypes);
|
|
70
|
+
exports.permissionsV2RuleActionSchema = zod_1.z.enum(exports.permissionsV2RuleActions);
|
|
53
71
|
exports.policyAuthoringJsonPrimitiveSchema = zod_1.z.union([
|
|
54
72
|
zod_1.z.string(),
|
|
55
73
|
zod_1.z.number(),
|
|
@@ -102,13 +120,35 @@ exports.permissionsV2ConditionSchema = zod_1.z.lazy(() => zod_1.z.discriminatedU
|
|
|
102
120
|
})
|
|
103
121
|
.strict(),
|
|
104
122
|
]));
|
|
123
|
+
function duplicateValues(values) {
|
|
124
|
+
return Array.from(new Set(values.filter((value, index) => values.indexOf(value) !== index)));
|
|
125
|
+
}
|
|
126
|
+
function selectorListEntriesSchema(field) {
|
|
127
|
+
const entries = zod_1.z.array(nonEmptyStringSchema).min(1, `${field} must list at least 1 entry`);
|
|
128
|
+
return field === 'chainId'
|
|
129
|
+
? entries
|
|
130
|
+
: entries.max(permissionsV2SelectorListMaximum, `${field} must list at most ${permissionsV2SelectorListMaximum} entries`);
|
|
131
|
+
}
|
|
132
|
+
function selectorListSchema(field) {
|
|
133
|
+
return zod_1.z.union([
|
|
134
|
+
nonEmptyStringSchema,
|
|
135
|
+
selectorListEntriesSchema(field).superRefine((values, context) => {
|
|
136
|
+
const duplicates = duplicateValues(values);
|
|
137
|
+
if (duplicates.length > 0) {
|
|
138
|
+
context.addIssue({
|
|
139
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
140
|
+
message: `${field} lists ${duplicates.join(', ')} more than once`,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
}),
|
|
144
|
+
]);
|
|
145
|
+
}
|
|
105
146
|
const permissionsV2PartnerAuthoredPolicySelectorObjectSchema = zod_1.z
|
|
106
147
|
.object({
|
|
107
|
-
walletId:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
requestType: exports.permissionsV2SigningRequestTypeSchema.optional(),
|
|
148
|
+
walletId: selectorListSchema('walletId').optional(),
|
|
149
|
+
userId: selectorListSchema('userId').optional(),
|
|
150
|
+
chainId: selectorListSchema('chainId').optional(),
|
|
151
|
+
walletType: exports.permissionsV2SigningWalletTypeSchema,
|
|
112
152
|
})
|
|
113
153
|
.strict();
|
|
114
154
|
exports.permissionsV2PartnerAuthoredPolicySelectorSchema = permissionsV2PartnerAuthoredPolicySelectorObjectSchema;
|
|
@@ -620,10 +660,30 @@ exports.permissionsV2ConditionalApprovalCaseListSchema = zod_1.z
|
|
|
620
660
|
nextBeforeCaseId: conditionalApprovalIdentifierSchema.optional(),
|
|
621
661
|
})
|
|
622
662
|
.strict();
|
|
663
|
+
const permissionsV2RuleActionListSchema = zod_1.z
|
|
664
|
+
.array(exports.permissionsV2RuleActionSchema)
|
|
665
|
+
.min(1, 'actions must name at least one action or be "all"')
|
|
666
|
+
.superRefine((actions, context) => {
|
|
667
|
+
const duplicates = duplicateValues(actions);
|
|
668
|
+
if (duplicates.length > 0) {
|
|
669
|
+
context.addIssue({
|
|
670
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
671
|
+
message: `actions lists ${duplicates.join(', ')} more than once`,
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
});
|
|
675
|
+
exports.permissionsV2RuleActionsSchema = zod_1.z.union([zod_1.z.literal('all'), permissionsV2RuleActionListSchema], {
|
|
676
|
+
errorMap: (_issue, context) => ({
|
|
677
|
+
message: context.data === undefined
|
|
678
|
+
? 'actions is required: name the actions this rule governs or use "all"'
|
|
679
|
+
: `actions must be "all" or a list of actions, received ${JSON.stringify(context.data)}`,
|
|
680
|
+
}),
|
|
681
|
+
});
|
|
623
682
|
exports.permissionsV2PolicyRuleSchema = zod_1.z
|
|
624
683
|
.object({
|
|
625
684
|
id: nonEmptyStringSchema,
|
|
626
685
|
effect: exports.permissionsV2PolicyEffectSchema,
|
|
686
|
+
actions: exports.permissionsV2RuleActionsSchema,
|
|
627
687
|
when: exports.permissionsV2ConditionSchema,
|
|
628
688
|
approvalRequirement: exports.permissionsV2ConditionalApprovalRequirementSchema.optional(),
|
|
629
689
|
})
|
|
@@ -9,7 +9,6 @@ const permissionsV2PolicyViewSelectorSchema = permissionsV2_js_1.permissionsV2Pa
|
|
|
9
9
|
actorId: nonEmptyStringSchema.optional(),
|
|
10
10
|
partnerId: nonEmptyStringSchema.optional(),
|
|
11
11
|
appId: nonEmptyStringSchema.optional(),
|
|
12
|
-
userId: nonEmptyStringSchema.optional(),
|
|
13
12
|
walletOwnerPartnerId: nonEmptyStringSchema.optional(),
|
|
14
13
|
feature: nonEmptyStringSchema.optional(),
|
|
15
14
|
});
|
|
@@ -51,10 +50,10 @@ exports.permissionsV2PolicyUsageMeterSchema = zod_1.z
|
|
|
51
50
|
.object({
|
|
52
51
|
ruleId: nonEmptyStringSchema,
|
|
53
52
|
conditionPath: nonEmptyStringSchema,
|
|
54
|
-
fact: zod_1.z.enum(['wallet.spend.native', 'wallet.spend.erc20']),
|
|
53
|
+
fact: zod_1.z.enum(['wallet.spend.native', 'wallet.spend.erc20', 'wallet.spend.token']),
|
|
55
54
|
operator: zod_1.z.enum(['lt', 'lte', 'gt', 'gte']),
|
|
56
55
|
ruleEffect: permissionsV2_js_1.permissionsV2PolicyEffectSchema,
|
|
57
|
-
assetType: zod_1.z.enum(['NATIVE', 'ERC20']),
|
|
56
|
+
assetType: zod_1.z.enum(['NATIVE', 'ERC20', 'TOKEN']),
|
|
58
57
|
tokenAddress: nonEmptyStringSchema.optional(),
|
|
59
58
|
chainId: nonEmptyStringSchema,
|
|
60
59
|
windowMs: zod_1.z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
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.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;
|
|
3
|
+
exports.RecoveryStatus = exports.LOGIN_METHODS = exports.MFA_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',
|
|
@@ -88,6 +88,12 @@ var LegacyAuthMethod;
|
|
|
88
88
|
LegacyAuthMethod["PASSWORD"] = "PASSWORD";
|
|
89
89
|
LegacyAuthMethod["BIOMETRIC"] = "BIOMETRIC";
|
|
90
90
|
})(LegacyAuthMethod || (exports.LegacyAuthMethod = LegacyAuthMethod = {}));
|
|
91
|
+
/**
|
|
92
|
+
* A login-time second-factor METHOD as the client sees it. `totp`/`backup_code` are the authenticator-app
|
|
93
|
+
* factor; `passkey`/`password`/`pin` are credentials that became true second factors once the account's key
|
|
94
|
+
* share moved to the enclave (they no longer gate the share — they gate the login). (ENG-6906)
|
|
95
|
+
*/
|
|
96
|
+
exports.MFA_METHODS = ['totp', 'backup_code', 'passkey', 'password', 'pin'];
|
|
91
97
|
/**
|
|
92
98
|
* Every way a user row can be established/authenticated. Runtime tuple (mirrors OAUTH_METHODS) so code
|
|
93
99
|
* can iterate the canonical set instead of hand-maintaining parallel lists. OAuth providers are folded
|
package/dist/cjs/types/index.js
CHANGED
|
@@ -30,6 +30,8 @@ __exportStar(require("./permissions.js"), exports);
|
|
|
30
30
|
__exportStar(require("./signing.js"), exports);
|
|
31
31
|
__exportStar(require("./theme.js"), exports);
|
|
32
32
|
__exportStar(require("./transaction.js"), exports);
|
|
33
|
+
__exportStar(require("./twoFactor.js"), exports);
|
|
33
34
|
__exportStar(require("./wallet.js"), exports);
|
|
34
35
|
__exportStar(require("./user.js"), exports);
|
|
35
36
|
__exportStar(require("./webhook.js"), exports);
|
|
37
|
+
__exportStar(require("./restTransfer.js"), exports);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.LOGIN_TWO_FACTOR_MODES = exports.EmailTheme = exports.ThemeMode = void 0;
|
|
3
|
+
exports.DEFAULT_LOGIN_TWO_FACTOR_METHODS = exports.LOGIN_TWO_FACTOR_METHODS = exports.LOGIN_TWO_FACTOR_MODES = exports.EmailTheme = exports.ThemeMode = void 0;
|
|
4
4
|
var ThemeMode;
|
|
5
5
|
(function (ThemeMode) {
|
|
6
6
|
ThemeMode["LIGHT"] = "LIGHT";
|
|
@@ -20,3 +20,10 @@ var EmailTheme;
|
|
|
20
20
|
// they hold a VERIFIED login-TOTP factor. Not forced on a fresh user.
|
|
21
21
|
// - 'required': force-enroll + gate every user (what `require2fa: true` meant).
|
|
22
22
|
exports.LOGIN_TWO_FACTOR_MODES = ['disabled', 'optional', 'required'];
|
|
23
|
+
// The second-factor methods a partner can OFFER for enrollment (auth_config.loginTwoFactorMethods). TOTP is the
|
|
24
|
+
// authenticator app; PASSKEY/PASSWORD/PIN are credential second factors — portal-origin ceremonies that only
|
|
25
|
+
// exist for enclave-custodied accounts (a credential is share-gate OR 2FA, never both). Governs enrollment
|
|
26
|
+
// only: at verify time an account's own enrolled factors are authoritative. Absent ⇒ ['TOTP'] (parity with
|
|
27
|
+
// the TOTP-only launch). (ENG-6906)
|
|
28
|
+
exports.LOGIN_TWO_FACTOR_METHODS = ['TOTP', 'PASSKEY', 'PASSWORD', 'PIN'];
|
|
29
|
+
exports.DEFAULT_LOGIN_TWO_FACTOR_METHODS = ['TOTP'];
|
|
@@ -31,6 +31,10 @@ var WebhookEventType;
|
|
|
31
31
|
WebhookEventType["USER_EXTERNAL_WALLET_VERIFIED"] = "user.external_wallet_verified";
|
|
32
32
|
/** Fired when a fiat on-ramp purchase settles on-chain — carries the settlement tx hash (Coinbase/CDP today) */
|
|
33
33
|
WebhookEventType["ONRAMP_COMPLETED"] = "onramp.completed";
|
|
34
|
+
/** Fired when a partner resets (revokes) a user's login-time second factors via the REST API */
|
|
35
|
+
WebhookEventType["USER_TWO_FACTOR_RESET"] = "user.two_factor_reset";
|
|
36
|
+
/** Fired when Alchemy first reports an incoming fungible transfer to a watched wallet address */
|
|
37
|
+
WebhookEventType["FUNDS_RECEIVED"] = "funds.received";
|
|
34
38
|
/** Test ping event - used for webhook connectivity testing */
|
|
35
39
|
WebhookEventType["TEST_PING"] = "test.ping";
|
|
36
40
|
})(WebhookEventType || (exports.WebhookEventType = WebhookEventType = {}));
|
|
@@ -27,6 +27,28 @@ export const permissionsV2SigningRequestTypes = [
|
|
|
27
27
|
'sui_transaction',
|
|
28
28
|
'raw_message',
|
|
29
29
|
];
|
|
30
|
+
export const permissionsV2RuleActions = [
|
|
31
|
+
'transfer_native',
|
|
32
|
+
'transfer_tokens',
|
|
33
|
+
'call_contract',
|
|
34
|
+
'raw_signature',
|
|
35
|
+
'approve_tokens',
|
|
36
|
+
'transfer_nfts',
|
|
37
|
+
'deploy_contract',
|
|
38
|
+
'execute_safe_transaction',
|
|
39
|
+
'sign_message',
|
|
40
|
+
'sign_typed_data',
|
|
41
|
+
'sign_authorization',
|
|
42
|
+
];
|
|
43
|
+
const everyWalletTypeRuleActions = ['transfer_native', 'transfer_tokens', 'call_contract', 'raw_signature'];
|
|
44
|
+
export const permissionsV2RuleActionsByWalletType = {
|
|
45
|
+
EVM: permissionsV2RuleActions,
|
|
46
|
+
SOLANA: everyWalletTypeRuleActions,
|
|
47
|
+
COSMOS: everyWalletTypeRuleActions,
|
|
48
|
+
STELLAR: everyWalletTypeRuleActions,
|
|
49
|
+
SUI: everyWalletTypeRuleActions,
|
|
50
|
+
};
|
|
51
|
+
const permissionsV2SelectorListMaximum = 100;
|
|
30
52
|
const nonEmptyStringSchema = z.string().min(1);
|
|
31
53
|
export const permissionsV2ParameterDeclarationSchema = z
|
|
32
54
|
.object({
|
|
@@ -34,18 +56,14 @@ export const permissionsV2ParameterDeclarationSchema = z
|
|
|
34
56
|
label: nonEmptyStringSchema,
|
|
35
57
|
})
|
|
36
58
|
.strict();
|
|
37
|
-
const uniqueNonEmptyStringsSchema = z
|
|
38
|
-
.array(nonEmptyStringSchema)
|
|
39
|
-
.min(1)
|
|
40
|
-
.refine((values) => new Set(values).size === values.length, 'values must be unique');
|
|
41
59
|
export const permissionsV2PolicyLayerSchema = z.enum(['para', 'partner']);
|
|
42
60
|
export const permissionsV2PolicyModeSchema = z.enum(['guardrail', 'delegation']);
|
|
43
61
|
export const permissionsV2PolicyEffectSchema = z.enum(['allow', 'deny', 'require_approval']);
|
|
44
62
|
export const permissionsV2CompareOperatorSchema = z.enum(['eq', 'ne', 'lt', 'lte', 'gt', 'gte', 'in']);
|
|
45
63
|
export const permissionsV2AggregateOperatorSchema = z.enum(['lt', 'lte', 'gt', 'gte']);
|
|
46
64
|
export const permissionsV2SigningWalletTypeSchema = z.enum(policyAuthoringSigningWalletTypes);
|
|
47
|
-
export const permissionsV2SigningRequestRouteSchema = z.enum(policyAuthoringSigningRequestRoutes);
|
|
48
65
|
export const permissionsV2SigningRequestTypeSchema = z.enum(permissionsV2SigningRequestTypes);
|
|
66
|
+
export const permissionsV2RuleActionSchema = z.enum(permissionsV2RuleActions);
|
|
49
67
|
export const policyAuthoringJsonPrimitiveSchema = z.union([
|
|
50
68
|
z.string(),
|
|
51
69
|
z.number(),
|
|
@@ -98,13 +116,35 @@ export const permissionsV2ConditionSchema = z.lazy(() => z.discriminatedUnion('k
|
|
|
98
116
|
})
|
|
99
117
|
.strict(),
|
|
100
118
|
]));
|
|
119
|
+
function duplicateValues(values) {
|
|
120
|
+
return Array.from(new Set(values.filter((value, index) => values.indexOf(value) !== index)));
|
|
121
|
+
}
|
|
122
|
+
function selectorListEntriesSchema(field) {
|
|
123
|
+
const entries = z.array(nonEmptyStringSchema).min(1, `${field} must list at least 1 entry`);
|
|
124
|
+
return field === 'chainId'
|
|
125
|
+
? entries
|
|
126
|
+
: entries.max(permissionsV2SelectorListMaximum, `${field} must list at most ${permissionsV2SelectorListMaximum} entries`);
|
|
127
|
+
}
|
|
128
|
+
function selectorListSchema(field) {
|
|
129
|
+
return z.union([
|
|
130
|
+
nonEmptyStringSchema,
|
|
131
|
+
selectorListEntriesSchema(field).superRefine((values, context) => {
|
|
132
|
+
const duplicates = duplicateValues(values);
|
|
133
|
+
if (duplicates.length > 0) {
|
|
134
|
+
context.addIssue({
|
|
135
|
+
code: z.ZodIssueCode.custom,
|
|
136
|
+
message: `${field} lists ${duplicates.join(', ')} more than once`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}),
|
|
140
|
+
]);
|
|
141
|
+
}
|
|
101
142
|
const permissionsV2PartnerAuthoredPolicySelectorObjectSchema = z
|
|
102
143
|
.object({
|
|
103
|
-
walletId:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
requestType: permissionsV2SigningRequestTypeSchema.optional(),
|
|
144
|
+
walletId: selectorListSchema('walletId').optional(),
|
|
145
|
+
userId: selectorListSchema('userId').optional(),
|
|
146
|
+
chainId: selectorListSchema('chainId').optional(),
|
|
147
|
+
walletType: permissionsV2SigningWalletTypeSchema,
|
|
108
148
|
})
|
|
109
149
|
.strict();
|
|
110
150
|
export const permissionsV2PartnerAuthoredPolicySelectorSchema = permissionsV2PartnerAuthoredPolicySelectorObjectSchema;
|
|
@@ -616,10 +656,30 @@ export const permissionsV2ConditionalApprovalCaseListSchema = z
|
|
|
616
656
|
nextBeforeCaseId: conditionalApprovalIdentifierSchema.optional(),
|
|
617
657
|
})
|
|
618
658
|
.strict();
|
|
659
|
+
const permissionsV2RuleActionListSchema = z
|
|
660
|
+
.array(permissionsV2RuleActionSchema)
|
|
661
|
+
.min(1, 'actions must name at least one action or be "all"')
|
|
662
|
+
.superRefine((actions, context) => {
|
|
663
|
+
const duplicates = duplicateValues(actions);
|
|
664
|
+
if (duplicates.length > 0) {
|
|
665
|
+
context.addIssue({
|
|
666
|
+
code: z.ZodIssueCode.custom,
|
|
667
|
+
message: `actions lists ${duplicates.join(', ')} more than once`,
|
|
668
|
+
});
|
|
669
|
+
}
|
|
670
|
+
});
|
|
671
|
+
export const permissionsV2RuleActionsSchema = z.union([z.literal('all'), permissionsV2RuleActionListSchema], {
|
|
672
|
+
errorMap: (_issue, context) => ({
|
|
673
|
+
message: context.data === undefined
|
|
674
|
+
? 'actions is required: name the actions this rule governs or use "all"'
|
|
675
|
+
: `actions must be "all" or a list of actions, received ${JSON.stringify(context.data)}`,
|
|
676
|
+
}),
|
|
677
|
+
});
|
|
619
678
|
export const permissionsV2PolicyRuleSchema = z
|
|
620
679
|
.object({
|
|
621
680
|
id: nonEmptyStringSchema,
|
|
622
681
|
effect: permissionsV2PolicyEffectSchema,
|
|
682
|
+
actions: permissionsV2RuleActionsSchema,
|
|
623
683
|
when: permissionsV2ConditionSchema,
|
|
624
684
|
approvalRequirement: permissionsV2ConditionalApprovalRequirementSchema.optional(),
|
|
625
685
|
})
|
|
@@ -6,7 +6,6 @@ const permissionsV2PolicyViewSelectorSchema = permissionsV2PartnerAuthoredPolicy
|
|
|
6
6
|
actorId: nonEmptyStringSchema.optional(),
|
|
7
7
|
partnerId: nonEmptyStringSchema.optional(),
|
|
8
8
|
appId: nonEmptyStringSchema.optional(),
|
|
9
|
-
userId: nonEmptyStringSchema.optional(),
|
|
10
9
|
walletOwnerPartnerId: nonEmptyStringSchema.optional(),
|
|
11
10
|
feature: nonEmptyStringSchema.optional(),
|
|
12
11
|
});
|
|
@@ -48,10 +47,10 @@ export const permissionsV2PolicyUsageMeterSchema = z
|
|
|
48
47
|
.object({
|
|
49
48
|
ruleId: nonEmptyStringSchema,
|
|
50
49
|
conditionPath: nonEmptyStringSchema,
|
|
51
|
-
fact: z.enum(['wallet.spend.native', 'wallet.spend.erc20']),
|
|
50
|
+
fact: z.enum(['wallet.spend.native', 'wallet.spend.erc20', 'wallet.spend.token']),
|
|
52
51
|
operator: z.enum(['lt', 'lte', 'gt', 'gte']),
|
|
53
52
|
ruleEffect: permissionsV2PolicyEffectSchema,
|
|
54
|
-
assetType: z.enum(['NATIVE', 'ERC20']),
|
|
53
|
+
assetType: z.enum(['NATIVE', 'ERC20', 'TOKEN']),
|
|
55
54
|
tokenAddress: nonEmptyStringSchema.optional(),
|
|
56
55
|
chainId: nonEmptyStringSchema,
|
|
57
56
|
windowMs: z.number().int().positive().max(Number.MAX_SAFE_INTEGER),
|
package/dist/esm/types/auth.js
CHANGED
|
@@ -85,6 +85,12 @@ export var LegacyAuthMethod;
|
|
|
85
85
|
LegacyAuthMethod["PASSWORD"] = "PASSWORD";
|
|
86
86
|
LegacyAuthMethod["BIOMETRIC"] = "BIOMETRIC";
|
|
87
87
|
})(LegacyAuthMethod || (LegacyAuthMethod = {}));
|
|
88
|
+
/**
|
|
89
|
+
* A login-time second-factor METHOD as the client sees it. `totp`/`backup_code` are the authenticator-app
|
|
90
|
+
* factor; `passkey`/`password`/`pin` are credentials that became true second factors once the account's key
|
|
91
|
+
* share moved to the enclave (they no longer gate the share — they gate the login). (ENG-6906)
|
|
92
|
+
*/
|
|
93
|
+
export const MFA_METHODS = ['totp', 'backup_code', 'passkey', 'password', 'pin'];
|
|
88
94
|
/**
|
|
89
95
|
* Every way a user row can be established/authenticated. Runtime tuple (mirrors OAUTH_METHODS) so code
|
|
90
96
|
* can iterate the canonical set instead of hand-maintaining parallel lists. OAuth providers are folded
|
package/dist/esm/types/index.js
CHANGED
|
@@ -14,6 +14,8 @@ export * from './permissions.js';
|
|
|
14
14
|
export * from './signing.js';
|
|
15
15
|
export * from './theme.js';
|
|
16
16
|
export * from './transaction.js';
|
|
17
|
+
export * from './twoFactor.js';
|
|
17
18
|
export * from './wallet.js';
|
|
18
19
|
export * from './user.js';
|
|
19
20
|
export * from './webhook.js';
|
|
21
|
+
export * from './restTransfer.js';
|
|
@@ -17,3 +17,10 @@ export var EmailTheme;
|
|
|
17
17
|
// they hold a VERIFIED login-TOTP factor. Not forced on a fresh user.
|
|
18
18
|
// - 'required': force-enroll + gate every user (what `require2fa: true` meant).
|
|
19
19
|
export const LOGIN_TWO_FACTOR_MODES = ['disabled', 'optional', 'required'];
|
|
20
|
+
// The second-factor methods a partner can OFFER for enrollment (auth_config.loginTwoFactorMethods). TOTP is the
|
|
21
|
+
// authenticator app; PASSKEY/PASSWORD/PIN are credential second factors — portal-origin ceremonies that only
|
|
22
|
+
// exist for enclave-custodied accounts (a credential is share-gate OR 2FA, never both). Governs enrollment
|
|
23
|
+
// only: at verify time an account's own enrolled factors are authoritative. Absent ⇒ ['TOTP'] (parity with
|
|
24
|
+
// the TOTP-only launch). (ENG-6906)
|
|
25
|
+
export const LOGIN_TWO_FACTOR_METHODS = ['TOTP', 'PASSKEY', 'PASSWORD', 'PIN'];
|
|
26
|
+
export const DEFAULT_LOGIN_TWO_FACTOR_METHODS = ['TOTP'];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -26,6 +26,10 @@ export var WebhookEventType;
|
|
|
26
26
|
WebhookEventType["USER_EXTERNAL_WALLET_VERIFIED"] = "user.external_wallet_verified";
|
|
27
27
|
/** Fired when a fiat on-ramp purchase settles on-chain — carries the settlement tx hash (Coinbase/CDP today) */
|
|
28
28
|
WebhookEventType["ONRAMP_COMPLETED"] = "onramp.completed";
|
|
29
|
+
/** Fired when a partner resets (revokes) a user's login-time second factors via the REST API */
|
|
30
|
+
WebhookEventType["USER_TWO_FACTOR_RESET"] = "user.two_factor_reset";
|
|
31
|
+
/** Fired when Alchemy first reports an incoming fungible transfer to a watched wallet address */
|
|
32
|
+
WebhookEventType["FUNDS_RECEIVED"] = "funds.received";
|
|
29
33
|
/** Test ping event - used for webhook connectivity testing */
|
|
30
34
|
WebhookEventType["TEST_PING"] = "test.ping";
|
|
31
35
|
})(WebhookEventType || (WebhookEventType = {}));
|