@nucypher/taco 0.6.0 → 0.7.0-alpha.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.
- package/dist/cjs/conditions/base/address-allowlist.d.ts +10 -0
- package/dist/cjs/conditions/base/address-allowlist.js +19 -0
- package/dist/cjs/conditions/base/address-allowlist.js.map +1 -0
- package/dist/cjs/conditions/base/ecdsa.d.ts +7 -0
- package/dist/cjs/conditions/base/ecdsa.js +21 -0
- package/dist/cjs/conditions/base/ecdsa.js.map +1 -0
- package/dist/cjs/conditions/base/index.d.ts +3 -0
- package/dist/cjs/conditions/base/index.js +4 -1
- package/dist/cjs/conditions/base/index.js.map +1 -1
- package/dist/cjs/conditions/base/signing.d.ts +10 -0
- package/dist/cjs/conditions/base/signing.js +32 -0
- package/dist/cjs/conditions/base/signing.js.map +1 -0
- package/dist/cjs/conditions/condition-factory.js +11 -0
- package/dist/cjs/conditions/condition-factory.js.map +1 -1
- package/dist/cjs/conditions/context/context.d.ts +4 -0
- package/dist/cjs/conditions/context/context.js +28 -3
- package/dist/cjs/conditions/context/context.js.map +1 -1
- package/dist/cjs/conditions/schemas/address-allowlist.d.ts +16 -0
- package/dist/cjs/conditions/schemas/address-allowlist.js +20 -0
- package/dist/cjs/conditions/schemas/address-allowlist.js.map +1 -0
- package/dist/cjs/conditions/schemas/common.d.ts +2 -0
- package/dist/cjs/conditions/schemas/common.js +20 -3
- package/dist/cjs/conditions/schemas/common.js.map +1 -1
- package/dist/cjs/conditions/schemas/contract.d.ts +33 -30
- package/dist/cjs/conditions/schemas/ecdsa.d.ts +38 -0
- package/dist/cjs/conditions/schemas/ecdsa.js +40 -0
- package/dist/cjs/conditions/schemas/ecdsa.js.map +1 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.d.ts +3 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js +4 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js.map +1 -1
- package/dist/cjs/conditions/schemas/json-api.d.ts +47 -14
- package/dist/cjs/conditions/schemas/json-api.js +16 -2
- package/dist/cjs/conditions/schemas/json-api.js.map +1 -1
- package/dist/cjs/conditions/schemas/json-rpc.d.ts +48 -13
- package/dist/cjs/conditions/schemas/json-rpc.js +16 -2
- package/dist/cjs/conditions/schemas/json-rpc.js.map +1 -1
- package/dist/cjs/conditions/schemas/jwt.d.ts +2 -4
- package/dist/cjs/conditions/schemas/return-value-test.d.ts +28 -12
- package/dist/cjs/conditions/schemas/return-value-test.js +19 -5
- package/dist/cjs/conditions/schemas/return-value-test.js.map +1 -1
- package/dist/cjs/conditions/schemas/rpc.d.ts +22 -16
- package/dist/cjs/conditions/schemas/sequential.js +31 -11
- package/dist/cjs/conditions/schemas/sequential.js.map +1 -1
- package/dist/cjs/conditions/schemas/signing.d.ts +12 -0
- package/dist/cjs/conditions/schemas/signing.js +204 -0
- package/dist/cjs/conditions/schemas/signing.js.map +1 -0
- package/dist/cjs/conditions/schemas/time.d.ts +18 -10
- package/dist/cjs/conditions/schemas/utils.js +8 -1
- package/dist/cjs/conditions/schemas/utils.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sign.d.ts +26 -0
- package/dist/cjs/sign.js +99 -0
- package/dist/cjs/sign.js.map +1 -0
- package/dist/cjs/types.d.ts +1 -0
- package/dist/es/conditions/base/address-allowlist.d.ts +10 -0
- package/dist/es/conditions/base/address-allowlist.js +15 -0
- package/dist/es/conditions/base/address-allowlist.js.map +1 -0
- package/dist/es/conditions/base/ecdsa.d.ts +7 -0
- package/dist/es/conditions/base/ecdsa.js +12 -0
- package/dist/es/conditions/base/ecdsa.js.map +1 -0
- package/dist/es/conditions/base/index.d.ts +3 -0
- package/dist/es/conditions/base/index.js +3 -0
- package/dist/es/conditions/base/index.js.map +1 -1
- package/dist/es/conditions/base/signing.d.ts +10 -0
- package/dist/es/conditions/base/signing.js +20 -0
- package/dist/es/conditions/base/signing.js.map +1 -0
- package/dist/es/conditions/condition-factory.js +11 -0
- package/dist/es/conditions/condition-factory.js.map +1 -1
- package/dist/es/conditions/context/context.d.ts +4 -0
- package/dist/es/conditions/context/context.js +27 -2
- package/dist/es/conditions/context/context.js.map +1 -1
- package/dist/es/conditions/schemas/address-allowlist.d.ts +16 -0
- package/dist/es/conditions/schemas/address-allowlist.js +17 -0
- package/dist/es/conditions/schemas/address-allowlist.js.map +1 -0
- package/dist/es/conditions/schemas/common.d.ts +2 -0
- package/dist/es/conditions/schemas/common.js +19 -2
- package/dist/es/conditions/schemas/common.js.map +1 -1
- package/dist/es/conditions/schemas/contract.d.ts +33 -30
- package/dist/es/conditions/schemas/ecdsa.d.ts +38 -0
- package/dist/es/conditions/schemas/ecdsa.js +37 -0
- package/dist/es/conditions/schemas/ecdsa.js.map +1 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.d.ts +3 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.js +4 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.js.map +1 -1
- package/dist/es/conditions/schemas/json-api.d.ts +47 -14
- package/dist/es/conditions/schemas/json-api.js +17 -3
- package/dist/es/conditions/schemas/json-api.js.map +1 -1
- package/dist/es/conditions/schemas/json-rpc.d.ts +48 -13
- package/dist/es/conditions/schemas/json-rpc.js +17 -3
- package/dist/es/conditions/schemas/json-rpc.js.map +1 -1
- package/dist/es/conditions/schemas/jwt.d.ts +2 -4
- package/dist/es/conditions/schemas/return-value-test.d.ts +28 -12
- package/dist/es/conditions/schemas/return-value-test.js +19 -5
- package/dist/es/conditions/schemas/return-value-test.js.map +1 -1
- package/dist/es/conditions/schemas/rpc.d.ts +22 -16
- package/dist/es/conditions/schemas/sequential.js +31 -11
- package/dist/es/conditions/schemas/sequential.js.map +1 -1
- package/dist/es/conditions/schemas/signing.d.ts +12 -0
- package/dist/es/conditions/schemas/signing.js +201 -0
- package/dist/es/conditions/schemas/signing.js.map +1 -0
- package/dist/es/conditions/schemas/time.d.ts +18 -10
- package/dist/es/conditions/schemas/utils.js +8 -1
- package/dist/es/conditions/schemas/utils.js.map +1 -1
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +1 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/sign.d.ts +26 -0
- package/dist/es/sign.js +95 -0
- package/dist/es/sign.js.map +1 -0
- package/dist/es/types.d.ts +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.es.tsbuildinfo +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signingObjectAbiAttributeConditionSchema = exports.SigningObjectAbiAttributeConditionType = exports.abiCallValidationSchema = exports.abiParameterValidationSchema = exports.signingObjectAttributeConditionSchema = exports.SigningObjectAttributeConditionType = exports.SIGNING_CONDITION_OBJECT_CONTEXT_VAR = void 0;
|
|
4
|
+
const utils_1 = require("ethers/lib/utils");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const return_value_test_1 = require("./return-value-test");
|
|
8
|
+
exports.SIGNING_CONDITION_OBJECT_CONTEXT_VAR = ':signingConditionObject';
|
|
9
|
+
const signingConditionSchema = common_1.baseConditionSchema.extend({
|
|
10
|
+
signingObjectContextVar: zod_1.z
|
|
11
|
+
.literal(exports.SIGNING_CONDITION_OBJECT_CONTEXT_VAR)
|
|
12
|
+
.default(exports.SIGNING_CONDITION_OBJECT_CONTEXT_VAR)
|
|
13
|
+
.describe('The context variable that will be replaced with the signing object at signing'),
|
|
14
|
+
});
|
|
15
|
+
const baseSigningObjectAttributeConditionSchema = signingConditionSchema.extend({
|
|
16
|
+
attributeName: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.min(1)
|
|
19
|
+
.describe('The name of the attribute to check'),
|
|
20
|
+
});
|
|
21
|
+
exports.SigningObjectAttributeConditionType = 'signing-attribute';
|
|
22
|
+
exports.signingObjectAttributeConditionSchema = baseSigningObjectAttributeConditionSchema.extend({
|
|
23
|
+
conditionType: zod_1.z
|
|
24
|
+
.literal(exports.SigningObjectAttributeConditionType)
|
|
25
|
+
.default(exports.SigningObjectAttributeConditionType),
|
|
26
|
+
returnValueTest: return_value_test_1.blockchainReturnValueTestSchema,
|
|
27
|
+
});
|
|
28
|
+
exports.abiParameterValidationSchema = zod_1.z
|
|
29
|
+
.object({
|
|
30
|
+
parameterIndex: zod_1.z
|
|
31
|
+
.number()
|
|
32
|
+
.int()
|
|
33
|
+
.nonnegative()
|
|
34
|
+
.describe('Index of parameter to check within abi calldata.'),
|
|
35
|
+
indexWithinTuple: zod_1.z
|
|
36
|
+
.number()
|
|
37
|
+
.int()
|
|
38
|
+
.nonnegative()
|
|
39
|
+
.optional()
|
|
40
|
+
.describe('Index of value within tuple value at parameter index to check'),
|
|
41
|
+
returnValueTest: return_value_test_1.blockchainReturnValueTestSchema
|
|
42
|
+
.optional()
|
|
43
|
+
.describe('Comparison check for value within calldata'),
|
|
44
|
+
nestedAbiValidation: zod_1.z
|
|
45
|
+
.lazy(() => exports.abiCallValidationSchema)
|
|
46
|
+
.optional()
|
|
47
|
+
.describe('Additional checks for nested abi calldata'),
|
|
48
|
+
})
|
|
49
|
+
.refine(
|
|
50
|
+
// An XOR check to see if either 'returnValueTest' or 'nestedAbiValidation' is set
|
|
51
|
+
(parameterValidation) => Boolean(parameterValidation.returnValueTest) !==
|
|
52
|
+
Boolean(parameterValidation.nestedAbiValidation), {
|
|
53
|
+
message: "At most one of the fields 'returnValueTest' and 'nestedAbiValidation' must be defined",
|
|
54
|
+
path: ['returnValueTest'],
|
|
55
|
+
});
|
|
56
|
+
// TODO: is there something already built out there to validate Solidity types?
|
|
57
|
+
function generateSolidityBaseTypeRegExp() {
|
|
58
|
+
// Generate a regex pattern for Solidity base types
|
|
59
|
+
// Generate int/uint sizes (8, 16, ..., 256)
|
|
60
|
+
const intSizes = Array.from({ length: 32 }, (_, i) => (i + 1) * 8); // [8, 16, ..., 256]
|
|
61
|
+
const intSizePattern = intSizes.join('|');
|
|
62
|
+
// Generate bytes sizes (1, 2, ..., 32)
|
|
63
|
+
const bytesSizes = Array.from({ length: 32 }, (_, i) => i + 1); // [1, 2, ..., 32]
|
|
64
|
+
const bytesSizePattern = bytesSizes.join('|');
|
|
65
|
+
// Build the regex string
|
|
66
|
+
const baseTypes = [
|
|
67
|
+
`u?int(${intSizePattern})?`, // uint8, uint16, ..., uint256, int8, int16, ..., int256
|
|
68
|
+
`bytes(${bytesSizePattern})?`, // bytes1, bytes2, ..., bytes32
|
|
69
|
+
'string',
|
|
70
|
+
'address',
|
|
71
|
+
'bool',
|
|
72
|
+
].join('|');
|
|
73
|
+
return new RegExp(`^(${baseTypes})$`);
|
|
74
|
+
}
|
|
75
|
+
// YIKES!
|
|
76
|
+
const solidityBaseTypePattern = generateSolidityBaseTypeRegExp();
|
|
77
|
+
const isValidSolidityType = (param) => {
|
|
78
|
+
// Recursive check for valid Solidity types
|
|
79
|
+
if (!param.baseType || !param.baseType.trim()) {
|
|
80
|
+
return false; // empty type is not valid
|
|
81
|
+
}
|
|
82
|
+
// Check for arrays and tuples
|
|
83
|
+
if (param.baseType === 'tuple') {
|
|
84
|
+
if (!param.components || param.components.length === 0) {
|
|
85
|
+
return false; // tuples must have components defined
|
|
86
|
+
}
|
|
87
|
+
return param.components.every(isValidSolidityType);
|
|
88
|
+
}
|
|
89
|
+
else if (param.baseType === 'array') {
|
|
90
|
+
if (!param.arrayChildren) {
|
|
91
|
+
return false; // arrays must have children type defined
|
|
92
|
+
}
|
|
93
|
+
return isValidSolidityType(param.arrayChildren);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return solidityBaseTypePattern.test(param.baseType);
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
// TODO; find a better way to validate the param type - incomplete best effort for now
|
|
100
|
+
const isValidHumanAbiCallSignature = (signature) => {
|
|
101
|
+
try {
|
|
102
|
+
// TODO: verify this works properly
|
|
103
|
+
const fragment = utils_1.FunctionFragment.from(signature);
|
|
104
|
+
for (const parameter of fragment.inputs) {
|
|
105
|
+
if (!isValidSolidityType(parameter)) {
|
|
106
|
+
return false; // invalid Solidity type
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
// ensure the same sighash format was provided
|
|
110
|
+
return fragment.format() === signature;
|
|
111
|
+
}
|
|
112
|
+
catch {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
const humanAbiCallSignatureSchema = zod_1.z
|
|
117
|
+
.string()
|
|
118
|
+
.refine(isValidHumanAbiCallSignature, {
|
|
119
|
+
message: 'Invalid human readable ABI signature provided',
|
|
120
|
+
})
|
|
121
|
+
.describe('A human readable ABI signature, e.g. "transfer(address,uint256)"');
|
|
122
|
+
/**
|
|
123
|
+
* Validates the allowed ABI calls against the provided signature and validations.
|
|
124
|
+
* This function is used in the superRefine method of the abiCallValidationSchema.
|
|
125
|
+
*
|
|
126
|
+
* @param ctx - The Zod refinement context.
|
|
127
|
+
* @param signature - The ABI signature to validate against.
|
|
128
|
+
* @param validations - The array of validations for the ABI parameters.
|
|
129
|
+
*/
|
|
130
|
+
function validateAllowedAbiCall(ctx, signature, validations) {
|
|
131
|
+
try {
|
|
132
|
+
const fragment = utils_1.FunctionFragment.from(signature);
|
|
133
|
+
for (const [index, validation] of validations.entries()) {
|
|
134
|
+
if (validation.parameterIndex >= fragment.inputs.length) {
|
|
135
|
+
// invalid parameter index
|
|
136
|
+
ctx.addIssue({
|
|
137
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
138
|
+
message: `Parameter index, "${validation.parameterIndex}", is out of range`,
|
|
139
|
+
path: ['allowedAbiCalls', signature, index, 'parameterIndex'],
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
if (validation.indexWithinTuple !== undefined) {
|
|
143
|
+
const paramType = fragment.inputs[validation.parameterIndex];
|
|
144
|
+
if (paramType.baseType !== 'tuple') {
|
|
145
|
+
// type at parameter index is not a tuple
|
|
146
|
+
ctx.addIssue({
|
|
147
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
148
|
+
message: `Type at parameter index, "${validation.parameterIndex}", is not a tuple`,
|
|
149
|
+
path: ['allowedAbiCalls', signature, index, 'parameterIndex'],
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
else if (validation.indexWithinTuple >= paramType.components.length) {
|
|
153
|
+
// invalid index within tuple
|
|
154
|
+
ctx.addIssue({
|
|
155
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
156
|
+
message: `Index within tuple, "${validation.indexWithinTuple}", is out of range`,
|
|
157
|
+
path: ['allowedAbiCalls', signature, index, 'indexWithinTuple'],
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (validation.nestedAbiValidation) {
|
|
162
|
+
// if there is nested ABI validation, the type must be bytes
|
|
163
|
+
let paramType = fragment.inputs[validation.parameterIndex];
|
|
164
|
+
if (validation.indexWithinTuple !== undefined) {
|
|
165
|
+
// if there is an index within tuple, get the type of the component at that index
|
|
166
|
+
paramType = paramType.components[validation.indexWithinTuple];
|
|
167
|
+
}
|
|
168
|
+
if (paramType.baseType !== 'bytes') {
|
|
169
|
+
ctx.addIssue({
|
|
170
|
+
code: zod_1.z.ZodIssueCode.custom,
|
|
171
|
+
message: `Invalid type for nested ABI validation, "${paramType.baseType}"; expected bytes`,
|
|
172
|
+
path: ['allowedAbiCalls', signature, index],
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
// even though abi signatures are already validated by nested schema - zod uses “greedy” (continuable) validation so all validations are run
|
|
180
|
+
// ignore invalid ABI signature
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
exports.abiCallValidationSchema = zod_1.z
|
|
184
|
+
.object({
|
|
185
|
+
allowedAbiCalls: zod_1.z.record(humanAbiCallSignatureSchema, zod_1.z.array(exports.abiParameterValidationSchema)),
|
|
186
|
+
})
|
|
187
|
+
.refine((abiCallValidation) => Object.keys(abiCallValidation.allowedAbiCalls).length > 0, {
|
|
188
|
+
message: 'At least one allowed ABI call must be defined',
|
|
189
|
+
path: ['allowedAbiCalls'],
|
|
190
|
+
})
|
|
191
|
+
.superRefine((data, ctx) => {
|
|
192
|
+
for (const [signature, validations] of Object.entries(data.allowedAbiCalls)) {
|
|
193
|
+
validateAllowedAbiCall(ctx, signature, validations);
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
.describe('A map of allowed ABI calls with their respective parameter validations.');
|
|
197
|
+
exports.SigningObjectAbiAttributeConditionType = 'signing-abi-attribute';
|
|
198
|
+
exports.signingObjectAbiAttributeConditionSchema = baseSigningObjectAttributeConditionSchema.extend({
|
|
199
|
+
conditionType: zod_1.z
|
|
200
|
+
.literal(exports.SigningObjectAbiAttributeConditionType)
|
|
201
|
+
.default(exports.SigningObjectAbiAttributeConditionType),
|
|
202
|
+
abiValidation: exports.abiCallValidationSchema,
|
|
203
|
+
});
|
|
204
|
+
//# sourceMappingURL=signing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/signing.ts"],"names":[],"mappings":";;;AAAA,4CAA+D;AAC/D,6BAAwB;AAExB,qCAA+C;AAC/C,2DAAsE;AAEzD,QAAA,oCAAoC,GAAG,yBAAyB,CAAC;AAE9E,MAAM,sBAAsB,GAAG,4BAAmB,CAAC,MAAM,CAAC;IACxD,uBAAuB,EAAE,OAAC;SACvB,OAAO,CAAC,4CAAoC,CAAC;SAC7C,OAAO,CAAC,4CAAoC,CAAC;SAC7C,QAAQ,CACP,+EAA+E,CAChF;CACJ,CAAC,CAAC;AAEH,MAAM,yCAAyC,GAAG,sBAAsB,CAAC,MAAM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E,CAAC;QACF,sBAAsB,CAAC,GAAG,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACtD,CAAC;AACH,CAAC,CAAC;KACD,QAAQ,CACP,yEAAyE,CAC1E,CAAC;AAIS,QAAA,sCAAsC,GAAG,uBAAuB,CAAC;AAEjE,QAAA,wCAAwC,GACnD,yCAAyC,CAAC,MAAM,CAAC;IAC/C,aAAa,EAAE,OAAC;SACb,OAAO,CAAC,8CAAsC,CAAC;SAC/C,OAAO,CAAC,8CAAsC,CAAC;IAClD,aAAa,EAAE,+BAAuB;CACvC,CAAC,CAAC"}
|
|
@@ -5,36 +5,44 @@ export declare const timeConditionSchema: z.ZodObject<{
|
|
|
5
5
|
conditionType: z.ZodDefault<z.ZodLiteral<"time">>;
|
|
6
6
|
method: z.ZodDefault<z.ZodLiteral<"blocktime">>;
|
|
7
7
|
chain: z.ZodNumber;
|
|
8
|
-
returnValueTest: z.
|
|
8
|
+
returnValueTest: z.ZodEffects<z.ZodObject<{
|
|
9
9
|
index: z.ZodOptional<z.ZodNumber>;
|
|
10
|
-
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
11
|
-
}
|
|
10
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!=", "in", "!in"]>;
|
|
11
|
+
} & {
|
|
12
12
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
13
|
-
}
|
|
14
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
15
|
+
value?: any;
|
|
16
|
+
index?: number | undefined;
|
|
17
|
+
}, {
|
|
18
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
19
|
+
value?: any;
|
|
20
|
+
index?: number | undefined;
|
|
21
|
+
}>, {
|
|
22
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
15
23
|
value?: any;
|
|
16
24
|
index?: number | undefined;
|
|
17
25
|
}, {
|
|
18
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
26
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
19
27
|
value?: any;
|
|
20
28
|
index?: number | undefined;
|
|
21
29
|
}>;
|
|
22
30
|
}, "strip", z.ZodTypeAny, {
|
|
23
31
|
conditionType: "time";
|
|
24
|
-
chain: number;
|
|
25
32
|
method: "blocktime";
|
|
26
33
|
returnValueTest: {
|
|
27
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
34
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
28
35
|
value?: any;
|
|
29
36
|
index?: number | undefined;
|
|
30
37
|
};
|
|
31
|
-
}, {
|
|
32
38
|
chain: number;
|
|
39
|
+
}, {
|
|
33
40
|
returnValueTest: {
|
|
34
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
41
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
35
42
|
value?: any;
|
|
36
43
|
index?: number | undefined;
|
|
37
44
|
};
|
|
45
|
+
chain: number;
|
|
38
46
|
conditionType?: "time" | undefined;
|
|
39
47
|
method?: "blocktime" | undefined;
|
|
40
48
|
}>;
|
|
@@ -3,22 +3,29 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.anyConditionSchema = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
const compound_condition_1 = require("../compound-condition");
|
|
6
|
+
const address_allowlist_1 = require("./address-allowlist");
|
|
6
7
|
const contract_1 = require("./contract");
|
|
8
|
+
const ecdsa_1 = require("./ecdsa");
|
|
7
9
|
const if_then_else_1 = require("./if-then-else");
|
|
8
10
|
const json_api_1 = require("./json-api");
|
|
9
11
|
const json_rpc_1 = require("./json-rpc");
|
|
10
12
|
const jwt_1 = require("./jwt");
|
|
11
13
|
const rpc_1 = require("./rpc");
|
|
12
14
|
const sequential_1 = require("./sequential");
|
|
15
|
+
const signing_1 = require("./signing");
|
|
13
16
|
const time_1 = require("./time");
|
|
14
17
|
exports.anyConditionSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
15
18
|
rpc_1.rpcConditionSchema,
|
|
16
19
|
time_1.timeConditionSchema,
|
|
20
|
+
address_allowlist_1.addressAllowlistConditionSchema,
|
|
17
21
|
contract_1.contractConditionSchema,
|
|
18
|
-
|
|
22
|
+
ecdsa_1.ecdsaConditionSchema,
|
|
19
23
|
json_api_1.jsonApiConditionSchema,
|
|
20
24
|
json_rpc_1.jsonRpcConditionSchema,
|
|
21
25
|
jwt_1.jwtConditionSchema,
|
|
26
|
+
signing_1.signingObjectAttributeConditionSchema,
|
|
27
|
+
signing_1.signingObjectAbiAttributeConditionSchema,
|
|
28
|
+
compound_condition_1.compoundConditionSchema,
|
|
22
29
|
sequential_1.sequentialConditionSchema,
|
|
23
30
|
if_then_else_1.ifThenElseConditionSchema,
|
|
24
31
|
]));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/utils.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,8DAAgE;AAEhE,yCAAqD;AACrD,iDAA2D;AAC3D,yCAAoD;AACpD,yCAAoD;AACpD,+BAA2C;AAC3C,+BAA2C;AAC3C,6CAAyD;AACzD,iCAA6C;AAEhC,QAAA,kBAAkB,GAAgB,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACzD,OAAC,CAAC,KAAK,CAAC;IACN,wBAAkB;IAClB,0BAAmB;IACnB,kCAAuB;IACvB,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/utils.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,8DAAgE;AAEhE,2DAAsE;AACtE,yCAAqD;AACrD,mCAA+C;AAC/C,iDAA2D;AAC3D,yCAAoD;AACpD,yCAAoD;AACpD,+BAA2C;AAC3C,+BAA2C;AAC3C,6CAAyD;AACzD,uCAGmB;AACnB,iCAA6C;AAEhC,QAAA,kBAAkB,GAAgB,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACzD,OAAC,CAAC,KAAK,CAAC;IACN,wBAAkB;IAClB,0BAAmB;IACnB,mDAA+B;IAC/B,kCAAuB;IACvB,4BAAoB;IACpB,iCAAsB;IACtB,iCAAsB;IACtB,wBAAkB;IAClB,+CAAqC;IACrC,kDAAwC;IACxC,4CAAuB;IACvB,sCAAyB;IACzB,wCAAyB;CAC1B,CAAC,CACH,CAAC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { DkgPublicKey, ThresholdMessageKit } from '@nucypher/nucypher-core';
|
|
2
2
|
export { Domain, domains, fromBytes, getPorterUris, initialize, toBytes, toHexString, } from '@nucypher/shared';
|
|
3
3
|
export * as conditions from './conditions';
|
|
4
|
+
export { setSigningCohortConditions, signUserOp } from './sign';
|
|
4
5
|
export { decrypt, encrypt, encryptWithPublicKey } from './taco';
|
package/dist/cjs/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.encryptWithPublicKey = exports.encrypt = exports.decrypt = exports.conditions = exports.toHexString = exports.toBytes = exports.initialize = exports.getPorterUris = exports.fromBytes = exports.domains = exports.ThresholdMessageKit = exports.DkgPublicKey = void 0;
|
|
36
|
+
exports.encryptWithPublicKey = exports.encrypt = exports.decrypt = exports.signUserOp = exports.setSigningCohortConditions = exports.conditions = exports.toHexString = exports.toBytes = exports.initialize = exports.getPorterUris = exports.fromBytes = exports.domains = exports.ThresholdMessageKit = exports.DkgPublicKey = void 0;
|
|
37
37
|
var nucypher_core_1 = require("@nucypher/nucypher-core");
|
|
38
38
|
Object.defineProperty(exports, "DkgPublicKey", { enumerable: true, get: function () { return nucypher_core_1.DkgPublicKey; } });
|
|
39
39
|
Object.defineProperty(exports, "ThresholdMessageKit", { enumerable: true, get: function () { return nucypher_core_1.ThresholdMessageKit; } });
|
|
@@ -45,6 +45,9 @@ Object.defineProperty(exports, "initialize", { enumerable: true, get: function (
|
|
|
45
45
|
Object.defineProperty(exports, "toBytes", { enumerable: true, get: function () { return shared_1.toBytes; } });
|
|
46
46
|
Object.defineProperty(exports, "toHexString", { enumerable: true, get: function () { return shared_1.toHexString; } });
|
|
47
47
|
exports.conditions = __importStar(require("./conditions"));
|
|
48
|
+
var sign_1 = require("./sign");
|
|
49
|
+
Object.defineProperty(exports, "setSigningCohortConditions", { enumerable: true, get: function () { return sign_1.setSigningCohortConditions; } });
|
|
50
|
+
Object.defineProperty(exports, "signUserOp", { enumerable: true, get: function () { return sign_1.signUserOp; } });
|
|
48
51
|
var taco_1 = require("./taco");
|
|
49
52
|
Object.defineProperty(exports, "decrypt", { enumerable: true, get: function () { return taco_1.decrypt; } });
|
|
50
53
|
Object.defineProperty(exports, "encrypt", { enumerable: true, get: function () { return taco_1.encrypt; } });
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA4E;AAAnE,6GAAA,YAAY,OAAA;AAAE,oHAAA,mBAAmB,OAAA;AAC1C,2CAQ0B;AANxB,iGAAA,OAAO,OAAA;AACP,mGAAA,SAAS,OAAA;AACT,uGAAA,aAAa,OAAA;AACb,oGAAA,UAAU,OAAA;AACV,iGAAA,OAAO,OAAA;AACP,qGAAA,WAAW,OAAA;AAGb,2DAA2C;AAE3C,+BAAgE;AAAvD,+FAAA,OAAO,OAAA;AAAE,+FAAA,OAAO,OAAA;AAAE,4GAAA,oBAAoB,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA4E;AAAnE,6GAAA,YAAY,OAAA;AAAE,oHAAA,mBAAmB,OAAA;AAC1C,2CAQ0B;AANxB,iGAAA,OAAO,OAAA;AACP,mGAAA,SAAS,OAAA;AACT,uGAAA,aAAa,OAAA;AACb,oGAAA,UAAU,OAAA;AACV,iGAAA,OAAO,OAAA;AACP,qGAAA,WAAW,OAAA;AAGb,2DAA2C;AAE3C,+BAAgE;AAAvD,kHAAA,0BAA0B,OAAA;AAAE,kGAAA,UAAU,OAAA;AAC/C,+BAAgE;AAAvD,+FAAA,OAAO,OAAA;AAAE,+FAAA,OAAO,OAAA;AAAE,4GAAA,oBAAoB,OAAA"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Domain, TacoSignature, UserOperation } from '@nucypher/shared';
|
|
2
|
+
import { ethers } from 'ethers';
|
|
3
|
+
import { Condition } from './conditions/condition';
|
|
4
|
+
import { ConditionContext } from './conditions/context';
|
|
5
|
+
export type SignResult = {
|
|
6
|
+
messageHash: string;
|
|
7
|
+
aggregatedSignature: string;
|
|
8
|
+
signingResults: {
|
|
9
|
+
[ursulaAddress: string]: TacoSignature;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Signs a UserOperation.
|
|
14
|
+
* @param provider - The Ethereum provider to use for signing.
|
|
15
|
+
* @param domain - The TACo domain being used.
|
|
16
|
+
* @param cohortId - The cohort ID that identifies the signing cohort.
|
|
17
|
+
* @param chainId - The chain ID for the signing operation.
|
|
18
|
+
* @param userOp - The UserOperation to be signed.
|
|
19
|
+
* @param aaVersion - The AA version of the account abstraction to use for signing.
|
|
20
|
+
* @param context - Optional condition context for the context variable resolution.
|
|
21
|
+
* @param porterUris - Optional URIs for the Porter service. If not provided, will fetch the default URIs from the domain.
|
|
22
|
+
* @returns A promise that resolves to a SignResult containing the message hash, aggregated signature, and signing results from the Porter service.
|
|
23
|
+
* @throws An error if the signing process fails due to insufficient signatures or mismatched hashes.
|
|
24
|
+
*/
|
|
25
|
+
export declare function signUserOp(provider: ethers.providers.Provider, domain: Domain, cohortId: number, chainId: number, userOp: UserOperation, aaVersion: 'mdt' | '0.8.0' | string, context?: ConditionContext, porterUris?: string[]): Promise<SignResult>;
|
|
26
|
+
export declare function setSigningCohortConditions(provider: ethers.providers.JsonRpcProvider, domain: Domain, conditions: Condition, cohortId: number, chainId: number, signer: ethers.Signer): Promise<ethers.ContractTransaction>;
|
package/dist/cjs/sign.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.signUserOp = signUserOp;
|
|
4
|
+
exports.setSigningCohortConditions = setSigningCohortConditions;
|
|
5
|
+
const shared_1 = require("@nucypher/shared");
|
|
6
|
+
const ethers_1 = require("ethers");
|
|
7
|
+
const condition_expr_1 = require("./conditions/condition-expr");
|
|
8
|
+
const ERR_INSUFFICIENT_SIGNATURES = (errors) => `Threshold of signatures not met; TACo signing failed with errors: ${JSON.stringify(errors)}`;
|
|
9
|
+
const ERR_MISMATCHED_HASHES = (hashToSignatures) => `Threshold of signatures not met; multiple mismatched hashes found: ${JSON.stringify(Object.fromEntries(hashToSignatures.entries()))}`;
|
|
10
|
+
function aggregateSignatures(signaturesByAddress, threshold) {
|
|
11
|
+
// Aggregate hex signatures by concatenating them; being careful to remove the '0x' prefix from each signature except the first one.
|
|
12
|
+
const signatures = Object.values(signaturesByAddress)
|
|
13
|
+
.map((sig) => sig.signature)
|
|
14
|
+
.slice(0, threshold);
|
|
15
|
+
if (signatures.length === 1) {
|
|
16
|
+
return signatures[0];
|
|
17
|
+
}
|
|
18
|
+
// Concatenate signatures
|
|
19
|
+
const allBytes = signatures.flatMap((hex) => Array.from((0, shared_1.fromHexString)(hex)));
|
|
20
|
+
return `0x${(0, shared_1.toHexString)(new Uint8Array(allBytes))}`;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Signs a UserOperation.
|
|
24
|
+
* @param provider - The Ethereum provider to use for signing.
|
|
25
|
+
* @param domain - The TACo domain being used.
|
|
26
|
+
* @param cohortId - The cohort ID that identifies the signing cohort.
|
|
27
|
+
* @param chainId - The chain ID for the signing operation.
|
|
28
|
+
* @param userOp - The UserOperation to be signed.
|
|
29
|
+
* @param aaVersion - The AA version of the account abstraction to use for signing.
|
|
30
|
+
* @param context - Optional condition context for the context variable resolution.
|
|
31
|
+
* @param porterUris - Optional URIs for the Porter service. If not provided, will fetch the default URIs from the domain.
|
|
32
|
+
* @returns A promise that resolves to a SignResult containing the message hash, aggregated signature, and signing results from the Porter service.
|
|
33
|
+
* @throws An error if the signing process fails due to insufficient signatures or mismatched hashes.
|
|
34
|
+
*/
|
|
35
|
+
async function signUserOp(provider, domain, cohortId, chainId, userOp, aaVersion, context, porterUris) {
|
|
36
|
+
const porterUrisFull = porterUris
|
|
37
|
+
? porterUris
|
|
38
|
+
: await (0, shared_1.getPorterUris)(domain);
|
|
39
|
+
const porter = new shared_1.PorterClient(porterUrisFull);
|
|
40
|
+
const signers = await shared_1.SigningCoordinatorAgent.getParticipants(provider, domain, cohortId);
|
|
41
|
+
const threshold = await shared_1.SigningCoordinatorAgent.getThreshold(provider, domain, cohortId);
|
|
42
|
+
const pythonUserOp = (0, shared_1.convertUserOperationToPython)(userOp);
|
|
43
|
+
const signingRequest = new shared_1.UserOperationSignatureRequest(pythonUserOp, aaVersion, cohortId, chainId, context || {}, 'userop');
|
|
44
|
+
const signingRequests = Object.fromEntries(signers.map((signer) => [
|
|
45
|
+
signer.provider,
|
|
46
|
+
(0, shared_1.toBase64)(signingRequest.toBytes()),
|
|
47
|
+
]));
|
|
48
|
+
// Build signing request for the user operation
|
|
49
|
+
const porterSignResult = await porter.signUserOp(signingRequests, threshold);
|
|
50
|
+
const hashToSignatures = new Map();
|
|
51
|
+
// Single pass: decode signatures and populate signingResults
|
|
52
|
+
for (const [ursulaAddress, signature] of Object.entries(porterSignResult.signingResults)) {
|
|
53
|
+
// For non-optimistic: track hashes and group signatures for aggregation
|
|
54
|
+
const hash = signature.messageHash;
|
|
55
|
+
if (!hashToSignatures.has(hash)) {
|
|
56
|
+
hashToSignatures.set(hash, {});
|
|
57
|
+
}
|
|
58
|
+
hashToSignatures.get(hash)[ursulaAddress] = signature;
|
|
59
|
+
}
|
|
60
|
+
let messageHash = undefined;
|
|
61
|
+
let signaturesToAggregate = undefined;
|
|
62
|
+
for (const [hash, signatures] of hashToSignatures.entries()) {
|
|
63
|
+
if (Object.keys(signatures).length >= threshold) {
|
|
64
|
+
signaturesToAggregate = signatures;
|
|
65
|
+
messageHash = hash;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Insufficient signatures for a message hash to meet the threshold
|
|
70
|
+
if (!messageHash || !signaturesToAggregate) {
|
|
71
|
+
if (hashToSignatures.size > 1 &&
|
|
72
|
+
Object.keys(porterSignResult.errors).length < signers.length - threshold) {
|
|
73
|
+
// Two things are true:
|
|
74
|
+
// 1. we have multiple hashes, which means we have mismatched hashes from different nodes
|
|
75
|
+
// we don't really expect this to happen (other than some malicious nodes)
|
|
76
|
+
// 2. number of errors still could have allowed for a threshold of signatures
|
|
77
|
+
console.error('Porter returned mismatched message hashes:', hashToSignatures);
|
|
78
|
+
throw new Error(ERR_MISMATCHED_HASHES(hashToSignatures));
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
throw new Error(ERR_INSUFFICIENT_SIGNATURES(porterSignResult.errors));
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const aggregatedSignature = aggregateSignatures(signaturesToAggregate, threshold);
|
|
85
|
+
return {
|
|
86
|
+
messageHash,
|
|
87
|
+
aggregatedSignature,
|
|
88
|
+
signingResults: porterSignResult.signingResults,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
async function setSigningCohortConditions(provider, domain, conditions, cohortId, chainId, signer) {
|
|
92
|
+
// Convert Condition to ConditionExpression, then to JSON, then to bytes
|
|
93
|
+
const conditionExpression = new condition_expr_1.ConditionExpression(conditions);
|
|
94
|
+
const conditionsJson = conditionExpression.toJson();
|
|
95
|
+
const conditionsBytes = ethers_1.ethers.utils.toUtf8Bytes(conditionsJson);
|
|
96
|
+
// Set conditions on the SigningCoordinator contract
|
|
97
|
+
return await shared_1.SigningCoordinatorAgent.setSigningCohortConditions(provider, domain, cohortId, chainId, conditionsBytes, signer);
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=sign.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/sign.ts"],"names":[],"mappings":";;AAoEA,gCA4GC;AAED,gEAsBC;AAxMD,6CAa0B;AAC1B,mCAAgC;AAGhC,gEAAkE;AAGlE,MAAM,2BAA2B,GAAG,CAAC,MAAe,EAAE,EAAE,CACtD,qEAAqE,IAAI,CAAC,SAAS,CACjF,MAAM,CACP,EAAE,CAAC;AACN,MAAM,qBAAqB,GAAG,CAC5B,gBAAyE,EACzE,EAAE,CACF,sEAAsE,IAAI,CAAC,SAAS,CAClF,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAC/C,EAAE,CAAC;AAQN,SAAS,mBAAmB,CAC1B,mBAEC,EACD,SAAiB;IAEjB,oIAAoI;IACpI,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC;SAClD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC;SAC3B,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IACvB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC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;YAC7E,OAAO,CAAC,KAAK,CACX,4CAA4C,EAC5C,gBAAgB,CACjB,CAAC;YACF,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,gBAAgB,CAAC,CAAC,CAAC;QAC3D,CAAC;aAAM,CAAC;YACN,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;IAED,MAAM,mBAAmB,GAAG,mBAAmB,CAC7C,qBAAqB,EACrB,SAAS,CACV,CAAC;IAEF,OAAO;QACL,WAAW;QACX,mBAAmB;QACnB,cAAc,EAAE,gBAAgB,CAAC,cAAc;KAChD,CAAC;AACJ,CAAC;AAEM,KAAK,UAAU,0BAA0B,CAC9C,QAA0C,EAC1C,MAAc,EACd,UAAqB,EACrB,QAAgB,EAChB,OAAe,EACf,MAAqB;IAErB,wEAAwE;IACxE,MAAM,mBAAmB,GAAG,IAAI,oCAAmB,CAAC,UAAU,CAAC,CAAC;IAChE,MAAM,cAAc,GAAG,mBAAmB,CAAC,MAAM,EAAE,CAAC;IACpD,MAAM,eAAe,GAAG,eAAM,CAAC,KAAK,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAEjE,oDAAoD;IACpD,OAAO,MAAM,gCAAuB,CAAC,0BAA0B,CAC7D,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,EACP,eAAe,EACf,MAAM,CACP,CAAC;AACJ,CAAC"}
|
package/dist/cjs/types.d.ts
CHANGED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Condition } from '../condition';
|
|
2
|
+
import { AddressAllowlistConditionProps, AddressAllowlistConditionType } from '../schemas/address-allowlist';
|
|
3
|
+
import { OmitConditionType } from '../shared';
|
|
4
|
+
export { AddressAllowlistConditionProps, AddressAllowlistConditionType };
|
|
5
|
+
/**
|
|
6
|
+
* A condition that checks if a wallet address is in a list of allowed addresses.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AddressAllowlistCondition extends Condition {
|
|
9
|
+
constructor(value: OmitConditionType<AddressAllowlistConditionProps>);
|
|
10
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Condition } from '../condition';
|
|
2
|
+
import { addressAllowlistConditionSchema, AddressAllowlistConditionType, } from '../schemas/address-allowlist';
|
|
3
|
+
export { AddressAllowlistConditionType };
|
|
4
|
+
/**
|
|
5
|
+
* A condition that checks if a wallet address is in a list of allowed addresses.
|
|
6
|
+
*/
|
|
7
|
+
export class AddressAllowlistCondition extends Condition {
|
|
8
|
+
constructor(value) {
|
|
9
|
+
super(addressAllowlistConditionSchema, {
|
|
10
|
+
conditionType: AddressAllowlistConditionType,
|
|
11
|
+
...value,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=address-allowlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-allowlist.js","sourceRoot":"","sources":["../../../../src/conditions/base/address-allowlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAEL,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAkC,6BAA6B,EAAE,CAAC;AAEzE;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IACtD,YAAY,KAAwD;QAClE,KAAK,CAAC,+BAA+B,EAAE;YACrC,aAAa,EAAE,6BAA6B;YAC5C,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Condition } from '../condition';
|
|
2
|
+
import { ECDSAConditionProps } from '../schemas/ecdsa';
|
|
3
|
+
import { OmitConditionType } from '../shared';
|
|
4
|
+
export { ECDSA_MESSAGE_PARAM_DEFAULT, ECDSA_SIGNATURE_PARAM_DEFAULT, ECDSAConditionProps, ecdsaConditionSchema, ECDSAConditionType, ECDSACurve, SUPPORTED_ECDSA_CURVES, } from '../schemas/ecdsa';
|
|
5
|
+
export declare class ECDSACondition extends Condition {
|
|
6
|
+
constructor(value: OmitConditionType<ECDSAConditionProps>);
|
|
7
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Condition } from '../condition';
|
|
2
|
+
import { ecdsaConditionSchema, ECDSAConditionType, } from '../schemas/ecdsa';
|
|
3
|
+
export { ECDSA_MESSAGE_PARAM_DEFAULT, ECDSA_SIGNATURE_PARAM_DEFAULT, ecdsaConditionSchema, ECDSAConditionType, SUPPORTED_ECDSA_CURVES, } from '../schemas/ecdsa';
|
|
4
|
+
export class ECDSACondition extends Condition {
|
|
5
|
+
constructor(value) {
|
|
6
|
+
super(ecdsaConditionSchema, {
|
|
7
|
+
conditionType: ECDSAConditionType,
|
|
8
|
+
...value,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=ecdsa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecdsa.js","sourceRoot":"","sources":["../../../../src/conditions/base/ecdsa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAEL,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EACL,2BAA2B,EAC3B,6BAA6B,EAE7B,oBAAoB,EACpB,kBAAkB,EAElB,sBAAsB,GACvB,MAAM,kBAAkB,CAAC;AAE1B,MAAM,OAAO,cAAe,SAAQ,SAAS;IAC3C,YAAY,KAA6C;QACvD,KAAK,CAAC,oBAAoB,EAAE;YAC1B,aAAa,EAAE,kBAAkB;YACjC,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
export * as addressAllowlist from './address-allowlist';
|
|
1
2
|
export * as contract from './contract';
|
|
3
|
+
export * as ecdsa from './ecdsa';
|
|
2
4
|
export * as jsonApi from './json-api';
|
|
3
5
|
export * as jsonRpc from './json-rpc';
|
|
4
6
|
export * as jwt from './jwt';
|
|
5
7
|
export * as rpc from './rpc';
|
|
8
|
+
export * as signing from './signing';
|
|
6
9
|
export * as time from './time';
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// Exporting classes here instead of their respective schema files to
|
|
2
2
|
// avoid circular dependency on Condition class.
|
|
3
|
+
export * as addressAllowlist from './address-allowlist';
|
|
3
4
|
export * as contract from './contract';
|
|
5
|
+
export * as ecdsa from './ecdsa';
|
|
4
6
|
export * as jsonApi from './json-api';
|
|
5
7
|
export * as jsonRpc from './json-rpc';
|
|
6
8
|
export * as jwt from './jwt';
|
|
7
9
|
export * as rpc from './rpc';
|
|
10
|
+
export * as signing from './signing';
|
|
8
11
|
export * as time from './time';
|
|
9
12
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conditions/base/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,gDAAgD;AAEhD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conditions/base/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,gDAAgD;AAEhD,OAAO,KAAK,gBAAgB,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Condition } from '../condition';
|
|
2
|
+
import { SigningObjectAbiAttributeConditionProps, SigningObjectAttributeConditionProps } from '../schemas/signing';
|
|
3
|
+
import { OmitConditionType } from '../shared';
|
|
4
|
+
export { AbiCallValidationProps, abiCallValidationSchema, AbiParameterValidationProps, abiParameterValidationSchema, SIGNING_CONDITION_OBJECT_CONTEXT_VAR, SigningObjectAbiAttributeConditionProps, signingObjectAbiAttributeConditionSchema, SigningObjectAbiAttributeConditionType, SigningObjectAttributeConditionProps, signingObjectAttributeConditionSchema, SigningObjectAttributeConditionType, } from '../schemas/signing';
|
|
5
|
+
export declare class SigningObjectAttributeCondition extends Condition {
|
|
6
|
+
constructor(value: OmitConditionType<SigningObjectAttributeConditionProps>);
|
|
7
|
+
}
|
|
8
|
+
export declare class SigningObjectAbiAttributeCondition extends Condition {
|
|
9
|
+
constructor(value: OmitConditionType<SigningObjectAbiAttributeConditionProps>);
|
|
10
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Condition } from '../condition';
|
|
2
|
+
import { signingObjectAbiAttributeConditionSchema, SigningObjectAbiAttributeConditionType, signingObjectAttributeConditionSchema, SigningObjectAttributeConditionType, } from '../schemas/signing';
|
|
3
|
+
export { abiCallValidationSchema, abiParameterValidationSchema, SIGNING_CONDITION_OBJECT_CONTEXT_VAR, signingObjectAbiAttributeConditionSchema, SigningObjectAbiAttributeConditionType, signingObjectAttributeConditionSchema, SigningObjectAttributeConditionType, } from '../schemas/signing';
|
|
4
|
+
export class SigningObjectAttributeCondition extends Condition {
|
|
5
|
+
constructor(value) {
|
|
6
|
+
super(signingObjectAttributeConditionSchema, {
|
|
7
|
+
conditionType: SigningObjectAttributeConditionType,
|
|
8
|
+
...value,
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
export class SigningObjectAbiAttributeCondition extends Condition {
|
|
13
|
+
constructor(value) {
|
|
14
|
+
super(signingObjectAbiAttributeConditionSchema, {
|
|
15
|
+
conditionType: SigningObjectAbiAttributeConditionType,
|
|
16
|
+
...value,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=signing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing.js","sourceRoot":"","sources":["../../../../src/conditions/base/signing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAEL,wCAAwC,EACxC,sCAAsC,EAEtC,qCAAqC,EACrC,mCAAmC,GACpC,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAEL,uBAAuB,EAEvB,4BAA4B,EAC5B,oCAAoC,EAEpC,wCAAwC,EACxC,sCAAsC,EAEtC,qCAAqC,EACrC,mCAAmC,GACpC,MAAM,oBAAoB,CAAC;AAE5B,MAAM,OAAO,+BAAgC,SAAQ,SAAS;IAC5D,YAAY,KAA8D;QACxE,KAAK,CAAC,qCAAqC,EAAE;YAC3C,aAAa,EAAE,mCAAmC;YAClD,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,kCAAmC,SAAQ,SAAS;IAC/D,YACE,KAAiE;QAEjE,KAAK,CAAC,wCAAwC,EAAE;YAC9C,aAAa,EAAE,sCAAsC;YACrD,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF"}
|