@nucypher/taco 0.4.0 → 0.6.0-alpha.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/README.md +0 -1
- package/dist/cjs/conditions/base/contract.d.ts +2 -432
- package/dist/cjs/conditions/base/contract.js +7 -80
- package/dist/cjs/conditions/base/contract.js.map +1 -1
- package/dist/cjs/conditions/base/index.d.ts +1 -0
- package/dist/cjs/conditions/base/index.js +2 -1
- package/dist/cjs/conditions/base/index.js.map +1 -1
- package/dist/cjs/conditions/base/json-api.d.ts +7 -0
- package/dist/cjs/conditions/base/json-api.js +19 -0
- package/dist/cjs/conditions/base/json-api.js.map +1 -0
- package/dist/cjs/conditions/base/rpc.d.ts +2 -42
- package/dist/cjs/conditions/base/rpc.js +7 -22
- package/dist/cjs/conditions/base/rpc.js.map +1 -1
- package/dist/cjs/conditions/base/time.d.ts +2 -40
- package/dist/cjs/conditions/base/time.js +8 -15
- package/dist/cjs/conditions/base/time.js.map +1 -1
- package/dist/cjs/conditions/compound-condition.d.ts +2 -4
- package/dist/cjs/conditions/compound-condition.js +7 -38
- package/dist/cjs/conditions/compound-condition.js.map +1 -1
- package/dist/cjs/conditions/condition-expr.d.ts +0 -3
- package/dist/cjs/conditions/condition-expr.js +0 -4
- package/dist/cjs/conditions/condition-expr.js.map +1 -1
- package/dist/cjs/conditions/condition-factory.js +11 -0
- package/dist/cjs/conditions/condition-factory.js.map +1 -1
- package/dist/cjs/conditions/condition.d.ts +1 -1
- package/dist/cjs/conditions/condition.js +3 -1
- package/dist/cjs/conditions/condition.js.map +1 -1
- package/dist/cjs/conditions/const.d.ts +1 -2
- package/dist/cjs/conditions/const.js +6 -8
- package/dist/cjs/conditions/const.js.map +1 -1
- package/dist/cjs/conditions/context/context.d.ts +15 -13
- package/dist/cjs/conditions/context/context.js +62 -56
- package/dist/cjs/conditions/context/context.js.map +1 -1
- package/dist/cjs/conditions/if-then-else-condition.d.ts +7 -0
- package/dist/cjs/conditions/if-then-else-condition.js +18 -0
- package/dist/cjs/conditions/if-then-else-condition.js.map +1 -0
- package/dist/cjs/conditions/index.d.ts +2 -0
- package/dist/cjs/conditions/index.js +3 -1
- package/dist/cjs/conditions/index.js.map +1 -1
- package/dist/cjs/conditions/multi-condition.d.ts +2 -0
- package/dist/cjs/conditions/multi-condition.js +35 -0
- package/dist/cjs/conditions/multi-condition.js.map +1 -0
- package/dist/cjs/conditions/schemas/common.d.ts +12 -0
- package/dist/cjs/conditions/schemas/common.js +36 -0
- package/dist/cjs/conditions/schemas/common.js.map +1 -0
- package/dist/cjs/conditions/schemas/compound.d.ts +4 -0
- package/dist/cjs/conditions/schemas/compound.js +36 -0
- package/dist/cjs/conditions/schemas/compound.js.map +1 -0
- package/dist/cjs/conditions/schemas/context.d.ts +3 -0
- package/dist/cjs/conditions/schemas/context.js +16 -0
- package/dist/cjs/conditions/schemas/context.js.map +1 -0
- package/dist/cjs/conditions/schemas/contract.d.ts +428 -0
- package/dist/cjs/conditions/schemas/contract.js +81 -0
- package/dist/cjs/conditions/schemas/contract.js.map +1 -0
- package/dist/cjs/conditions/schemas/if-then-else.d.ts +4 -0
- package/dist/cjs/conditions/schemas/if-then-else.js +40 -0
- package/dist/cjs/conditions/schemas/if-then-else.js.map +1 -0
- package/dist/cjs/conditions/schemas/json-api.d.ts +46 -0
- package/dist/cjs/conditions/schemas/json-api.js +37 -0
- package/dist/cjs/conditions/schemas/json-api.js.map +1 -0
- package/dist/cjs/conditions/schemas/return-value-test.d.ts +15 -0
- package/dist/cjs/conditions/schemas/return-value-test.js +11 -0
- package/dist/cjs/conditions/schemas/return-value-test.js.map +1 -0
- package/dist/cjs/conditions/schemas/rpc.d.ts +42 -0
- package/dist/cjs/conditions/schemas/rpc.js +58 -0
- package/dist/cjs/conditions/schemas/rpc.js.map +1 -0
- package/dist/cjs/conditions/schemas/sequential.d.ts +6 -0
- package/dist/cjs/conditions/schemas/sequential.js +39 -0
- package/dist/cjs/conditions/schemas/sequential.js.map +1 -0
- package/dist/cjs/conditions/schemas/time.d.ts +40 -0
- package/dist/cjs/conditions/schemas/time.js +16 -0
- package/dist/cjs/conditions/schemas/time.js.map +1 -0
- package/dist/cjs/conditions/schemas/utils.d.ts +2 -0
- package/dist/cjs/conditions/schemas/utils.js +21 -0
- package/dist/cjs/conditions/schemas/utils.js.map +1 -0
- package/dist/cjs/conditions/sequential.d.ts +7 -0
- package/dist/cjs/conditions/sequential.js +18 -0
- package/dist/cjs/conditions/sequential.js.map +1 -0
- package/dist/cjs/conditions/shared.d.ts +2 -19
- package/dist/cjs/conditions/shared.js +6 -32
- package/dist/cjs/conditions/shared.js.map +1 -1
- package/dist/cjs/dkg.d.ts +1 -1
- package/dist/cjs/dkg.js +2 -2
- package/dist/cjs/dkg.js.map +1 -1
- package/dist/cjs/index.d.ts +2 -3
- package/dist/cjs/index.js +2 -8
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/taco.d.ts +5 -23
- package/dist/cjs/taco.js +9 -36
- package/dist/cjs/taco.js.map +1 -1
- package/dist/cjs/tdec.d.ts +3 -4
- package/dist/cjs/tdec.js +11 -8
- package/dist/cjs/tdec.js.map +1 -1
- package/dist/es/conditions/base/contract.d.ts +2 -432
- package/dist/es/conditions/base/contract.js +2 -77
- package/dist/es/conditions/base/contract.js.map +1 -1
- package/dist/es/conditions/base/index.d.ts +1 -0
- package/dist/es/conditions/base/index.js +1 -0
- package/dist/es/conditions/base/index.js.map +1 -1
- package/dist/es/conditions/base/json-api.d.ts +7 -0
- package/dist/es/conditions/base/json-api.js +12 -0
- package/dist/es/conditions/base/json-api.js.map +1 -0
- package/dist/es/conditions/base/rpc.d.ts +2 -42
- package/dist/es/conditions/base/rpc.js +2 -16
- package/dist/es/conditions/base/rpc.js.map +1 -1
- package/dist/es/conditions/base/time.d.ts +2 -40
- package/dist/es/conditions/base/time.js +2 -12
- package/dist/es/conditions/base/time.js.map +1 -1
- package/dist/es/conditions/compound-condition.d.ts +2 -4
- package/dist/es/conditions/compound-condition.js +2 -35
- package/dist/es/conditions/compound-condition.js.map +1 -1
- package/dist/es/conditions/condition-expr.d.ts +0 -3
- package/dist/es/conditions/condition-expr.js +0 -4
- package/dist/es/conditions/condition-expr.js.map +1 -1
- package/dist/es/conditions/condition-factory.js +11 -0
- package/dist/es/conditions/condition-factory.js.map +1 -1
- package/dist/es/conditions/condition.d.ts +1 -1
- package/dist/es/conditions/condition.js +1 -0
- package/dist/es/conditions/condition.js.map +1 -1
- package/dist/es/conditions/const.d.ts +1 -2
- package/dist/es/conditions/const.js +5 -7
- package/dist/es/conditions/const.js.map +1 -1
- package/dist/es/conditions/context/context.d.ts +15 -13
- package/dist/es/conditions/context/context.js +63 -57
- package/dist/es/conditions/context/context.js.map +1 -1
- package/dist/es/conditions/if-then-else-condition.d.ts +7 -0
- package/dist/es/conditions/if-then-else-condition.js +12 -0
- package/dist/es/conditions/if-then-else-condition.js.map +1 -0
- package/dist/es/conditions/index.d.ts +2 -0
- package/dist/es/conditions/index.js +2 -0
- package/dist/es/conditions/index.js.map +1 -1
- package/dist/es/conditions/multi-condition.d.ts +2 -0
- package/dist/es/conditions/multi-condition.js +31 -0
- package/dist/es/conditions/multi-condition.js.map +1 -0
- package/dist/es/conditions/schemas/common.d.ts +12 -0
- package/dist/es/conditions/schemas/common.js +33 -0
- package/dist/es/conditions/schemas/common.js.map +1 -0
- package/dist/es/conditions/schemas/compound.d.ts +4 -0
- package/dist/es/conditions/schemas/compound.js +33 -0
- package/dist/es/conditions/schemas/compound.js.map +1 -0
- package/dist/es/conditions/schemas/context.d.ts +3 -0
- package/dist/es/conditions/schemas/context.js +13 -0
- package/dist/es/conditions/schemas/context.js.map +1 -0
- package/dist/es/conditions/schemas/contract.d.ts +428 -0
- package/dist/es/conditions/schemas/contract.js +78 -0
- package/dist/es/conditions/schemas/contract.js.map +1 -0
- package/dist/es/conditions/schemas/if-then-else.d.ts +4 -0
- package/dist/es/conditions/schemas/if-then-else.js +37 -0
- package/dist/es/conditions/schemas/if-then-else.js.map +1 -0
- package/dist/es/conditions/schemas/json-api.d.ts +46 -0
- package/dist/es/conditions/schemas/json-api.js +34 -0
- package/dist/es/conditions/schemas/json-api.js.map +1 -0
- package/dist/es/conditions/schemas/return-value-test.d.ts +15 -0
- package/dist/es/conditions/schemas/return-value-test.js +8 -0
- package/dist/es/conditions/schemas/return-value-test.js.map +1 -0
- package/dist/es/conditions/schemas/rpc.d.ts +42 -0
- package/dist/es/conditions/schemas/rpc.js +32 -0
- package/dist/es/conditions/schemas/rpc.js.map +1 -0
- package/dist/es/conditions/schemas/sequential.d.ts +6 -0
- package/dist/es/conditions/schemas/sequential.js +36 -0
- package/dist/es/conditions/schemas/sequential.js.map +1 -0
- package/dist/es/conditions/schemas/time.d.ts +40 -0
- package/dist/es/conditions/schemas/time.js +13 -0
- package/dist/es/conditions/schemas/time.js.map +1 -0
- package/dist/es/conditions/schemas/utils.d.ts +2 -0
- package/dist/es/conditions/schemas/utils.js +18 -0
- package/dist/es/conditions/schemas/utils.js.map +1 -0
- package/dist/es/conditions/sequential.d.ts +7 -0
- package/dist/es/conditions/sequential.js +12 -0
- package/dist/es/conditions/sequential.js.map +1 -0
- package/dist/es/conditions/shared.d.ts +2 -19
- package/dist/es/conditions/shared.js +2 -33
- package/dist/es/conditions/shared.js.map +1 -1
- package/dist/es/dkg.d.ts +1 -1
- package/dist/es/dkg.js +2 -2
- package/dist/es/dkg.js.map +1 -1
- package/dist/es/index.d.ts +2 -3
- package/dist/es/index.js +2 -5
- package/dist/es/index.js.map +1 -1
- package/dist/es/taco.d.ts +5 -23
- package/dist/es/taco.js +9 -34
- package/dist/es/taco.js.map +1 -1
- package/dist/es/tdec.d.ts +3 -4
- package/dist/es/tdec.js +12 -9
- package/dist/es/tdec.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.es.tsbuildinfo +1 -1
- package/package.json +7 -6
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const RpcConditionType = "rpc";
|
|
3
|
+
export declare const rpcConditionSchema: z.ZodObject<{
|
|
4
|
+
conditionType: z.ZodDefault<z.ZodLiteral<"rpc">>;
|
|
5
|
+
chain: z.ZodNever | z.ZodLiteral<z.Primitive> | z.ZodUnion<[z.ZodLiteral<z.Primitive>, z.ZodLiteral<z.Primitive>, ...z.ZodLiteral<z.Primitive>[]]>;
|
|
6
|
+
method: z.ZodEnum<["eth_getBalance"]>;
|
|
7
|
+
parameters: z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<[":userAddress", ":userAddressExternalEIP4361"]>, 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.ZodEnum<[":userAddress", ":userAddressExternalEIP4361"]>, z.ZodString]>], null>]>;
|
|
8
|
+
returnValueTest: z.ZodObject<{
|
|
9
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
11
|
+
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
14
|
+
index?: number | undefined;
|
|
15
|
+
value?: any;
|
|
16
|
+
}, {
|
|
17
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
18
|
+
index?: number | undefined;
|
|
19
|
+
value?: any;
|
|
20
|
+
}>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
conditionType: "rpc";
|
|
23
|
+
parameters: [string] | [string, string | number];
|
|
24
|
+
returnValueTest: {
|
|
25
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
26
|
+
index?: number | undefined;
|
|
27
|
+
value?: any;
|
|
28
|
+
};
|
|
29
|
+
method: "eth_getBalance";
|
|
30
|
+
chain?: z.Primitive;
|
|
31
|
+
}, {
|
|
32
|
+
parameters: [string] | [string, string | number];
|
|
33
|
+
returnValueTest: {
|
|
34
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
35
|
+
index?: number | undefined;
|
|
36
|
+
value?: any;
|
|
37
|
+
};
|
|
38
|
+
method: "eth_getBalance";
|
|
39
|
+
conditionType?: "rpc" | undefined;
|
|
40
|
+
chain?: z.Primitive;
|
|
41
|
+
}>;
|
|
42
|
+
export type RpcConditionProps = z.infer<typeof rpcConditionSchema>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.rpcConditionSchema = exports.RpcConditionType = void 0;
|
|
27
|
+
const shared_1 = require("@nucypher/shared");
|
|
28
|
+
const zod_1 = require("zod");
|
|
29
|
+
const const_1 = require("../const");
|
|
30
|
+
const common_1 = __importStar(require("./common"));
|
|
31
|
+
const context_1 = require("./context");
|
|
32
|
+
const return_value_test_1 = require("./return-value-test");
|
|
33
|
+
exports.RpcConditionType = 'rpc';
|
|
34
|
+
const EthAddressOrContextVariableSchema = zod_1.z.union([
|
|
35
|
+
shared_1.EthAddressSchema,
|
|
36
|
+
common_1.UserAddressSchema,
|
|
37
|
+
context_1.contextParamSchema,
|
|
38
|
+
]);
|
|
39
|
+
const BlockOrContextParamSchema = zod_1.z.union([
|
|
40
|
+
shared_1.BlockIdentifierSchema,
|
|
41
|
+
context_1.contextParamSchema,
|
|
42
|
+
]);
|
|
43
|
+
// eth_getBalance schema specification
|
|
44
|
+
// - Ethereum spec: https://ethereum.github.io/execution-apis/api-documentation/
|
|
45
|
+
// - web3py: https://web3py.readthedocs.io/en/stable/web3.eth.html#web3.eth.Eth.get_balance
|
|
46
|
+
exports.rpcConditionSchema = common_1.baseConditionSchema.extend({
|
|
47
|
+
conditionType: zod_1.z.literal(exports.RpcConditionType).default(exports.RpcConditionType),
|
|
48
|
+
chain: (0, common_1.default)(const_1.SUPPORTED_CHAIN_IDS),
|
|
49
|
+
method: zod_1.z.enum(['eth_getBalance']),
|
|
50
|
+
parameters: zod_1.z.union([
|
|
51
|
+
// Spec requires 2 parameters: an address and a block identifier
|
|
52
|
+
zod_1.z.tuple([EthAddressOrContextVariableSchema, BlockOrContextParamSchema]),
|
|
53
|
+
// Block identifier can be omitted, since web3py (which runs on TACo exec layer) defaults to 'latest',
|
|
54
|
+
zod_1.z.tuple([EthAddressOrContextVariableSchema]),
|
|
55
|
+
]),
|
|
56
|
+
returnValueTest: return_value_test_1.returnValueTestSchema, // Update to allow multiple return values after expanding supported methods
|
|
57
|
+
});
|
|
58
|
+
//# sourceMappingURL=rpc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rpc.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/rpc.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAA2E;AAC3E,6BAAwB;AAExB,oCAA+C;AAE/C,mDAGkB;AAClB,uCAA+C;AAC/C,2DAA4D;AAE/C,QAAA,gBAAgB,GAAG,KAAK,CAAC;AAEtC,MAAM,iCAAiC,GAAG,OAAC,CAAC,KAAK,CAAC;IAChD,yBAAgB;IAChB,0BAAiB;IACjB,4BAAkB;CACnB,CAAC,CAAC;AACH,MAAM,yBAAyB,GAAG,OAAC,CAAC,KAAK,CAAC;IACxC,8BAAqB;IACrB,4BAAkB;CACnB,CAAC,CAAC;AAEH,sCAAsC;AACtC,gFAAgF;AAChF,2FAA2F;AAC9E,QAAA,kBAAkB,GAAG,4BAAmB,CAAC,MAAM,CAAC;IAC3D,aAAa,EAAE,OAAC,CAAC,OAAO,CAAC,wBAAgB,CAAC,CAAC,OAAO,CAAC,wBAAgB,CAAC;IACpE,KAAK,EAAE,IAAA,gBAAiB,EAAC,2BAAmB,CAAC;IAC7C,MAAM,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,gBAAgB,CAAC,CAAC;IAClC,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC;QAClB,gEAAgE;QAChE,OAAC,CAAC,KAAK,CAAC,CAAC,iCAAiC,EAAE,yBAAyB,CAAC,CAAC;QACvE,sGAAsG;QACtG,OAAC,CAAC,KAAK,CAAC,CAAC,iCAAiC,CAAC,CAAC;KAC7C,CAAC;IACF,eAAe,EAAE,yCAAqB,EAAE,2EAA2E;CACpH,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const SequentialConditionType = "sequential";
|
|
3
|
+
export declare const conditionVariableSchema: z.ZodSchema;
|
|
4
|
+
export type ConditionVariableProps = z.infer<typeof conditionVariableSchema>;
|
|
5
|
+
export declare const sequentialConditionSchema: z.ZodSchema;
|
|
6
|
+
export type SequentialConditionProps = z.infer<typeof sequentialConditionSchema>;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.sequentialConditionSchema = exports.conditionVariableSchema = exports.SequentialConditionType = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const multi_condition_1 = require("../multi-condition");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
8
|
+
exports.SequentialConditionType = 'sequential';
|
|
9
|
+
exports.conditionVariableSchema = zod_1.z.lazy(() => zod_1.z.object({
|
|
10
|
+
varName: common_1.plainStringSchema,
|
|
11
|
+
condition: utils_1.anyConditionSchema,
|
|
12
|
+
}));
|
|
13
|
+
exports.sequentialConditionSchema = common_1.baseConditionSchema
|
|
14
|
+
.extend({
|
|
15
|
+
conditionType: zod_1.z
|
|
16
|
+
.literal(exports.SequentialConditionType)
|
|
17
|
+
.default(exports.SequentialConditionType),
|
|
18
|
+
conditionVariables: zod_1.z.array(exports.conditionVariableSchema).min(2).max(5),
|
|
19
|
+
})
|
|
20
|
+
.refine((condition) => (0, multi_condition_1.maxNestedDepth)(2)(condition), {
|
|
21
|
+
message: 'Exceeded max nested depth of 2 for multi-condition type',
|
|
22
|
+
path: ['conditionVariables'],
|
|
23
|
+
})
|
|
24
|
+
.refine(
|
|
25
|
+
// check for duplicate var names
|
|
26
|
+
(condition) => {
|
|
27
|
+
const seen = new Set();
|
|
28
|
+
return condition.conditionVariables.every((child) => {
|
|
29
|
+
if (seen.has(child.varName)) {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
seen.add(child.varName);
|
|
33
|
+
return true;
|
|
34
|
+
});
|
|
35
|
+
}, {
|
|
36
|
+
message: 'Duplicate variable names are not allowed',
|
|
37
|
+
path: ['conditionVariables'],
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=sequential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequential.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/sequential.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,wDAAoD;AAEpD,qCAAkE;AAClE,mCAA6C;AAEhC,QAAA,uBAAuB,GAAG,YAAY,CAAC;AAEvC,QAAA,uBAAuB,GAAgB,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAC9D,OAAC,CAAC,MAAM,CAAC;IACP,OAAO,EAAE,0BAAiB;IAC1B,SAAS,EAAE,0BAAkB;CAC9B,CAAC,CACH,CAAC;AAGW,QAAA,yBAAyB,GAAgB,4BAAmB;KACtE,MAAM,CAAC;IACN,aAAa,EAAE,OAAC;SACb,OAAO,CAAC,+BAAuB,CAAC;SAChC,OAAO,CAAC,+BAAuB,CAAC;IACnC,kBAAkB,EAAE,OAAC,CAAC,KAAK,CAAC,+BAAuB,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;CACnE,CAAC;KACD,MAAM,CACL,CAAC,SAAS,EAAE,EAAE,CAAC,IAAA,gCAAc,EAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAC3C;IACE,OAAO,EAAE,yDAAyD;IAClE,IAAI,EAAE,CAAC,oBAAoB,CAAC;CAC7B,CACF;KACA,MAAM;AACL,gCAAgC;AAChC,CAAC,SAAS,EAAE,EAAE;IACZ,MAAM,IAAI,GAAG,IAAI,GAAG,EAAE,CAAC;IACvB,OAAO,SAAS,CAAC,kBAAkB,CAAC,KAAK,CACvC,CAAC,KAA6B,EAAE,EAAE;QAChC,IAAI,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC,CACF,CAAC;AACJ,CAAC,EACD;IACE,OAAO,EAAE,0CAA0C;IACnD,IAAI,EAAE,CAAC,oBAAoB,CAAC;CAC7B,CACF,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const TimeConditionType = "time";
|
|
3
|
+
export declare const TimeConditionMethod = "blocktime";
|
|
4
|
+
export declare const timeConditionSchema: z.ZodObject<{
|
|
5
|
+
conditionType: z.ZodDefault<z.ZodLiteral<"time">>;
|
|
6
|
+
method: z.ZodDefault<z.ZodLiteral<"blocktime">>;
|
|
7
|
+
chain: z.ZodNever | z.ZodLiteral<z.Primitive> | z.ZodUnion<[z.ZodLiteral<z.Primitive>, z.ZodLiteral<z.Primitive>, ...z.ZodLiteral<z.Primitive>[]]>;
|
|
8
|
+
returnValueTest: z.ZodObject<{
|
|
9
|
+
index: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
11
|
+
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
14
|
+
index?: number | undefined;
|
|
15
|
+
value?: any;
|
|
16
|
+
}, {
|
|
17
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
18
|
+
index?: number | undefined;
|
|
19
|
+
value?: any;
|
|
20
|
+
}>;
|
|
21
|
+
}, "strip", z.ZodTypeAny, {
|
|
22
|
+
conditionType: "time";
|
|
23
|
+
returnValueTest: {
|
|
24
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
25
|
+
index?: number | undefined;
|
|
26
|
+
value?: any;
|
|
27
|
+
};
|
|
28
|
+
method: "blocktime";
|
|
29
|
+
chain?: z.Primitive;
|
|
30
|
+
}, {
|
|
31
|
+
returnValueTest: {
|
|
32
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
33
|
+
index?: number | undefined;
|
|
34
|
+
value?: any;
|
|
35
|
+
};
|
|
36
|
+
conditionType?: "time" | undefined;
|
|
37
|
+
method?: "blocktime" | undefined;
|
|
38
|
+
chain?: z.Primitive;
|
|
39
|
+
}>;
|
|
40
|
+
export type TimeConditionProps = z.infer<typeof timeConditionSchema>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.timeConditionSchema = exports.TimeConditionMethod = exports.TimeConditionType = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const rpc_1 = require("./rpc");
|
|
6
|
+
// TimeCondition is an RpcCondition with the method set to 'blocktime' and no parameters
|
|
7
|
+
exports.TimeConditionType = 'time';
|
|
8
|
+
exports.TimeConditionMethod = 'blocktime';
|
|
9
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
10
|
+
const { parameters: _, ...restShape } = rpc_1.rpcConditionSchema.shape;
|
|
11
|
+
exports.timeConditionSchema = zod_1.z.object({
|
|
12
|
+
...restShape,
|
|
13
|
+
conditionType: zod_1.z.literal(exports.TimeConditionType).default(exports.TimeConditionType),
|
|
14
|
+
method: zod_1.z.literal(exports.TimeConditionMethod).default(exports.TimeConditionMethod),
|
|
15
|
+
});
|
|
16
|
+
//# sourceMappingURL=time.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"time.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/time.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,+BAA2C;AAE3C,wFAAwF;AAE3E,QAAA,iBAAiB,GAAG,MAAM,CAAC;AAC3B,QAAA,mBAAmB,GAAG,WAAW,CAAC;AAE/C,6DAA6D;AAC7D,MAAM,EAAE,UAAU,EAAE,CAAC,EAAE,GAAG,SAAS,EAAE,GAAG,wBAAkB,CAAC,KAAK,CAAC;AACpD,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,GAAG,SAAS;IACZ,aAAa,EAAE,OAAC,CAAC,OAAO,CAAC,yBAAiB,CAAC,CAAC,OAAO,CAAC,yBAAiB,CAAC;IACtE,MAAM,EAAE,OAAC,CAAC,OAAO,CAAC,2BAAmB,CAAC,CAAC,OAAO,CAAC,2BAAmB,CAAC;CACpE,CAAC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.anyConditionSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const compound_condition_1 = require("../compound-condition");
|
|
6
|
+
const contract_1 = require("./contract");
|
|
7
|
+
const if_then_else_1 = require("./if-then-else");
|
|
8
|
+
const json_api_1 = require("./json-api");
|
|
9
|
+
const rpc_1 = require("./rpc");
|
|
10
|
+
const sequential_1 = require("./sequential");
|
|
11
|
+
const time_1 = require("./time");
|
|
12
|
+
exports.anyConditionSchema = zod_1.z.lazy(() => zod_1.z.union([
|
|
13
|
+
rpc_1.rpcConditionSchema,
|
|
14
|
+
time_1.timeConditionSchema,
|
|
15
|
+
contract_1.contractConditionSchema,
|
|
16
|
+
compound_condition_1.compoundConditionSchema,
|
|
17
|
+
json_api_1.jsonApiConditionSchema,
|
|
18
|
+
sequential_1.sequentialConditionSchema,
|
|
19
|
+
if_then_else_1.ifThenElseConditionSchema,
|
|
20
|
+
]));
|
|
21
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +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,+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,4CAAuB;IACvB,iCAAsB;IACtB,sCAAyB;IACzB,wCAAyB;CAC1B,CAAC,CACH,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Condition } from './condition';
|
|
2
|
+
import { SequentialConditionProps } from './schemas/sequential';
|
|
3
|
+
import { OmitConditionType } from './shared';
|
|
4
|
+
export { ConditionVariableProps, SequentialConditionProps, sequentialConditionSchema, SequentialConditionType, } from './schemas/sequential';
|
|
5
|
+
export declare class SequentialCondition extends Condition {
|
|
6
|
+
constructor(value: OmitConditionType<SequentialConditionProps>);
|
|
7
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SequentialCondition = exports.SequentialConditionType = exports.sequentialConditionSchema = void 0;
|
|
4
|
+
const condition_1 = require("./condition");
|
|
5
|
+
const sequential_1 = require("./schemas/sequential");
|
|
6
|
+
var sequential_2 = require("./schemas/sequential");
|
|
7
|
+
Object.defineProperty(exports, "sequentialConditionSchema", { enumerable: true, get: function () { return sequential_2.sequentialConditionSchema; } });
|
|
8
|
+
Object.defineProperty(exports, "SequentialConditionType", { enumerable: true, get: function () { return sequential_2.SequentialConditionType; } });
|
|
9
|
+
class SequentialCondition extends condition_1.Condition {
|
|
10
|
+
constructor(value) {
|
|
11
|
+
super(sequential_1.sequentialConditionSchema, {
|
|
12
|
+
conditionType: sequential_1.SequentialConditionType,
|
|
13
|
+
...value,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.SequentialCondition = SequentialCondition;
|
|
18
|
+
//# sourceMappingURL=sequential.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sequential.js","sourceRoot":"","sources":["../../../src/conditions/sequential.ts"],"names":[],"mappings":";;;AAAA,2CAAwC;AACxC,qDAI8B;AAG9B,mDAK8B;AAF5B,uHAAA,yBAAyB,OAAA;AACzB,qHAAA,uBAAuB,OAAA;AAGzB,MAAa,mBAAoB,SAAQ,qBAAS;IAChD,YAAY,KAAkD;QAC5D,KAAK,CAAC,sCAAyB,EAAE;YAC/B,aAAa,EAAE,oCAAuB;YACtC,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF;AAPD,kDAOC"}
|
|
@@ -1,20 +1,3 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const contextParamSchema: z.ZodString;
|
|
3
|
-
export declare const plainStringSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
4
|
-
export declare const paramOrContextParamSchema: z.ZodSchema;
|
|
5
|
-
export declare const returnValueTestSchema: z.ZodObject<{
|
|
6
|
-
index: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
8
|
-
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
9
|
-
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
11
|
-
value?: any;
|
|
12
|
-
index?: number | undefined;
|
|
13
|
-
}, {
|
|
14
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
15
|
-
value?: any;
|
|
16
|
-
index?: number | undefined;
|
|
17
|
-
}>;
|
|
18
|
-
export type ReturnValueTestProps = z.infer<typeof returnValueTestSchema>;
|
|
19
|
-
export declare const EthAddressOrUserAddressSchema: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<[":userAddress", ":userAddressExternalEIP4361"]>]>;
|
|
20
1
|
export type OmitConditionType<T> = Omit<T, 'conditionType'>;
|
|
2
|
+
export { contextParamSchema, paramOrContextParamSchema, } from './schemas/context';
|
|
3
|
+
export { ReturnValueTestProps, returnValueTestSchema, } from './schemas/return-value-test';
|
|
@@ -1,35 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports
|
|
9
|
-
// We want to discriminate between ContextParams and plain strings
|
|
10
|
-
// If a string starts with `:`, it's a ContextParam
|
|
11
|
-
exports.plainStringSchema = zod_1.z.string().refine((str) => {
|
|
12
|
-
return !str.startsWith(const_1.CONTEXT_PARAM_PREFIX);
|
|
13
|
-
}, {
|
|
14
|
-
message: 'String must not be a context parameter i.e. not start with ":"',
|
|
15
|
-
});
|
|
16
|
-
const paramSchema = zod_1.z.union([exports.plainStringSchema, zod_1.z.boolean(), zod_1.z.number()]);
|
|
17
|
-
exports.paramOrContextParamSchema = zod_1.z.union([
|
|
18
|
-
paramSchema,
|
|
19
|
-
exports.contextParamSchema,
|
|
20
|
-
zod_1.z.lazy(() => zod_1.z.array(exports.paramOrContextParamSchema)),
|
|
21
|
-
]);
|
|
22
|
-
exports.returnValueTestSchema = zod_1.z.object({
|
|
23
|
-
index: zod_1.z.number().int().nonnegative().optional(),
|
|
24
|
-
comparator: zod_1.z.enum(['==', '>', '<', '>=', '<=', '!=']),
|
|
25
|
-
value: exports.paramOrContextParamSchema,
|
|
26
|
-
});
|
|
27
|
-
const UserAddressSchema = zod_1.z.enum([
|
|
28
|
-
taco_auth_1.USER_ADDRESS_PARAM_DEFAULT,
|
|
29
|
-
const_1.USER_ADDRESS_PARAM_EXTERNAL_EIP4361,
|
|
30
|
-
]);
|
|
31
|
-
exports.EthAddressOrUserAddressSchema = zod_1.z.union([
|
|
32
|
-
shared_1.EthAddressSchema,
|
|
33
|
-
UserAddressSchema,
|
|
34
|
-
]);
|
|
3
|
+
exports.returnValueTestSchema = exports.paramOrContextParamSchema = exports.contextParamSchema = void 0;
|
|
4
|
+
var context_1 = require("./schemas/context");
|
|
5
|
+
Object.defineProperty(exports, "contextParamSchema", { enumerable: true, get: function () { return context_1.contextParamSchema; } });
|
|
6
|
+
Object.defineProperty(exports, "paramOrContextParamSchema", { enumerable: true, get: function () { return context_1.paramOrContextParamSchema; } });
|
|
7
|
+
var return_value_test_1 = require("./schemas/return-value-test");
|
|
8
|
+
Object.defineProperty(exports, "returnValueTestSchema", { enumerable: true, get: function () { return return_value_test_1.returnValueTestSchema; } });
|
|
35
9
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/conditions/shared.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/conditions/shared.ts"],"names":[],"mappings":";;;AAEA,6CAG2B;AAFzB,6GAAA,kBAAkB,OAAA;AAClB,oHAAA,yBAAyB,OAAA;AAG3B,iEAGqC;AADnC,0HAAA,qBAAqB,OAAA"}
|
package/dist/cjs/dkg.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export declare class DkgRitual {
|
|
|
20
20
|
equals(other: DkgRitual): boolean;
|
|
21
21
|
}
|
|
22
22
|
export declare class DkgClient {
|
|
23
|
-
static initializeRitual(provider: ethers.providers.Provider, signer: ethers.Signer, domain: Domain, ursulas: ChecksumAddress[], authority: string, duration: BigNumberish, accessController: string, waitUntilEnd?: boolean): Promise<number | undefined>;
|
|
23
|
+
static initializeRitual(provider: ethers.providers.Provider, signer: ethers.Signer, domain: Domain, ursulas: ChecksumAddress[], authority: string, duration: BigNumberish, feeModel: string, accessController: string, waitUntilEnd?: boolean): Promise<number | undefined>;
|
|
24
24
|
private static waitUntilRitualEnd;
|
|
25
25
|
static getRitual(provider: ethers.providers.Provider, domain: Domain, ritualId: number): Promise<DkgRitual>;
|
|
26
26
|
static getActiveRitual(provider: ethers.providers.Provider, domain: Domain, ritualId: number): Promise<DkgRitual>;
|
package/dist/cjs/dkg.js
CHANGED
|
@@ -41,9 +41,9 @@ class DkgRitual {
|
|
|
41
41
|
exports.DkgRitual = DkgRitual;
|
|
42
42
|
const ERR_RITUAL_NOT_FINALIZED = (ritualId, ritual) => `Ritual ${ritualId} is not finalized. State: ${ritual.state}`;
|
|
43
43
|
class DkgClient {
|
|
44
|
-
static async initializeRitual(provider, signer, domain, ursulas, authority, duration, accessController, waitUntilEnd = false) {
|
|
44
|
+
static async initializeRitual(provider, signer, domain, ursulas, authority, duration, feeModel, accessController, waitUntilEnd = false) {
|
|
45
45
|
const ritualId = await shared_1.DkgCoordinatorAgent.initializeRitual(provider, signer, domain, ursulas.sort(), // Contract call requires sorted addresses
|
|
46
|
-
authority, duration, accessController);
|
|
46
|
+
authority, duration, feeModel, accessController);
|
|
47
47
|
if (waitUntilEnd) {
|
|
48
48
|
const isSuccessful = await DkgClient.waitUntilRitualEnd(provider, domain, ritualId);
|
|
49
49
|
if (!isSuccessful) {
|
package/dist/cjs/dkg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dkg.js","sourceRoot":"","sources":["../../src/dkg.ts"],"names":[],"mappings":";;;AAAA,2DAAuD;AACvD,6CAM0B;AAW1B,MAAa,SAAS;IAEF;IACA;IACA;IACA;IACA;IALlB,YACkB,EAAU,EACV,YAA0B,EAC1B,SAAiB,EACjB,SAAiB,EACjB,KAAqB;QAJrB,OAAE,GAAF,EAAE,CAAQ;QACV,iBAAY,GAAZ,YAAY,CAAc;QAC1B,cAAS,GAAT,SAAS,CAAQ;QACjB,cAAS,GAAT,SAAS,CAAQ;QACjB,UAAK,GAAL,KAAK,CAAgB;IACpC,CAAC;IAEG,KAAK;QACV,OAAO;YACL,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,YAAY,EAAE,IAAI,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C,KAAK,CAAC;SACzC,CAAC,CAAC;QACH,OAAO,IAAI,SAAS,CAClB,QAAQ,EACR,4BAAY,CAAC,SAAS,CAAC,UAAU,CAAC,EAClC,MAAM,CAAC,OAAO,EACd,MAAM,CAAC,SAAS,EAChB,WAAW,CACZ,CAAC;IACJ,CAAC;IAEM,MAAM,CAAC,KAAK,CAAC,eAAe,CACjC,QAAmC,EACnC,MAAc,EACd,QAAgB;QAEhB,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACrE,IAAI,MAAM,CAAC,KAAK,KAAK,uBAAc,CAAC,MAAM,EAAE,CAAC;YAC3C,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;;AAxGH,8BA8HC"}
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { DkgPublicKey, ThresholdMessageKit } from '@nucypher/nucypher-core';
|
|
2
|
-
export { Domain, domains, fromBytes,
|
|
2
|
+
export { Domain, domains, fromBytes, getPorterUris, initialize, toBytes, toHexString, } from '@nucypher/shared';
|
|
3
3
|
export * as conditions from './conditions';
|
|
4
|
-
export { decrypt, encrypt, encryptWithPublicKey
|
|
5
|
-
export { EIP4361AuthProvider, SingleSignOnEIP4361AuthProvider, } from '@nucypher/taco-auth';
|
|
4
|
+
export { decrypt, encrypt, encryptWithPublicKey } from './taco';
|
package/dist/cjs/index.js
CHANGED
|
@@ -23,26 +23,20 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
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;
|
|
27
27
|
var nucypher_core_1 = require("@nucypher/nucypher-core");
|
|
28
28
|
Object.defineProperty(exports, "DkgPublicKey", { enumerable: true, get: function () { return nucypher_core_1.DkgPublicKey; } });
|
|
29
29
|
Object.defineProperty(exports, "ThresholdMessageKit", { enumerable: true, get: function () { return nucypher_core_1.ThresholdMessageKit; } });
|
|
30
30
|
var shared_1 = require("@nucypher/shared");
|
|
31
31
|
Object.defineProperty(exports, "domains", { enumerable: true, get: function () { return shared_1.domains; } });
|
|
32
32
|
Object.defineProperty(exports, "fromBytes", { enumerable: true, get: function () { return shared_1.fromBytes; } });
|
|
33
|
-
Object.defineProperty(exports, "
|
|
33
|
+
Object.defineProperty(exports, "getPorterUris", { enumerable: true, get: function () { return shared_1.getPorterUris; } });
|
|
34
34
|
Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return shared_1.initialize; } });
|
|
35
35
|
Object.defineProperty(exports, "toBytes", { enumerable: true, get: function () { return shared_1.toBytes; } });
|
|
36
36
|
Object.defineProperty(exports, "toHexString", { enumerable: true, get: function () { return shared_1.toHexString; } });
|
|
37
37
|
exports.conditions = __importStar(require("./conditions"));
|
|
38
|
-
// TODO(#324): Expose registerEncrypters from taco API
|
|
39
38
|
var taco_1 = require("./taco");
|
|
40
39
|
Object.defineProperty(exports, "decrypt", { enumerable: true, get: function () { return taco_1.decrypt; } });
|
|
41
40
|
Object.defineProperty(exports, "encrypt", { enumerable: true, get: function () { return taco_1.encrypt; } });
|
|
42
41
|
Object.defineProperty(exports, "encryptWithPublicKey", { enumerable: true, get: function () { return taco_1.encryptWithPublicKey; } });
|
|
43
|
-
Object.defineProperty(exports, "isAuthorized", { enumerable: true, get: function () { return taco_1.isAuthorized; } });
|
|
44
|
-
// TODO: Remove this re-export once `@nucypher/taco-auth` is mature and published
|
|
45
|
-
var taco_auth_1 = require("@nucypher/taco-auth");
|
|
46
|
-
Object.defineProperty(exports, "EIP4361AuthProvider", { enumerable: true, get: function () { return taco_auth_1.EIP4361AuthProvider; } });
|
|
47
|
-
Object.defineProperty(exports, "SingleSignOnEIP4361AuthProvider", { enumerable: true, get: function () { return taco_auth_1.SingleSignOnEIP4361AuthProvider; } });
|
|
48
42
|
//# sourceMappingURL=index.js.map
|
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,
|
|
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"}
|
package/dist/cjs/taco.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { DkgPublicKey, ThresholdMessageKit } from '@nucypher/nucypher-core';
|
|
2
|
-
import {
|
|
3
|
-
import { EIP4361AuthProvider } from '@nucypher/taco-auth';
|
|
2
|
+
import { Domain } from '@nucypher/shared';
|
|
4
3
|
import { ethers } from 'ethers';
|
|
5
4
|
import { Condition } from './conditions/condition';
|
|
6
|
-
import {
|
|
5
|
+
import { ConditionContext } from './conditions/context';
|
|
7
6
|
/**
|
|
8
7
|
* Encrypts a message under given conditions using a public key from an active DKG ritual.
|
|
9
8
|
*
|
|
@@ -50,30 +49,13 @@ export declare const encryptWithPublicKey: (message: Uint8Array | string, condit
|
|
|
50
49
|
* @param {Domain} domain - Represents the logical network in which the decryption will be performed.
|
|
51
50
|
* Must match the `ritualId`.
|
|
52
51
|
* @param {ThresholdMessageKit} messageKit - The kit containing the message to be decrypted
|
|
53
|
-
* @param
|
|
54
|
-
* @param {string} [
|
|
52
|
+
* @param {ConditionContext} context - Optional context data used for decryption time values for the condition(s) within the `messageKit`.
|
|
53
|
+
* @param {string[]} [porterUris] - Optional URI(s) for the Porter service. If not provided, a value will be obtained
|
|
55
54
|
* from the Domain
|
|
56
|
-
* @param {Record<string, CustomContextParam>} [customParameters] - Optional custom parameters that may be required
|
|
57
|
-
* depending on the condition used
|
|
58
55
|
*
|
|
59
56
|
* @returns {Promise<Uint8Array>} Returns Promise that resolves with a decrypted message
|
|
60
57
|
*
|
|
61
58
|
* @throws {Error} If the active DKG Ritual cannot be retrieved or decryption process throws an error,
|
|
62
59
|
* an error is thrown.
|
|
63
60
|
*/
|
|
64
|
-
export declare const decrypt: (provider: ethers.providers.Provider, domain: Domain, messageKit: ThresholdMessageKit,
|
|
65
|
-
/**
|
|
66
|
-
* Checks if the encryption from the provided messageKit is authorized for the specified ritual.
|
|
67
|
-
*
|
|
68
|
-
* @export
|
|
69
|
-
* @param {ethers.providers.Provider} provider - Instance of ethers provider which is used to interact with
|
|
70
|
-
* your selected network.
|
|
71
|
-
* @param {Domain} domain - The domain which was used to encrypt the network. Must match the `ritualId`.
|
|
72
|
-
* @param {ThresholdMessageKit} messageKit - The encrypted message kit to be checked.
|
|
73
|
-
* @param {number} ritualId - The ID of the DKG Ritual under which the messageKit was supposedly encrypted.
|
|
74
|
-
*
|
|
75
|
-
* @returns {Promise<boolean>} Returns a Promise that resolves with the authorization status.
|
|
76
|
-
* True if authorized, false otherwise
|
|
77
|
-
*/
|
|
78
|
-
export declare const isAuthorized: (provider: ethers.providers.Provider, domain: Domain, messageKit: ThresholdMessageKit, ritualId: number) => Promise<boolean>;
|
|
79
|
-
export declare const registerEncrypters: (provider: ethers.providers.Provider, signer: ethers.Signer, domain: Domain, ritualId: number, encrypters: ChecksumAddress[]) => Promise<void>;
|
|
61
|
+
export declare const decrypt: (provider: ethers.providers.Provider, domain: Domain, messageKit: ThresholdMessageKit, context?: ConditionContext, porterUris?: string[]) => Promise<Uint8Array>;
|
package/dist/cjs/taco.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.decrypt = exports.encryptWithPublicKey = exports.encrypt = void 0;
|
|
4
4
|
const nucypher_core_1 = require("@nucypher/nucypher-core");
|
|
5
5
|
const shared_1 = require("@nucypher/shared");
|
|
6
|
-
const taco_auth_1 = require("@nucypher/taco-auth");
|
|
7
6
|
const utils_1 = require("ethers/lib/utils");
|
|
8
7
|
const condition_expr_1 = require("./conditions/condition-expr");
|
|
9
8
|
const dkg_1 = require("./dkg");
|
|
@@ -81,48 +80,22 @@ exports.encryptWithPublicKey = encryptWithPublicKey;
|
|
|
81
80
|
* @param {Domain} domain - Represents the logical network in which the decryption will be performed.
|
|
82
81
|
* Must match the `ritualId`.
|
|
83
82
|
* @param {ThresholdMessageKit} messageKit - The kit containing the message to be decrypted
|
|
84
|
-
* @param
|
|
85
|
-
* @param {string} [
|
|
83
|
+
* @param {ConditionContext} context - Optional context data used for decryption time values for the condition(s) within the `messageKit`.
|
|
84
|
+
* @param {string[]} [porterUris] - Optional URI(s) for the Porter service. If not provided, a value will be obtained
|
|
86
85
|
* from the Domain
|
|
87
|
-
* @param {Record<string, CustomContextParam>} [customParameters] - Optional custom parameters that may be required
|
|
88
|
-
* depending on the condition used
|
|
89
86
|
*
|
|
90
87
|
* @returns {Promise<Uint8Array>} Returns Promise that resolves with a decrypted message
|
|
91
88
|
*
|
|
92
89
|
* @throws {Error} If the active DKG Ritual cannot be retrieved or decryption process throws an error,
|
|
93
90
|
* an error is thrown.
|
|
94
91
|
*/
|
|
95
|
-
const decrypt = async (provider, domain, messageKit,
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
92
|
+
const decrypt = async (provider, domain, messageKit, context, porterUris) => {
|
|
93
|
+
const porterUrisFull = porterUris
|
|
94
|
+
? porterUris
|
|
95
|
+
: await (0, shared_1.getPorterUris)(domain);
|
|
96
|
+
const porter = new shared_1.PorterClient(porterUrisFull);
|
|
99
97
|
const ritualId = await shared_1.DkgCoordinatorAgent.getRitualIdFromPublicKey(provider, domain, messageKit.acp.publicKey);
|
|
100
|
-
|
|
101
|
-
const authProviders = authProvider
|
|
102
|
-
? {
|
|
103
|
-
[taco_auth_1.EIP4361_AUTH_METHOD]: authProvider,
|
|
104
|
-
}
|
|
105
|
-
: {};
|
|
106
|
-
return (0, tdec_1.retrieveAndDecrypt)(provider, domain, porterUri, messageKit, ritualId, ritual.sharesNum, ritual.threshold, authProviders, customParameters);
|
|
98
|
+
return (0, tdec_1.retrieveAndDecrypt)(provider, domain, porter, messageKit, ritualId, context);
|
|
107
99
|
};
|
|
108
100
|
exports.decrypt = decrypt;
|
|
109
|
-
/**
|
|
110
|
-
* Checks if the encryption from the provided messageKit is authorized for the specified ritual.
|
|
111
|
-
*
|
|
112
|
-
* @export
|
|
113
|
-
* @param {ethers.providers.Provider} provider - Instance of ethers provider which is used to interact with
|
|
114
|
-
* your selected network.
|
|
115
|
-
* @param {Domain} domain - The domain which was used to encrypt the network. Must match the `ritualId`.
|
|
116
|
-
* @param {ThresholdMessageKit} messageKit - The encrypted message kit to be checked.
|
|
117
|
-
* @param {number} ritualId - The ID of the DKG Ritual under which the messageKit was supposedly encrypted.
|
|
118
|
-
*
|
|
119
|
-
* @returns {Promise<boolean>} Returns a Promise that resolves with the authorization status.
|
|
120
|
-
* True if authorized, false otherwise
|
|
121
|
-
*/
|
|
122
|
-
const isAuthorized = async (provider, domain, messageKit, ritualId) => shared_1.DkgCoordinatorAgent.isEncryptionAuthorized(provider, domain, ritualId, messageKit);
|
|
123
|
-
exports.isAuthorized = isAuthorized;
|
|
124
|
-
const registerEncrypters = async (provider, signer, domain, ritualId, encrypters) => {
|
|
125
|
-
await shared_1.GlobalAllowListAgent.registerEncrypters(provider, signer, domain, ritualId, encrypters);
|
|
126
|
-
};
|
|
127
|
-
exports.registerEncrypters = registerEncrypters;
|
|
128
101
|
//# sourceMappingURL=taco.js.map
|
package/dist/cjs/taco.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taco.js","sourceRoot":"","sources":["../../src/taco.ts"],"names":[],"mappings":";;;AAAA,2DAKiC;AACjC,
|
|
1
|
+
{"version":3,"file":"taco.js","sourceRoot":"","sources":["../../src/taco.ts"],"names":[],"mappings":";;;AAAA,2DAKiC;AACjC,6CAO0B;AAE1B,4CAA6C;AAG7C,gEAAkE;AAElE,+BAAkC;AAClC,iCAA4C;AAE5C;;;;;;;;;;;;;;;;;;;GAmBG;AACI,MAAM,OAAO,GAAG,KAAK,EAC1B,QAAmC,EACnC,MAAc,EACd,OAA4B,EAC5B,SAAoB,EACpB,QAAgB,EAChB,UAAyB,EACK,EAAE;IAChC,2CAA2C;IAC3C,gCAAgC;IAChC,iDAAiD;IACjD,gBAAgB;IAChB,mCAAmC;IACnC,WAAW;IACX,OAAO;IACP,IAAI;IACJ,gCAAgC;IAChC,2EAA2E;IAC3E,+CAA+C;IAC/C,IAAI;IACJ,MAAM,SAAS,GAAG,MAAM,eAAS,CAAC,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IAE9E,OAAO,MAAM,IAAA,4BAAoB,EAC/B,OAAO,EACP,SAAS,EACT,SAAS,CAAC,YAAY,EACtB,UAAU,CACX,CAAC;AACJ,CAAC,CAAC;AA5BW,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,CACjE,QAAQ,EACR,MAAM,EACN,UAAU,CAAC,GAAG,CAAC,SAAS,CACzB,CAAC;IACF,OAAO,IAAA,yBAAkB,EACvB,QAAQ,EACR,MAAM,EACN,MAAM,EACN,UAAU,EACV,QAAQ,EACR,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AAzBW,QAAA,OAAO,WAyBlB"}
|
package/dist/cjs/tdec.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { DkgPublicKey, ThresholdMessageKit } from '@nucypher/nucypher-core';
|
|
2
|
-
import { Domain } from '@nucypher/shared';
|
|
3
|
-
import { AuthProviders } from '@nucypher/taco-auth';
|
|
2
|
+
import { Domain, PorterClient } from '@nucypher/shared';
|
|
4
3
|
import { ethers } from 'ethers';
|
|
5
4
|
import { ConditionExpression } from './conditions/condition-expr';
|
|
6
|
-
import {
|
|
5
|
+
import { ConditionContext } from './conditions/context';
|
|
7
6
|
export declare const encryptMessage: (plaintext: Uint8Array | string, encryptingKey: DkgPublicKey, conditions: ConditionExpression, authSigner: ethers.Signer) => Promise<ThresholdMessageKit>;
|
|
8
|
-
export declare const retrieveAndDecrypt: (provider: ethers.providers.Provider, domain: Domain,
|
|
7
|
+
export declare const retrieveAndDecrypt: (provider: ethers.providers.Provider, domain: Domain, porter: PorterClient, thresholdMessageKit: ThresholdMessageKit, ritualId: number, context?: ConditionContext) => Promise<Uint8Array>;
|