@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
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { AddressAllowlistCondition, AddressAllowlistConditionType, } from './base/address-allowlist';
|
|
1
2
|
import { ContractCondition, ContractConditionType, } from './base/contract';
|
|
3
|
+
import { ECDSACondition, ECDSAConditionType, } from './base/ecdsa';
|
|
2
4
|
import { JsonApiCondition, JsonApiConditionType, } from './base/json-api';
|
|
3
5
|
import { JsonRpcCondition, JsonRpcConditionType, } from './base/json-rpc';
|
|
4
6
|
import { JWTCondition, JWTConditionType } from './base/jwt';
|
|
5
7
|
import { RpcCondition, RpcConditionType } from './base/rpc';
|
|
8
|
+
import { SigningObjectAbiAttributeCondition, SigningObjectAbiAttributeConditionType, SigningObjectAttributeCondition, SigningObjectAttributeConditionType, } from './base/signing';
|
|
6
9
|
import { TimeCondition, TimeConditionType, } from './base/time';
|
|
7
10
|
import { CompoundCondition, CompoundConditionType, } from './compound-condition';
|
|
8
11
|
import { IfThenElseCondition, IfThenElseConditionType, } from './if-then-else-condition';
|
|
@@ -18,12 +21,20 @@ export class ConditionFactory {
|
|
|
18
21
|
return new TimeCondition(props);
|
|
19
22
|
case ContractConditionType:
|
|
20
23
|
return new ContractCondition(props);
|
|
24
|
+
case ECDSAConditionType:
|
|
25
|
+
return new ECDSACondition(props);
|
|
21
26
|
case JsonApiConditionType:
|
|
22
27
|
return new JsonApiCondition(props);
|
|
23
28
|
case JsonRpcConditionType:
|
|
24
29
|
return new JsonRpcCondition(props);
|
|
25
30
|
case JWTConditionType:
|
|
26
31
|
return new JWTCondition(props);
|
|
32
|
+
case AddressAllowlistConditionType:
|
|
33
|
+
return new AddressAllowlistCondition(props);
|
|
34
|
+
case SigningObjectAttributeConditionType:
|
|
35
|
+
return new SigningObjectAttributeCondition(props);
|
|
36
|
+
case SigningObjectAbiAttributeConditionType:
|
|
37
|
+
return new SigningObjectAbiAttributeCondition(props);
|
|
27
38
|
// Logical Conditions
|
|
28
39
|
case CompoundConditionType:
|
|
29
40
|
return new CompoundCondition(props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-factory.js","sourceRoot":"","sources":["../../../src/conditions/condition-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAEjB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAqB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAqB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EACL,aAAa,EAEb,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EAEjB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mBAAmB,EAEnB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,mBAAmB,EAEnB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,MAAM,0BAA0B,GAAG,CAAC,IAAY,EAAE,EAAE,CAClD,2BAA2B,IAAI,EAAE,CAAC;AAEpC,MAAM,OAAO,gBAAgB;IACpB,MAAM,CAAC,kBAAkB,CAAC,KAAqB;QACpD,QAAQ,KAAK,CAAC,aAAa,EAAE,CAAC;YAC5B,kBAAkB;YAClB,KAAK,gBAAgB;gBACnB,OAAO,IAAI,YAAY,CAAC,KAA0B,CAAC,CAAC;YACtD,KAAK,iBAAiB;gBACpB,OAAO,IAAI,aAAa,CAAC,KAA2B,CAAC,CAAC;YACxD,KAAK,qBAAqB;gBACxB,OAAO,IAAI,iBAAiB,CAAC,KAA+B,CAAC,CAAC;YAChE,KAAK,oBAAoB;gBACvB,OAAO,IAAI,gBAAgB,CAAC,KAA8B,CAAC,CAAC;YAC9D,KAAK,oBAAoB;gBACvB,OAAO,IAAI,gBAAgB,CAAC,KAA8B,CAAC,CAAC;YAC9D,KAAK,gBAAgB;gBACnB,OAAO,IAAI,YAAY,CAAC,KAA0B,CAAC,CAAC;YACtD,qBAAqB;YACrB,KAAK,qBAAqB;gBACxB,OAAO,IAAI,iBAAiB,CAAC,KAA+B,CAAC,CAAC;YAChE,KAAK,uBAAuB;gBAC1B,OAAO,IAAI,mBAAmB,CAAC,KAAiC,CAAC,CAAC;YACpE,KAAK,uBAAuB;gBAC1B,OAAO,IAAI,mBAAmB,CAAC,KAAiC,CAAC,CAAC;YACpE;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;CACF"}
|
|
1
|
+
{"version":3,"file":"condition-factory.js","sourceRoot":"","sources":["../../../src/conditions/condition-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EAEzB,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iBAAiB,EAEjB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,cAAc,EAEd,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,GACrB,MAAM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K,6BAA6B;gBAChC,OAAO,IAAI,yBAAyB,CAClC,KAAuC,CACxC,CAAC;YACJ,KAAK,mCAAmC;gBACtC,OAAO,IAAI,+BAA+B,CACxC,KAA6C,CAC9C,CAAC;YACJ,KAAK,sCAAsC;gBACzC,OAAO,IAAI,kCAAkC,CAC3C,KAAgD,CACjD,CAAC;YACJ,qBAAqB;YACrB,KAAK,qBAAqB;gBACxB,OAAO,IAAI,iBAAiB,CAAC,KAA+B,CAAC,CAAC;YAChE,KAAK,uBAAuB;gBAC1B,OAAO,IAAI,mBAAmB,CAAC,KAAiC,CAAC,CAAC;YACpE,KAAK,uBAAuB;gBAC1B,OAAO,IAAI,mBAAmB,CAAC,KAAiC,CAAC,CAAC;YACpE;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { ThresholdMessageKit } from '@nucypher/nucypher-core';
|
|
2
|
+
import { Domain } from '@nucypher/shared';
|
|
2
3
|
import { AuthProvider, AuthSignature } from '@nucypher/taco-auth';
|
|
4
|
+
import { ethers } from 'ethers';
|
|
3
5
|
import { CoreContext } from '../../types';
|
|
4
6
|
import { Condition } from '../condition';
|
|
5
7
|
export type CustomContextParam = string | number | boolean | bigint | Uint8Array;
|
|
6
8
|
export type ContextParam = CustomContextParam | AuthSignature;
|
|
9
|
+
export declare const AUTOMATICALLY_INJECTED_CONTEXT_PARAMS: string[];
|
|
7
10
|
export declare const RESERVED_CONTEXT_PARAMS: string[];
|
|
8
11
|
export declare class ConditionContext {
|
|
9
12
|
requestedContextParameters: Set<string>;
|
|
@@ -25,4 +28,5 @@ export declare class ConditionContext {
|
|
|
25
28
|
toCoreContext(): Promise<CoreContext>;
|
|
26
29
|
toContextParameters: () => Promise<Record<string, ContextParam>>;
|
|
27
30
|
static fromMessageKit(messageKit: ThresholdMessageKit): ConditionContext;
|
|
31
|
+
static forSigningCohort(provider: ethers.providers.JsonRpcProvider, domain: Domain, cohortId: number, chainId: number): Promise<ConditionContext>;
|
|
28
32
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import { SigningCoordinatorAgent } from '@nucypher/shared';
|
|
1
2
|
import { EIP1271AuthProvider, EIP4361AuthProvider, SingleSignOnEIP4361AuthProvider, USER_ADDRESS_PARAM_DEFAULT, } from '@nucypher/taco-auth';
|
|
3
|
+
import { ethers } from 'ethers';
|
|
2
4
|
import { CoreConditions, CoreContext } from '../../types';
|
|
3
5
|
import { toJSON } from '../../utils';
|
|
4
6
|
import { ConditionExpression } from '../condition-expr';
|
|
5
7
|
import { CONTEXT_PARAM_FULL_MATCH_REGEXP, CONTEXT_PARAM_PREFIX, CONTEXT_PARAM_REGEXP, USER_ADDRESS_PARAMS, } from '../const';
|
|
8
|
+
import { SIGNING_CONDITION_OBJECT_CONTEXT_VAR } from '../schemas/signing';
|
|
6
9
|
const ERR_RESERVED_PARAM = (key) => `Cannot use reserved parameter name ${key} as custom parameter`;
|
|
7
10
|
const ERR_INVALID_CUSTOM_PARAM = (key) => `Custom parameter ${key} must start with ${CONTEXT_PARAM_PREFIX}`;
|
|
8
11
|
const ERR_AUTH_PROVIDER_REQUIRED = (key) => `No matching authentication provider to satisfy ${key} context variable in condition`;
|
|
@@ -10,6 +13,7 @@ const ERR_MISSING_CONTEXT_PARAMS = (params) => `Missing custom context parameter
|
|
|
10
13
|
const ERR_UNKNOWN_CUSTOM_CONTEXT_PARAM = (param) => `Unknown custom context parameter: ${param}`;
|
|
11
14
|
const ERR_INVALID_AUTH_PROVIDER_TYPE = (param, expected) => `Invalid AuthProvider type for ${param}; expected ${expected}`;
|
|
12
15
|
const ERR_AUTH_PROVIDER_NOT_NEEDED_FOR_CONTEXT_PARAM = (param) => `AuthProvider not necessary for context parameter: ${param}`;
|
|
16
|
+
const ERR_AUTO_INJECTED_CONTEXT_PARAM = (param) => `Context parameter ${param} is automatically injected and cannot be set manually`;
|
|
13
17
|
const EXPECTED_AUTH_PROVIDER_TYPES = {
|
|
14
18
|
[USER_ADDRESS_PARAM_DEFAULT]: [
|
|
15
19
|
EIP4361AuthProvider,
|
|
@@ -17,7 +21,14 @@ const EXPECTED_AUTH_PROVIDER_TYPES = {
|
|
|
17
21
|
SingleSignOnEIP4361AuthProvider,
|
|
18
22
|
],
|
|
19
23
|
};
|
|
20
|
-
export const
|
|
24
|
+
export const AUTOMATICALLY_INJECTED_CONTEXT_PARAMS = [
|
|
25
|
+
// These context parameters are automatically injected on the node side.
|
|
26
|
+
SIGNING_CONDITION_OBJECT_CONTEXT_VAR,
|
|
27
|
+
];
|
|
28
|
+
export const RESERVED_CONTEXT_PARAMS = [
|
|
29
|
+
USER_ADDRESS_PARAM_DEFAULT,
|
|
30
|
+
SIGNING_CONDITION_OBJECT_CONTEXT_VAR,
|
|
31
|
+
];
|
|
21
32
|
export class ConditionContext {
|
|
22
33
|
requestedContextParameters;
|
|
23
34
|
customContextParameters = {};
|
|
@@ -75,6 +86,9 @@ export class ConditionContext {
|
|
|
75
86
|
if (!ConditionContext.isContextParameter(customParam)) {
|
|
76
87
|
throw new Error(ERR_INVALID_CUSTOM_PARAM(customParam));
|
|
77
88
|
}
|
|
89
|
+
if (AUTOMATICALLY_INJECTED_CONTEXT_PARAMS.includes(customParam)) {
|
|
90
|
+
throw new Error(ERR_AUTO_INJECTED_CONTEXT_PARAM(customParam));
|
|
91
|
+
}
|
|
78
92
|
if (RESERVED_CONTEXT_PARAMS.includes(customParam)) {
|
|
79
93
|
throw new Error(ERR_RESERVED_PARAM(customParam));
|
|
80
94
|
}
|
|
@@ -135,7 +149,9 @@ export class ConditionContext {
|
|
|
135
149
|
const properties = Object.keys(condition);
|
|
136
150
|
properties.forEach((prop) => {
|
|
137
151
|
this.findContextParameter(condition[prop]).forEach((contextVar) => {
|
|
138
|
-
|
|
152
|
+
if (!AUTOMATICALLY_INJECTED_CONTEXT_PARAMS.includes(contextVar)) {
|
|
153
|
+
requestedParameters.add(contextVar);
|
|
154
|
+
}
|
|
139
155
|
});
|
|
140
156
|
});
|
|
141
157
|
return requestedParameters;
|
|
@@ -174,5 +190,14 @@ export class ConditionContext {
|
|
|
174
190
|
const conditionExpr = ConditionExpression.fromCoreConditions(messageKit.acp.conditions);
|
|
175
191
|
return new ConditionContext(conditionExpr.condition);
|
|
176
192
|
}
|
|
193
|
+
static async forSigningCohort(provider, domain, cohortId, chainId) {
|
|
194
|
+
// get signing condition from SigningCoordinator contract
|
|
195
|
+
const cohortConditionHex = await SigningCoordinatorAgent.getSigningCohortConditions(provider, domain, cohortId, chainId);
|
|
196
|
+
// Convert hex string to UTF-8 JSON string
|
|
197
|
+
const cohortConditionJson = ethers.utils.toUtf8String(cohortConditionHex);
|
|
198
|
+
const cohortCondition = new CoreConditions(cohortConditionJson);
|
|
199
|
+
const conditionExpr = ConditionExpression.fromCoreConditions(cohortCondition);
|
|
200
|
+
return new ConditionContext(conditionExpr.condition);
|
|
201
|
+
}
|
|
177
202
|
}
|
|
178
203
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/conditions/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,mBAAmB,EACnB,mBAAmB,EACnB,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/conditions/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAAU,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAGL,mBAAmB,EACnB,mBAAmB,EACnB,+BAA+B,EAC/B,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1D,O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C7B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,qBAAqB,CACjD,IAAI,CAAC,0BAA0B,CAChC,CAAC;QACF,IAAI,CAAC,kCAAkC,CAAC,UAAU,CAAC,CAAC;QACpD,OAAO,UAAU,CAAC;IACpB,CAAC,CAAC;IAEK,MAAM,CAAC,cAAc,CAC1B,UAA+B;QAE/B,MAAM,aAAa,GAAG,mBAAmB,CAAC,kBAAkB,CAC1D,UAAU,CAAC,GAAG,CAAC,UAAU,CAC1B,CAAC;QACF,OAAO,IAAI,gBAAgB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAClC,QAA0C,EAC1C,MAAc,EACd,QAAgB,EAChB,OAAe;QAEf,yDAAyD;QACzD,MAAM,kBAAkB,GACtB,MAAM,uBAAuB,CAAC,0BAA0B,CACtD,QAAQ,EACR,MAAM,EACN,QAAQ,EACR,OAAO,CACR,CAAC;QAEJ,0CAA0C;QAC1C,MAAM,mBAAmB,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;QAE1E,MAAM,eAAe,GAAG,IAAI,cAAc,CAAC,mBAAmB,CAAC,CAAC;QAChE,MAAM,aAAa,GACjB,mBAAmB,CAAC,kBAAkB,CAAC,eAAe,CAAC,CAAC;QAC1D,OAAO,IAAI,gBAAgB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AddressAllowlistConditionType = "address-allowlist";
|
|
3
|
+
export declare const addressAllowlistConditionSchema: z.ZodObject<{} & {
|
|
4
|
+
conditionType: z.ZodLiteral<"address-allowlist">;
|
|
5
|
+
userAddress: z.ZodLiteral<":userAddress">;
|
|
6
|
+
addresses: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
conditionType: "address-allowlist";
|
|
9
|
+
userAddress: ":userAddress";
|
|
10
|
+
addresses: string[];
|
|
11
|
+
}, {
|
|
12
|
+
conditionType: "address-allowlist";
|
|
13
|
+
userAddress: ":userAddress";
|
|
14
|
+
addresses: string[];
|
|
15
|
+
}>;
|
|
16
|
+
export type AddressAllowlistConditionProps = z.infer<typeof addressAllowlistConditionSchema>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { EthAddressSchemaStrict } from '@nucypher/shared';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { baseConditionSchema, UserAddressSchema } from './common';
|
|
4
|
+
export const AddressAllowlistConditionType = 'address-allowlist';
|
|
5
|
+
export const addressAllowlistConditionSchema = baseConditionSchema
|
|
6
|
+
.extend({
|
|
7
|
+
conditionType: z.literal(AddressAllowlistConditionType),
|
|
8
|
+
userAddress: UserAddressSchema,
|
|
9
|
+
addresses: z
|
|
10
|
+
.array(EthAddressSchemaStrict)
|
|
11
|
+
.min(1, 'At least one address must be provided')
|
|
12
|
+
.max(25, 'A maximum of 25 addresses is allowed')
|
|
13
|
+
.describe('List of wallet addresses allowed to decrypt. Addresses should be provided in checksummed form.'),
|
|
14
|
+
})
|
|
15
|
+
.strict()
|
|
16
|
+
.describe('Address Allowlist Condition for allowing decryption for specific wallet addresses. It is very handy when combined with other conditions.');
|
|
17
|
+
//# sourceMappingURL=address-allowlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-allowlist.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/address-allowlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElE,MAAM,CAAC,MAAM,6BAA6B,GAAG,mBAAmB,CAAC;AAEjE,MAAM,CAAC,MAAM,+BAA+B,GAAG,mBAAmB;KAC/D,MAAM,CAAC;IACN,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,6BAA6B,CAAC;IACvD,WAAW,EAAE,iBAAiB;IAC9B,SAAS,EAAE,CAAC;SACT,KAAK,CAAC,sBAAsB,CAAC;SAC7B,GAAG,CAAC,CAAC,EAAE,uCAAuC,CAAC;SAC/C,GAAG,CAAC,EAAE,EAAE,sCAAsC,CAAC;SAC/C,QAAQ,CACP,gGAAgG,CACjG;CACJ,CAAC;KACD,MAAM,EAAE;KACR,QAAQ,CACP,0IAA0I,CAC3I,CAAC"}
|
|
@@ -11,4 +11,6 @@ export declare const baseConditionSchema: z.ZodObject<{
|
|
|
11
11
|
declare function createUnionSchema<T extends readonly Primitive[]>(values: T): z.ZodNever | z.ZodLiteral<Primitive> | z.ZodUnion<[z.ZodLiteral<Primitive>, z.ZodLiteral<Primitive>, ...z.ZodLiteral<Primitive>[]]>;
|
|
12
12
|
export default createUnionSchema;
|
|
13
13
|
export declare const jsonPathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
14
|
+
export declare const jsonAuthorizationTypeSchema: z.ZodEnum<["Bearer", "Basic", "X-API-Key"]>;
|
|
14
15
|
export declare const httpsURLSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
16
|
+
export declare const hexStringSchema: z.ZodString;
|
|
@@ -16,7 +16,9 @@ export const UserAddressSchema = z
|
|
|
16
16
|
.literal(USER_ADDRESS_PARAM_DEFAULT)
|
|
17
17
|
.describe('This is a context variable that will be replaced at decryption time. It represents the Ethereum address of the requester attempting decryption.');
|
|
18
18
|
export const baseConditionSchema = z.object({
|
|
19
|
-
conditionType: z
|
|
19
|
+
conditionType: z
|
|
20
|
+
.string()
|
|
21
|
+
.describe('A unique identifier that indicates the condition variant in its serialized form. It is set automatically at every sub-class constructor when a new object is being created.'),
|
|
20
22
|
});
|
|
21
23
|
// Source: https://github.com/colinhacks/zod/issues/831#issuecomment-1063481764
|
|
22
24
|
const createUnion = (values) => {
|
|
@@ -54,8 +56,19 @@ export const jsonPathSchema = z
|
|
|
54
56
|
})
|
|
55
57
|
.describe('A string containing either a valid JSON Path Expression, or a Context Parameter.');
|
|
56
58
|
const validateHttpsURL = (url) => {
|
|
57
|
-
|
|
59
|
+
try {
|
|
60
|
+
const parsedUrl = new URL(url);
|
|
61
|
+
// Check if the URL is valid and uses HTTPS
|
|
62
|
+
return parsedUrl.protocol === 'https:';
|
|
63
|
+
}
|
|
64
|
+
catch (e) {
|
|
65
|
+
// If URL constructor throws, the URL is invalid
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
58
68
|
};
|
|
69
|
+
export const jsonAuthorizationTypeSchema = z
|
|
70
|
+
.enum(['Bearer', 'Basic', 'X-API-Key'])
|
|
71
|
+
.describe('The type of authorization to use when making the request.');
|
|
59
72
|
// Use our own URL refinement check due to https://github.com/colinhacks/zod/issues/2236
|
|
60
73
|
export const httpsURLSchema = z
|
|
61
74
|
.string()
|
|
@@ -63,4 +76,8 @@ export const httpsURLSchema = z
|
|
|
63
76
|
.refine((url) => validateHttpsURL(url), {
|
|
64
77
|
message: 'Invalid URL',
|
|
65
78
|
});
|
|
79
|
+
export const hexStringSchema = z
|
|
80
|
+
.string()
|
|
81
|
+
.regex(/^[0-9a-fA-F]+$/, 'Invalid hex string')
|
|
82
|
+
.describe('A string containing only hexadecimal characters (0-9, a-f, A-F)');
|
|
66
83
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAa,CAAC,EAAc,MAAM,KAAK,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM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,MAAM,EAAE;KACR,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE;IACtC,OAAO,EAAE,6BAA6B;CACvC,CAAC;KACD,QAAQ,CACP,kFAAkF,CACnF,CAAC;AAEJ,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAW,EAAE;IAChD,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,2CAA2C;QAC3C,OAAO,SAAS,CAAC,QAAQ,KAAK,QAAQ,CAAC;IACzC,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,gDAAgD;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC;KACzC,IAAI,CAAC,CAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;KACtC,QAAQ,CAAC,2DAA2D,CAAC,CAAC;AAEzE,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC;KAC5B,MAAM,EAAE;KACR,GAAG,EAAE;KACL,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,EAAE;IACtC,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC;AAEL,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,EAAE;KACR,KAAK,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;KAC7C,QAAQ,CAAC,iEAAiE,CAAC,CAAC"}
|
|
@@ -153,28 +153,31 @@ export declare const functionAbiSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
153
153
|
}>;
|
|
154
154
|
export type FunctionAbiProps = z.infer<typeof functionAbiSchema>;
|
|
155
155
|
export declare const ContractConditionType = "contract";
|
|
156
|
-
export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<
|
|
157
|
-
conditionType: z.ZodString;
|
|
158
|
-
}, {
|
|
159
|
-
conditionType: z.ZodDefault<z.ZodLiteral<"rpc">>;
|
|
156
|
+
export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
160
157
|
chain: z.ZodNumber;
|
|
161
|
-
|
|
162
|
-
parameters: z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>, z.ZodUnion<[z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodEnum<["earliest", "finalized", "safe", "latest", "pending"]>]>, z.ZodString]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>], null>]>;
|
|
163
|
-
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
158
|
+
returnValueTest: z.ZodEffects<z.ZodObject<{
|
|
164
159
|
index: z.ZodOptional<z.ZodNumber>;
|
|
165
|
-
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
166
|
-
}
|
|
160
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!=", "in", "!in"]>;
|
|
161
|
+
} & {
|
|
167
162
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
168
|
-
}
|
|
169
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
163
|
+
}, "strip", z.ZodTypeAny, {
|
|
164
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
170
165
|
value?: any;
|
|
171
166
|
index?: number | undefined;
|
|
172
167
|
}, {
|
|
173
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
168
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
169
|
+
value?: any;
|
|
170
|
+
index?: number | undefined;
|
|
171
|
+
}>, {
|
|
172
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
173
|
+
value?: any;
|
|
174
|
+
index?: number | undefined;
|
|
175
|
+
}, {
|
|
176
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
174
177
|
value?: any;
|
|
175
178
|
index?: number | undefined;
|
|
176
179
|
}>;
|
|
177
|
-
}
|
|
180
|
+
} & {
|
|
178
181
|
conditionType: z.ZodDefault<z.ZodLiteral<"contract">>;
|
|
179
182
|
contractAddress: z.ZodEffects<z.ZodString, string, string>;
|
|
180
183
|
standardContractType: z.ZodOptional<z.ZodEnum<["ERC20", "ERC721"]>>;
|
|
@@ -319,17 +322,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectU
|
|
|
319
322
|
stateMutability: "view" | "pure";
|
|
320
323
|
}>>;
|
|
321
324
|
parameters: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
322
|
-
}
|
|
325
|
+
}, "strip", z.ZodTypeAny, {
|
|
323
326
|
conditionType: "contract";
|
|
324
|
-
chain: number;
|
|
325
327
|
method: string;
|
|
326
|
-
parameters: any[];
|
|
327
328
|
returnValueTest: {
|
|
328
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
329
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
329
330
|
value?: any;
|
|
330
331
|
index?: number | undefined;
|
|
331
332
|
};
|
|
333
|
+
parameters: any[];
|
|
334
|
+
chain: number;
|
|
332
335
|
contractAddress: string;
|
|
336
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
333
337
|
functionAbi?: {
|
|
334
338
|
type: "function";
|
|
335
339
|
name: string;
|
|
@@ -349,18 +353,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectU
|
|
|
349
353
|
}[]];
|
|
350
354
|
stateMutability: "view" | "pure";
|
|
351
355
|
} | undefined;
|
|
352
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
353
356
|
}, {
|
|
354
|
-
chain: number;
|
|
355
357
|
method: string;
|
|
356
|
-
parameters: any[];
|
|
357
358
|
returnValueTest: {
|
|
358
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
359
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
359
360
|
value?: any;
|
|
360
361
|
index?: number | undefined;
|
|
361
362
|
};
|
|
363
|
+
parameters: any[];
|
|
364
|
+
chain: number;
|
|
362
365
|
contractAddress: string;
|
|
363
366
|
conditionType?: "contract" | undefined;
|
|
367
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
364
368
|
functionAbi?: {
|
|
365
369
|
type: "function";
|
|
366
370
|
name: string;
|
|
@@ -380,18 +384,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectU
|
|
|
380
384
|
}[]];
|
|
381
385
|
stateMutability: "view" | "pure";
|
|
382
386
|
} | undefined;
|
|
383
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
384
387
|
}>, {
|
|
385
388
|
conditionType: "contract";
|
|
386
|
-
chain: number;
|
|
387
389
|
method: string;
|
|
388
|
-
parameters: any[];
|
|
389
390
|
returnValueTest: {
|
|
390
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
391
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
391
392
|
value?: any;
|
|
392
393
|
index?: number | undefined;
|
|
393
394
|
};
|
|
395
|
+
parameters: any[];
|
|
396
|
+
chain: number;
|
|
394
397
|
contractAddress: string;
|
|
398
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
395
399
|
functionAbi?: {
|
|
396
400
|
type: "function";
|
|
397
401
|
name: string;
|
|
@@ -411,18 +415,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectU
|
|
|
411
415
|
}[]];
|
|
412
416
|
stateMutability: "view" | "pure";
|
|
413
417
|
} | undefined;
|
|
414
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
415
418
|
}, {
|
|
416
|
-
chain: number;
|
|
417
419
|
method: string;
|
|
418
|
-
parameters: any[];
|
|
419
420
|
returnValueTest: {
|
|
420
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
421
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
421
422
|
value?: any;
|
|
422
423
|
index?: number | undefined;
|
|
423
424
|
};
|
|
425
|
+
parameters: any[];
|
|
426
|
+
chain: number;
|
|
424
427
|
contractAddress: string;
|
|
425
428
|
conditionType?: "contract" | undefined;
|
|
429
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
426
430
|
functionAbi?: {
|
|
427
431
|
type: "function";
|
|
428
432
|
name: string;
|
|
@@ -442,6 +446,5 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectU
|
|
|
442
446
|
}[]];
|
|
443
447
|
stateMutability: "view" | "pure";
|
|
444
448
|
} | undefined;
|
|
445
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
446
449
|
}>;
|
|
447
450
|
export type ContractConditionProps = z.infer<typeof contractConditionSchema>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ECDSA_MESSAGE_PARAM_DEFAULT = ":message";
|
|
3
|
+
export declare const ECDSA_SIGNATURE_PARAM_DEFAULT = ":signature";
|
|
4
|
+
export declare const ECDSAConditionType = "ecdsa";
|
|
5
|
+
export declare const SUPPORTED_ECDSA_CURVES: readonly ["SECP256k1", "NIST256p", "NIST384p", "NIST521p", "Ed25519", "BRAINPOOLP256r1"];
|
|
6
|
+
export type ECDSACurve = (typeof SUPPORTED_ECDSA_CURVES)[number];
|
|
7
|
+
export declare const ecdsaConditionSchema: z.ZodEffects<z.ZodObject<{} & {
|
|
8
|
+
conditionType: z.ZodDefault<z.ZodLiteral<"ecdsa">>;
|
|
9
|
+
message: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodString]>>;
|
|
10
|
+
signature: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodString]>>;
|
|
11
|
+
verifyingKey: z.ZodString;
|
|
12
|
+
curve: z.ZodEnum<["SECP256k1", "NIST256p", "NIST384p", "NIST521p", "Ed25519", "BRAINPOOLP256r1"]>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
message: string;
|
|
15
|
+
conditionType: "ecdsa";
|
|
16
|
+
signature: string;
|
|
17
|
+
verifyingKey: string;
|
|
18
|
+
curve: "SECP256k1" | "NIST256p" | "NIST384p" | "NIST521p" | "Ed25519" | "BRAINPOOLP256r1";
|
|
19
|
+
}, {
|
|
20
|
+
verifyingKey: string;
|
|
21
|
+
curve: "SECP256k1" | "NIST256p" | "NIST384p" | "NIST521p" | "Ed25519" | "BRAINPOOLP256r1";
|
|
22
|
+
message?: string | undefined;
|
|
23
|
+
conditionType?: "ecdsa" | undefined;
|
|
24
|
+
signature?: string | undefined;
|
|
25
|
+
}>, {
|
|
26
|
+
message: string;
|
|
27
|
+
conditionType: "ecdsa";
|
|
28
|
+
signature: string;
|
|
29
|
+
verifyingKey: string;
|
|
30
|
+
curve: "SECP256k1" | "NIST256p" | "NIST384p" | "NIST521p" | "Ed25519" | "BRAINPOOLP256r1";
|
|
31
|
+
}, {
|
|
32
|
+
verifyingKey: string;
|
|
33
|
+
curve: "SECP256k1" | "NIST256p" | "NIST384p" | "NIST521p" | "Ed25519" | "BRAINPOOLP256r1";
|
|
34
|
+
message?: string | undefined;
|
|
35
|
+
conditionType?: "ecdsa" | undefined;
|
|
36
|
+
signature?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
export type ECDSAConditionProps = z.infer<typeof ecdsaConditionSchema>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { baseConditionSchema, hexStringSchema } from './common';
|
|
3
|
+
import { contextParamSchema } from './context';
|
|
4
|
+
export const ECDSA_MESSAGE_PARAM_DEFAULT = ':message';
|
|
5
|
+
export const ECDSA_SIGNATURE_PARAM_DEFAULT = ':signature';
|
|
6
|
+
export const ECDSAConditionType = 'ecdsa';
|
|
7
|
+
export const SUPPORTED_ECDSA_CURVES = [
|
|
8
|
+
'SECP256k1',
|
|
9
|
+
'NIST256p',
|
|
10
|
+
'NIST384p',
|
|
11
|
+
'NIST521p',
|
|
12
|
+
'Ed25519',
|
|
13
|
+
'BRAINPOOLP256r1',
|
|
14
|
+
];
|
|
15
|
+
export const ecdsaConditionSchema = baseConditionSchema
|
|
16
|
+
.extend({
|
|
17
|
+
conditionType: z.literal(ECDSAConditionType).default(ECDSAConditionType),
|
|
18
|
+
message: z
|
|
19
|
+
.union([z.string(), contextParamSchema])
|
|
20
|
+
.default(ECDSA_MESSAGE_PARAM_DEFAULT),
|
|
21
|
+
signature: z
|
|
22
|
+
.union([hexStringSchema, contextParamSchema])
|
|
23
|
+
.default(ECDSA_SIGNATURE_PARAM_DEFAULT),
|
|
24
|
+
verifyingKey: hexStringSchema,
|
|
25
|
+
curve: z.enum(SUPPORTED_ECDSA_CURVES),
|
|
26
|
+
})
|
|
27
|
+
.refine((data) => {
|
|
28
|
+
// ensure that if message starts with 0x that it is valid hex
|
|
29
|
+
if (data.message.startsWith('0x'))
|
|
30
|
+
return hexStringSchema.safeParse(data.message.slice(2)).success;
|
|
31
|
+
return true;
|
|
32
|
+
}, {
|
|
33
|
+
message: 'Message must be a valid hex string if it starts with "0x"',
|
|
34
|
+
path: ['message'],
|
|
35
|
+
})
|
|
36
|
+
.describe('ECDSA Condition for verifying the authenticity of a message using ECDSA signatures.');
|
|
37
|
+
//# sourceMappingURL=ecdsa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecdsa.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/ecdsa.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,E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F;KACA,QAAQ,CACP,qFAAqF,CACtF,CAAC"}
|
|
@@ -8,6 +8,7 @@ export * from './common';
|
|
|
8
8
|
export * from './context';
|
|
9
9
|
export * from './compound';
|
|
10
10
|
export * from './contract';
|
|
11
|
+
export * from './ecdsa';
|
|
11
12
|
export * from './if-then-else';
|
|
12
13
|
export * from './json-api';
|
|
13
14
|
export * from './json-rpc';
|
|
@@ -15,4 +16,6 @@ export * from './jwt';
|
|
|
15
16
|
export * from './return-value-test';
|
|
16
17
|
export * from './rpc';
|
|
17
18
|
export * from './sequential';
|
|
19
|
+
export * from './signing';
|
|
18
20
|
export * from './time';
|
|
21
|
+
export * from './address-allowlist';
|
|
@@ -10,6 +10,7 @@ export * from './context';
|
|
|
10
10
|
// ts-unused-exports:disable-next-line - this comment line is added to prevent lint from changing or objecting the export order.
|
|
11
11
|
export * from './compound';
|
|
12
12
|
export * from './contract';
|
|
13
|
+
export * from './ecdsa';
|
|
13
14
|
export * from './if-then-else';
|
|
14
15
|
export * from './json-api';
|
|
15
16
|
export * from './json-rpc';
|
|
@@ -17,5 +18,8 @@ export * from './jwt';
|
|
|
17
18
|
export * from './return-value-test';
|
|
18
19
|
export * from './rpc';
|
|
19
20
|
export * from './sequential';
|
|
21
|
+
export * from './signing';
|
|
20
22
|
export * from './time';
|
|
23
|
+
// ts-unused-exports:disable-next-line - this comment line is added to prevent lint from changing or objecting the export order.
|
|
24
|
+
export * from './address-allowlist';
|
|
21
25
|
//# sourceMappingURL=export-for-zod-doc-gen.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"export-for-zod-doc-gen.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/export-for-zod-doc-gen.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,gIAAgI;AAChI,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,gIAAgI;AAChI,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,QAAQ,CAAC"}
|
|
1
|
+
{"version":3,"file":"export-for-zod-doc-gen.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/export-for-zod-doc-gen.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,cAAc,SAAS,CAAC;AACxB,gIAAgI;AAChI,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,gIAAgI;AAChI,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC;AACxB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,OAAO,CAAC;AACtB,cAAc,qBAAqB,CAAC;AACpC,cAAc,OAAO,CAAC;AACtB,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,gIAAgI;AAChI,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,48 +1,81 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const JsonApiConditionType = "json-api";
|
|
3
|
-
export declare const jsonApiConditionSchema: z.
|
|
4
|
-
conditionType: z.ZodString;
|
|
5
|
-
}, {
|
|
3
|
+
export declare const jsonApiConditionSchema: z.ZodEffects<z.ZodObject<{} & {
|
|
6
4
|
conditionType: z.ZodDefault<z.ZodLiteral<"json-api">>;
|
|
7
5
|
endpoint: z.ZodEffects<z.ZodString, string, string>;
|
|
8
6
|
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
9
7
|
query: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
10
8
|
authorizationToken: z.ZodOptional<z.ZodString>;
|
|
11
|
-
|
|
9
|
+
authorizationType: z.ZodOptional<z.ZodEnum<["Bearer", "Basic", "X-API-Key"]>>;
|
|
10
|
+
returnValueTest: z.ZodEffects<z.ZodObject<{
|
|
12
11
|
index: z.ZodOptional<z.ZodNumber>;
|
|
13
|
-
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
14
|
-
}
|
|
12
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!=", "in", "!in"]>;
|
|
13
|
+
} & {
|
|
15
14
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
16
|
-
}
|
|
17
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
15
|
+
}, "strip", z.ZodTypeAny, {
|
|
16
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
17
|
+
value?: any;
|
|
18
|
+
index?: number | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
21
|
+
value?: any;
|
|
22
|
+
index?: number | undefined;
|
|
23
|
+
}>, {
|
|
24
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
18
25
|
value?: any;
|
|
19
26
|
index?: number | undefined;
|
|
20
27
|
}, {
|
|
21
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
28
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
22
29
|
value?: any;
|
|
23
30
|
index?: number | undefined;
|
|
24
31
|
}>;
|
|
25
|
-
}
|
|
32
|
+
}, "strip", z.ZodTypeAny, {
|
|
26
33
|
conditionType: "json-api";
|
|
34
|
+
endpoint: string;
|
|
27
35
|
returnValueTest: {
|
|
28
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
36
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
29
37
|
value?: any;
|
|
30
38
|
index?: number | undefined;
|
|
31
39
|
};
|
|
40
|
+
query?: string | undefined;
|
|
41
|
+
authorizationToken?: string | undefined;
|
|
42
|
+
authorizationType?: "Bearer" | "Basic" | "X-API-Key" | undefined;
|
|
43
|
+
parameters?: Record<string, unknown> | undefined;
|
|
44
|
+
}, {
|
|
32
45
|
endpoint: string;
|
|
46
|
+
returnValueTest: {
|
|
47
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
48
|
+
value?: any;
|
|
49
|
+
index?: number | undefined;
|
|
50
|
+
};
|
|
51
|
+
conditionType?: "json-api" | undefined;
|
|
52
|
+
query?: string | undefined;
|
|
53
|
+
authorizationToken?: string | undefined;
|
|
54
|
+
authorizationType?: "Bearer" | "Basic" | "X-API-Key" | undefined;
|
|
33
55
|
parameters?: Record<string, unknown> | undefined;
|
|
56
|
+
}>, {
|
|
57
|
+
conditionType: "json-api";
|
|
58
|
+
endpoint: string;
|
|
59
|
+
returnValueTest: {
|
|
60
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
61
|
+
value?: any;
|
|
62
|
+
index?: number | undefined;
|
|
63
|
+
};
|
|
34
64
|
query?: string | undefined;
|
|
35
65
|
authorizationToken?: string | undefined;
|
|
66
|
+
authorizationType?: "Bearer" | "Basic" | "X-API-Key" | undefined;
|
|
67
|
+
parameters?: Record<string, unknown> | undefined;
|
|
36
68
|
}, {
|
|
69
|
+
endpoint: string;
|
|
37
70
|
returnValueTest: {
|
|
38
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
71
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
39
72
|
value?: any;
|
|
40
73
|
index?: number | undefined;
|
|
41
74
|
};
|
|
42
|
-
endpoint: string;
|
|
43
75
|
conditionType?: "json-api" | undefined;
|
|
44
|
-
parameters?: Record<string, unknown> | undefined;
|
|
45
76
|
query?: string | undefined;
|
|
46
77
|
authorizationToken?: string | undefined;
|
|
78
|
+
authorizationType?: "Bearer" | "Basic" | "X-API-Key" | undefined;
|
|
79
|
+
parameters?: Record<string, unknown> | undefined;
|
|
47
80
|
}>;
|
|
48
81
|
export type JsonApiConditionProps = z.infer<typeof jsonApiConditionSchema>;
|