@nucypher/taco 0.3.0 → 0.5.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 +14 -18
- package/dist/cjs/conditions/base/contract.js +6 -6
- package/dist/cjs/conditions/base/contract.js.map +1 -1
- package/dist/cjs/conditions/base/rpc.d.ts +7 -7
- package/dist/cjs/conditions/base/time.d.ts +5 -5
- package/dist/cjs/conditions/compound-condition.js.map +1 -1
- package/dist/cjs/conditions/condition-expr.d.ts +3 -7
- package/dist/cjs/conditions/condition-expr.js +2 -9
- package/dist/cjs/conditions/condition-expr.js.map +1 -1
- package/dist/cjs/conditions/condition-factory.js.map +1 -1
- package/dist/cjs/conditions/condition.d.ts +3 -2
- package/dist/cjs/conditions/condition.js +12 -2
- package/dist/cjs/conditions/condition.js.map +1 -1
- package/dist/cjs/conditions/const.d.ts +1 -3
- package/dist/cjs/conditions/const.js +7 -4
- package/dist/cjs/conditions/const.js.map +1 -1
- package/dist/cjs/conditions/context/context.d.ts +21 -17
- package/dist/cjs/conditions/context/context.js +107 -70
- package/dist/cjs/conditions/context/context.js.map +1 -1
- package/dist/cjs/conditions/predefined/erc20.js +2 -2
- package/dist/cjs/conditions/predefined/erc20.js.map +1 -1
- package/dist/cjs/conditions/predefined/erc721.js +3 -3
- package/dist/cjs/conditions/predefined/erc721.js.map +1 -1
- package/dist/cjs/conditions/shared.d.ts +3 -3
- package/dist/cjs/conditions/shared.js +8 -4
- package/dist/cjs/conditions/shared.js.map +1 -1
- package/dist/cjs/conditions/zod.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 -2
- package/dist/cjs/index.js +2 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/taco.d.ts +5 -22
- package/dist/cjs/taco.js +10 -31
- package/dist/cjs/taco.js.map +1 -1
- package/dist/cjs/tdec.d.ts +3 -3
- package/dist/cjs/tdec.js +16 -12
- package/dist/cjs/tdec.js.map +1 -1
- package/dist/cjs/types.d.ts +1 -0
- package/dist/cjs/types.js +8 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/es/conditions/base/contract.d.ts +14 -18
- package/dist/es/conditions/base/contract.js +3 -3
- package/dist/es/conditions/base/contract.js.map +1 -1
- package/dist/es/conditions/base/rpc.d.ts +7 -7
- package/dist/es/conditions/base/time.d.ts +5 -5
- package/dist/es/conditions/compound-condition.js.map +1 -1
- package/dist/es/conditions/condition-expr.d.ts +3 -7
- package/dist/es/conditions/condition-expr.js +4 -11
- package/dist/es/conditions/condition-expr.js.map +1 -1
- package/dist/es/conditions/condition-factory.js.map +1 -1
- package/dist/es/conditions/condition.d.ts +3 -2
- package/dist/es/conditions/condition.js +13 -3
- package/dist/es/conditions/condition.js.map +1 -1
- package/dist/es/conditions/const.d.ts +1 -3
- package/dist/es/conditions/const.js +6 -3
- package/dist/es/conditions/const.js.map +1 -1
- package/dist/es/conditions/context/context.d.ts +21 -17
- package/dist/es/conditions/context/context.js +108 -71
- package/dist/es/conditions/context/context.js.map +1 -1
- package/dist/es/conditions/predefined/erc20.js +2 -2
- package/dist/es/conditions/predefined/erc20.js.map +1 -1
- package/dist/es/conditions/predefined/erc721.js +3 -3
- package/dist/es/conditions/predefined/erc721.js.map +1 -1
- package/dist/es/conditions/shared.d.ts +3 -3
- package/dist/es/conditions/shared.js +8 -4
- package/dist/es/conditions/shared.js.map +1 -1
- package/dist/es/conditions/zod.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 -2
- package/dist/es/index.js +2 -3
- package/dist/es/index.js.map +1 -1
- package/dist/es/taco.d.ts +5 -22
- package/dist/es/taco.js +10 -29
- package/dist/es/taco.js.map +1 -1
- package/dist/es/tdec.d.ts +3 -3
- package/dist/es/tdec.js +17 -13
- package/dist/es/tdec.js.map +1 -1
- package/dist/es/types.d.ts +1 -0
- package/dist/es/types.js +3 -0
- package/dist/es/types.js.map +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.es.tsbuildinfo +1 -1
- package/package.json +8 -8
- package/dist/cjs/conditions/context/providers.d.ts +0 -16
- package/dist/cjs/conditions/context/providers.js +0 -111
- package/dist/cjs/conditions/context/providers.js.map +0 -1
- package/dist/cjs/web3.d.ts +0 -33
- package/dist/cjs/web3.js +0 -3
- package/dist/cjs/web3.js.map +0 -1
- package/dist/es/conditions/context/providers.d.ts +0 -16
- package/dist/es/conditions/context/providers.js +0 -107
- package/dist/es/conditions/context/providers.js.map +0 -1
- package/dist/es/web3.d.ts +0 -33
- package/dist/es/web3.js +0 -2
- package/dist/es/web3.js.map +0 -1
|
@@ -1,96 +1,114 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConditionContext = void 0;
|
|
4
|
-
const nucypher_core_1 = require("@nucypher/nucypher-core");
|
|
3
|
+
exports.ConditionContext = exports.RESERVED_CONTEXT_PARAMS = void 0;
|
|
5
4
|
const shared_1 = require("@nucypher/shared");
|
|
5
|
+
const taco_auth_1 = require("@nucypher/taco-auth");
|
|
6
|
+
const types_1 = require("../../types");
|
|
6
7
|
const compound_condition_1 = require("../compound-condition");
|
|
7
8
|
const condition_expr_1 = require("../condition-expr");
|
|
8
9
|
const const_1 = require("../const");
|
|
9
|
-
const providers_1 = require("./providers");
|
|
10
10
|
const ERR_RESERVED_PARAM = (key) => `Cannot use reserved parameter name ${key} as custom parameter`;
|
|
11
11
|
const ERR_INVALID_CUSTOM_PARAM = (key) => `Custom parameter ${key} must start with ${const_1.CONTEXT_PARAM_PREFIX}`;
|
|
12
|
-
const
|
|
12
|
+
const ERR_AUTH_PROVIDER_REQUIRED = (key) => `No matching authentication provider to satisfy ${key} context variable in condition`;
|
|
13
13
|
const ERR_MISSING_CONTEXT_PARAMS = (params) => `Missing custom context parameter(s): ${params.join(', ')}`;
|
|
14
|
-
const
|
|
14
|
+
const ERR_UNKNOWN_CUSTOM_CONTEXT_PARAM = (param) => `Unknown custom context parameter: ${param}`;
|
|
15
|
+
const ERR_INVALID_AUTH_PROVIDER_TYPE = (param, expected) => `Invalid AuthProvider type for ${param}; expected ${expected}`;
|
|
16
|
+
const ERR_AUTH_PROVIDER_NOT_NEEDED_FOR_CONTEXT_PARAM = (param) => `AuthProvider not necessary for context parameter: ${param}`;
|
|
17
|
+
const EXPECTED_AUTH_PROVIDER_TYPES = {
|
|
18
|
+
[taco_auth_1.USER_ADDRESS_PARAM_DEFAULT]: taco_auth_1.EIP4361AuthProvider,
|
|
19
|
+
[taco_auth_1.USER_ADDRESS_PARAM_EXTERNAL_EIP4361]: taco_auth_1.SingleSignOnEIP4361AuthProvider,
|
|
20
|
+
};
|
|
21
|
+
exports.RESERVED_CONTEXT_PARAMS = [
|
|
22
|
+
taco_auth_1.USER_ADDRESS_PARAM_EXTERNAL_EIP4361,
|
|
23
|
+
taco_auth_1.USER_ADDRESS_PARAM_DEFAULT,
|
|
24
|
+
];
|
|
15
25
|
class ConditionContext {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
this.
|
|
23
|
-
|
|
24
|
-
this.customParameters = customParameters;
|
|
25
|
-
this.signer = signer;
|
|
26
|
-
if (this.signer) {
|
|
27
|
-
this.walletAuthProvider = new providers_1.WalletAuthenticationProvider(this.provider, this.signer);
|
|
28
|
-
}
|
|
29
|
-
this.validate();
|
|
26
|
+
requestedContextParameters;
|
|
27
|
+
customContextParameters = {};
|
|
28
|
+
authProviders = {};
|
|
29
|
+
constructor(condition) {
|
|
30
|
+
const condProps = condition.toObj();
|
|
31
|
+
ConditionContext.validateCoreConditions(condProps);
|
|
32
|
+
this.requestedContextParameters =
|
|
33
|
+
ConditionContext.findContextParameters(condProps);
|
|
30
34
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
if (!key.startsWith(const_1.CONTEXT_PARAM_PREFIX)) {
|
|
37
|
-
throw new Error(ERR_INVALID_CUSTOM_PARAM(key));
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
if (this.condition.requiresSigner() && !this.signer) {
|
|
41
|
-
throw new Error(ERR_SIGNER_REQUIRED);
|
|
42
|
-
}
|
|
35
|
+
static validateCoreConditions(condObject) {
|
|
36
|
+
// Checking whether the condition is compatible with the current version of the library
|
|
37
|
+
// Intentionally ignoring the return value of the function
|
|
38
|
+
new types_1.CoreConditions((0, shared_1.toJSON)(condObject));
|
|
43
39
|
}
|
|
44
|
-
|
|
45
|
-
const condObject = this.condition.toObj();
|
|
46
|
-
const parsedCondObject = (0, shared_1.fromJSON)(new nucypher_core_1.Conditions((0, shared_1.toJSON)(condObject)).toString());
|
|
47
|
-
const requestedParameters = this.findRequestedParameters(parsedCondObject);
|
|
48
|
-
const parameters = await this.fillContextParameters(requestedParameters);
|
|
40
|
+
validateNoMissingContextParameters(parameters) {
|
|
49
41
|
// Ok, so at this point we should have all the parameters we need
|
|
50
42
|
// If we don't, we have a problem and we should throw
|
|
51
|
-
const missingParameters = Array.from(
|
|
43
|
+
const missingParameters = Array.from(this.requestedContextParameters).filter((key) => parameters[key] === undefined);
|
|
52
44
|
if (missingParameters.length > 0) {
|
|
53
45
|
throw new Error(ERR_MISSING_CONTEXT_PARAMS(missingParameters));
|
|
54
46
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
47
|
+
}
|
|
48
|
+
async fillContextParameters(requestedContextParameters) {
|
|
49
|
+
const parameters = await this.fillAuthContextParameters(requestedContextParameters);
|
|
50
|
+
for (const key in this.customContextParameters) {
|
|
51
|
+
parameters[key] = this.customContextParameters[key];
|
|
59
52
|
}
|
|
60
53
|
return parameters;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
54
|
+
}
|
|
55
|
+
validateAuthProviders() {
|
|
56
|
+
for (const param of this.requestedContextParameters) {
|
|
57
|
+
// If it's not a user address parameter, we can skip
|
|
58
|
+
if (!const_1.USER_ADDRESS_PARAMS.includes(param)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
// we don't have a corresponding auth provider, we have a problem
|
|
62
|
+
if (!this.authProviders[param]) {
|
|
63
|
+
throw new Error(ERR_AUTH_PROVIDER_REQUIRED(param));
|
|
69
64
|
}
|
|
70
|
-
parameters[const_1.USER_ADDRESS_PARAM] =
|
|
71
|
-
await this.walletAuthProvider.getOrCreateWalletSignature();
|
|
72
|
-
// Remove from requested parameters
|
|
73
|
-
requestedParameters.delete(const_1.USER_ADDRESS_PARAM);
|
|
74
65
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
66
|
+
}
|
|
67
|
+
async fillAuthContextParameters(requestedParameters) {
|
|
68
|
+
const entries = await Promise.all([...requestedParameters]
|
|
69
|
+
.filter((param) => const_1.USER_ADDRESS_PARAMS.includes(param))
|
|
70
|
+
.map(async (param) => {
|
|
71
|
+
const maybeAuthProvider = this.authProviders[param];
|
|
72
|
+
// TODO: Throw here instead of validating in the constructor?
|
|
73
|
+
// TODO: Hide getOrCreateAuthSignature behind a more generic interface
|
|
74
|
+
return [param, await maybeAuthProvider.getOrCreateAuthSignature()];
|
|
75
|
+
}));
|
|
76
|
+
return Object.fromEntries(entries);
|
|
77
|
+
}
|
|
78
|
+
validateCustomContextParameter(customParam) {
|
|
79
|
+
if (!ConditionContext.isContextParameter(customParam)) {
|
|
80
|
+
throw new Error(ERR_INVALID_CUSTOM_PARAM(customParam));
|
|
81
|
+
}
|
|
82
|
+
if (exports.RESERVED_CONTEXT_PARAMS.includes(customParam)) {
|
|
83
|
+
throw new Error(ERR_RESERVED_PARAM(customParam));
|
|
84
|
+
}
|
|
85
|
+
if (!this.requestedContextParameters.has(customParam)) {
|
|
86
|
+
throw new Error(ERR_UNKNOWN_CUSTOM_CONTEXT_PARAM(customParam));
|
|
78
87
|
}
|
|
79
|
-
return parameters;
|
|
80
88
|
}
|
|
81
|
-
isContextParameter(param) {
|
|
89
|
+
static isContextParameter(param) {
|
|
82
90
|
return !!String(param).match(const_1.CONTEXT_PARAM_REGEXP);
|
|
83
91
|
}
|
|
84
|
-
|
|
92
|
+
static findContextParameters(condition) {
|
|
85
93
|
// First, we want to find all the parameters we need to add
|
|
86
94
|
const requestedParameters = new Set();
|
|
87
|
-
// Search conditions for parameters
|
|
88
95
|
// Check return value test
|
|
89
96
|
if (condition.returnValueTest) {
|
|
90
97
|
const rvt = condition.returnValueTest.value;
|
|
91
|
-
|
|
98
|
+
// Return value test can be a single parameter or an array of parameters
|
|
99
|
+
if (Array.isArray(rvt)) {
|
|
100
|
+
rvt.forEach((value) => {
|
|
101
|
+
if (ConditionContext.isContextParameter(value)) {
|
|
102
|
+
requestedParameters.add(value);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
else if (ConditionContext.isContextParameter(rvt)) {
|
|
92
107
|
requestedParameters.add(rvt);
|
|
93
108
|
}
|
|
109
|
+
else {
|
|
110
|
+
// Not a context parameter, we can skip
|
|
111
|
+
}
|
|
94
112
|
}
|
|
95
113
|
// Check condition parameters
|
|
96
114
|
for (const param of condition.parameters ?? []) {
|
|
@@ -101,7 +119,7 @@ class ConditionContext {
|
|
|
101
119
|
// If it's a compound condition, check operands
|
|
102
120
|
if (condition.conditionType === compound_condition_1.CompoundConditionType) {
|
|
103
121
|
for (const key in condition.operands) {
|
|
104
|
-
const innerParams = this.
|
|
122
|
+
const innerParams = this.findContextParameters(condition.operands[key]);
|
|
105
123
|
for (const param of innerParams) {
|
|
106
124
|
requestedParameters.add(param);
|
|
107
125
|
}
|
|
@@ -109,19 +127,38 @@ class ConditionContext {
|
|
|
109
127
|
}
|
|
110
128
|
return requestedParameters;
|
|
111
129
|
}
|
|
130
|
+
addCustomContextParameterValues(customContextParameters) {
|
|
131
|
+
Object.keys(customContextParameters).forEach((key) => {
|
|
132
|
+
this.validateCustomContextParameter(key);
|
|
133
|
+
this.customContextParameters[key] = customContextParameters[key];
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
addAuthProvider(contextParam, authProvider) {
|
|
137
|
+
if (!(contextParam in EXPECTED_AUTH_PROVIDER_TYPES)) {
|
|
138
|
+
throw new Error(ERR_AUTH_PROVIDER_NOT_NEEDED_FOR_CONTEXT_PARAM(contextParam));
|
|
139
|
+
}
|
|
140
|
+
if (!(authProvider instanceof EXPECTED_AUTH_PROVIDER_TYPES[contextParam])) {
|
|
141
|
+
throw new Error(ERR_INVALID_AUTH_PROVIDER_TYPE(contextParam, typeof authProvider));
|
|
142
|
+
}
|
|
143
|
+
this.authProviders[contextParam] = authProvider;
|
|
144
|
+
}
|
|
112
145
|
async toJson() {
|
|
113
|
-
const parameters = await this.
|
|
146
|
+
const parameters = await this.toContextParameters();
|
|
114
147
|
return (0, shared_1.toJSON)(parameters);
|
|
115
148
|
}
|
|
116
|
-
|
|
117
|
-
return new ConditionContext(this.provider, this.condition, params, this.signer);
|
|
118
|
-
}
|
|
119
|
-
async toWASMContext() {
|
|
149
|
+
async toCoreContext() {
|
|
120
150
|
const asJson = await this.toJson();
|
|
121
|
-
return new
|
|
151
|
+
return new types_1.CoreContext(asJson);
|
|
122
152
|
}
|
|
123
|
-
|
|
124
|
-
|
|
153
|
+
toContextParameters = async () => {
|
|
154
|
+
this.validateAuthProviders();
|
|
155
|
+
const parameters = await this.fillContextParameters(this.requestedContextParameters);
|
|
156
|
+
this.validateNoMissingContextParameters(parameters);
|
|
157
|
+
return parameters;
|
|
158
|
+
};
|
|
159
|
+
static fromMessageKit(messageKit) {
|
|
160
|
+
const conditionExpr = condition_expr_1.ConditionExpression.fromCoreConditions(messageKit.acp.conditions);
|
|
161
|
+
return new ConditionContext(conditionExpr.condition);
|
|
125
162
|
}
|
|
126
163
|
}
|
|
127
164
|
exports.ConditionContext = ConditionContext;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/conditions/context/context.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/conditions/context/context.ts"],"names":[],"mappings":";;;AACA,6CAA0C;AAC1C,mDAO6B;AAE7B,uCAA0D;AAC1D,8DAA8D;AAE9D,sDAAwD;AACxD,oCAIkB;AAKlB,MAAM,kBAAkB,GAAG,CAAC,GAAW,EAAE,EAAE,CACzC,sCAAsC,GAAG,sBAAsB,CAAC;AAClE,MAAM,wBAAwB,GAAG,CAAC,GAAW,EAAE,EAAE,CAC/C,oBAAoB,GAAG,oBAAoB,4BAAoB,EAAE,CAAC;AACpE,MAAM,0BAA0B,GAAG,CAAC,GAAW,EAAE,EAAE,CACjD,kDAAkD,GAAG,gCAAgC,CAAC;AACxF,MAAM,0BAA0B,GAAG,CAAC,MAAgB,EAAE,EAAE,CACtD,wCAAwC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AAC9D,MAAM,gCAAgC,GAAG,CAAC,KAAa,EAAE,EAAE,CACzD,qCAAqC,KAAK,EAAE,CAAC;AAC/C,MAAM,8BAA8B,GAAG,CAAC,KAAa,EAAE,QAAgB,EAAE,EAAE,CACzE,iCAAiC,KAAK,cAAc,QAAQ,EAAE,CAAC;AACjE,MAAM,8CAA8C,GAAG,CAAC,KAAa,EAAE,EAAE,CACvE,qDAAqD,KAAK,EAAE,CAAC;AAK/D,MAAM,4BAA4B,GAAqC;IACrE,CAAC,sCAA0B,CAAC,EAAE,+BAAmB;IACjD,CAAC,+CAAmC,CAAC,EAAE,2CAA+B;CACvE,CAAC;AAEW,QAAA,uBAAuB,GAAG;IACrC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CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,aAAa;QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QACnC,OAAO,IAAI,mBAAW,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAEM,mBAAmB,GAAG,KAAK,IAEhC,EAAE;QACF,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,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,oCAAmB,CAAC,kBAAkB,CAC1D,UAAU,CAAC,GAAG,CAAC,UAAU,CAC1B,CAAC;QACF,OAAO,IAAI,gBAAgB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AA1LD,4CA0LC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ERC20Balance = void 0;
|
|
4
|
+
const taco_auth_1 = require("@nucypher/taco-auth");
|
|
4
5
|
const contract_1 = require("../base/contract");
|
|
5
|
-
const const_1 = require("../const");
|
|
6
6
|
const ERC20BalanceDefaults = {
|
|
7
7
|
conditionType: contract_1.ContractConditionType,
|
|
8
8
|
method: 'balanceOf',
|
|
9
|
-
parameters: [
|
|
9
|
+
parameters: [taco_auth_1.USER_ADDRESS_PARAM_DEFAULT],
|
|
10
10
|
standardContractType: 'ERC20',
|
|
11
11
|
};
|
|
12
12
|
class ERC20Balance extends contract_1.ContractCondition {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/erc20.ts"],"names":[],"mappings":";;;AAAA,+CAI0B;
|
|
1
|
+
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/erc20.ts"],"names":[],"mappings":";;;AAAA,mDAAiE;AAEjE,+CAI0B;AAI1B,MAAM,oBAAoB,GAAqD;IAC7E,aAAa,EAAE,gCAAqB;IACpC,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,CAAC,sCAA0B,CAAC;IACxC,oBAAoB,EAAE,OAAO;CAC9B,CAAC;AAEF,MAAa,YAAa,SAAQ,4BAAiB;IACjD,YAAY,KAAuD;QACjE,KAAK,CAAC,EAAE,GAAG,oBAAoB,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF;AAJD,oCAIC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ERC721Balance = exports.ERC721Ownership = void 0;
|
|
4
|
+
const taco_auth_1 = require("@nucypher/taco-auth");
|
|
4
5
|
const contract_1 = require("../base/contract");
|
|
5
|
-
const const_1 = require("../const");
|
|
6
6
|
const ERC721OwnershipDefaults = {
|
|
7
7
|
conditionType: contract_1.ContractConditionType,
|
|
8
8
|
method: 'ownerOf',
|
|
9
9
|
standardContractType: 'ERC721',
|
|
10
10
|
returnValueTest: {
|
|
11
11
|
comparator: '==',
|
|
12
|
-
value:
|
|
12
|
+
value: taco_auth_1.USER_ADDRESS_PARAM_DEFAULT,
|
|
13
13
|
},
|
|
14
14
|
};
|
|
15
15
|
class ERC721Ownership extends contract_1.ContractCondition {
|
|
@@ -21,7 +21,7 @@ exports.ERC721Ownership = ERC721Ownership;
|
|
|
21
21
|
const ERC721BalanceDefaults = {
|
|
22
22
|
conditionType: contract_1.ContractConditionType,
|
|
23
23
|
method: 'balanceOf',
|
|
24
|
-
parameters: [
|
|
24
|
+
parameters: [taco_auth_1.USER_ADDRESS_PARAM_DEFAULT],
|
|
25
25
|
standardContractType: 'ERC721',
|
|
26
26
|
};
|
|
27
27
|
class ERC721Balance extends contract_1.ContractCondition {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/erc721.ts"],"names":[],"mappings":";;;AAAA,+CAI0B;
|
|
1
|
+
{"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/erc721.ts"],"names":[],"mappings":";;;AAAA,mDAAiE;AAEjE,+CAI0B;AAI1B,MAAM,uBAAuB,GAGzB;IACF,aAAa,EAAE,gCAAqB;IACpC,MAAM,EAAE,SAAS;IACjB,oBAAoB,EAAE,QAAQ;IAC9B,eAAe,EAAE;QACf,UAAU,EAAE,IAAI;QAChB,KAAK,EAAE,sCAA0B;KAClC;CACF,CAAC;AAEF,MAAa,eAAgB,SAAQ,4BAAiB;IACpD,YAAY,KAA0D;QACpE,KAAK,CAAC,EAAE,GAAG,uBAAuB,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAClD,CAAC;CACF;AAJD,0CAIC;AAID,MAAM,qBAAqB,GACzB;IACE,aAAa,EAAE,gCAAqB;IACpC,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,CAAC,sCAA0B,CAAC;IACxC,oBAAoB,EAAE,QAAQ;CAC/B,CAAC;AAEJ,MAAa,aAAc,SAAQ,4BAAiB;IAClD,YAAY,KAAwD;QAClE,KAAK,CAAC,EAAE,GAAG,qBAAqB,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;CACF;AAJD,sCAIC"}
|
|
@@ -8,13 +8,13 @@ export declare const returnValueTestSchema: z.ZodObject<{
|
|
|
8
8
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
10
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
11
|
-
value?: any;
|
|
12
11
|
index?: number | undefined;
|
|
12
|
+
value?: any;
|
|
13
13
|
}, {
|
|
14
14
|
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
15
|
-
value?: any;
|
|
16
15
|
index?: number | undefined;
|
|
16
|
+
value?: any;
|
|
17
17
|
}>;
|
|
18
18
|
export type ReturnValueTestProps = z.infer<typeof returnValueTestSchema>;
|
|
19
|
-
export declare const EthAddressOrUserAddressSchema: z.ZodUnion<[z.ZodString, z.
|
|
19
|
+
export declare const EthAddressOrUserAddressSchema: z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodEnum<[":userAddress", ":userAddressExternalEIP4361"]>]>;
|
|
20
20
|
export type OmitConditionType<T> = Omit<T, 'conditionType'>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.EthAddressOrUserAddressSchema = exports.returnValueTestSchema = exports.paramOrContextParamSchema = exports.plainStringSchema = exports.contextParamSchema = void 0;
|
|
4
|
+
const shared_1 = require("@nucypher/shared");
|
|
5
|
+
const taco_auth_1 = require("@nucypher/taco-auth");
|
|
4
6
|
const zod_1 = require("zod");
|
|
5
7
|
const const_1 = require("./const");
|
|
6
8
|
exports.contextParamSchema = zod_1.z.string().regex(const_1.CONTEXT_PARAM_REGEXP);
|
|
@@ -9,7 +11,7 @@ exports.contextParamSchema = zod_1.z.string().regex(const_1.CONTEXT_PARAM_REGEXP
|
|
|
9
11
|
exports.plainStringSchema = zod_1.z.string().refine((str) => {
|
|
10
12
|
return !str.startsWith(const_1.CONTEXT_PARAM_PREFIX);
|
|
11
13
|
}, {
|
|
12
|
-
message:
|
|
14
|
+
message: `String must not be a context parameter i.e. not start with "${const_1.CONTEXT_PARAM_PREFIX}"`,
|
|
13
15
|
});
|
|
14
16
|
const paramSchema = zod_1.z.union([exports.plainStringSchema, zod_1.z.boolean(), zod_1.z.number()]);
|
|
15
17
|
exports.paramOrContextParamSchema = zod_1.z.union([
|
|
@@ -22,10 +24,12 @@ exports.returnValueTestSchema = zod_1.z.object({
|
|
|
22
24
|
comparator: zod_1.z.enum(['==', '>', '<', '>=', '<=', '!=']),
|
|
23
25
|
value: exports.paramOrContextParamSchema,
|
|
24
26
|
});
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
+
const UserAddressSchema = zod_1.z.enum([
|
|
28
|
+
taco_auth_1.USER_ADDRESS_PARAM_DEFAULT,
|
|
29
|
+
taco_auth_1.USER_ADDRESS_PARAM_EXTERNAL_EIP4361,
|
|
30
|
+
]);
|
|
27
31
|
exports.EthAddressOrUserAddressSchema = zod_1.z.union([
|
|
28
|
-
EthAddressSchema,
|
|
32
|
+
shared_1.EthAddressSchema,
|
|
29
33
|
UserAddressSchema,
|
|
30
34
|
]);
|
|
31
35
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/conditions/shared.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/conditions/shared.ts"],"names":[],"mappings":";;;AAAA,6CAAoD;AACpD,mDAG6B;AAC7B,6BAAwB;AAExB,mCAAqE;AAExD,QAAA,kBAAkB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,4BAAoB,CAAC,CAAC;AACzE,kEAAkE;AAClE,mDAAmD;AACtC,QAAA,iBAAiB,GAAG,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAChD,CAAC,GAAG,EAAE,EAAE;IACN,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,4BAAoB,CAAC,CAAC;AAC/C,CAAC,EACD;IACE,OAAO,EAAE,+DAA+D,4BAAoB,GAAG;CAChG,CACF,CAAC;AAEF,MAAM,WAAW,GAAG,OAAC,CAAC,KAAK,CAAC,CAAC,yBAAiB,EAAE,OAAC,CAAC,OAAO,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAE7D,QAAA,yBAAyB,GAAgB,OAAC,CAAC,KAAK,CAAC;IAC5D,WAAW;IACX,0BAAkB;IAClB,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAC,CAAC,KAAK,CAAC,iCAAyB,CAAC,CAAC;CACjD,CAAC,CAAC;AAEU,QAAA,qBAAqB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC5C,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;IAChD,UAAU,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtD,KAAK,EAAE,iCAAyB;CACjC,CAAC,CAAC;AAIH,MAAM,iBAAiB,GAAG,OAAC,CAAC,IAAI,CAAC;IAC/B,sCAA0B;IAC1B,+CAAmC;CACpC,CAAC,CAAC;AACU,QAAA,6BAA6B,GAAG,OAAC,CAAC,KAAK,CAAC;IACnD,yBAAgB;IAChB,iBAAiB;CAClB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.js","sourceRoot":"","sources":["../../../src/conditions/zod.ts"],"names":[],"mappings":";;AAAA,6BAA+C;AAE/C,+EAA+E;AAC/E,MAAM,WAAW,GAAG,CAGlB,MAAS,EACT,EAAE;IACF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAIzD,CAAC;IACF,OAAO,OAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,SAAS,iBAAiB,CAAiC,MAAS;IAClE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"zod.js","sourceRoot":"","sources":["../../../src/conditions/zod.ts"],"names":[],"mappings":";;AAAA,6BAA+C;AAE/C,+EAA+E;AAC/E,MAAM,WAAW,GAAG,CAGlB,MAAS,EACT,EAAE;IACF,MAAM,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAIzD,CAAC;IACF,OAAO,OAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;AAC9B,CAAC,CAAC;AAEF,SAAS,iBAAiB,CAAiC,MAAS;IAClE,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,OAAC,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,OAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,WAAW,CAChB,MAAqE,CACtE,CAAC;AACJ,CAAC;AAED,kBAAe,iBAAiB,CAAC"}
|
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,CAAC,YAAY,CAAC,OAAO,EAAE;YACzC,SAAS,EAAE,IAAI,CAAC,SAAS;YACzB,SAA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
|
|
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
|
|
4
|
+
export { decrypt, encrypt, encryptWithPublicKey } from './taco';
|
package/dist/cjs/index.js
CHANGED
|
@@ -23,22 +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
|
-
// Expose registerEncrypters from taco API (#324)
|
|
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
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,8 +1,8 @@
|
|
|
1
1
|
import { DkgPublicKey, ThresholdMessageKit } from '@nucypher/nucypher-core';
|
|
2
|
-
import {
|
|
2
|
+
import { Domain } from '@nucypher/shared';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
import { Condition } from './conditions/condition';
|
|
5
|
-
import {
|
|
5
|
+
import { ConditionContext } from './conditions/context';
|
|
6
6
|
/**
|
|
7
7
|
* Encrypts a message under given conditions using a public key from an active DKG ritual.
|
|
8
8
|
*
|
|
@@ -49,30 +49,13 @@ export declare const encryptWithPublicKey: (message: Uint8Array | string, condit
|
|
|
49
49
|
* @param {Domain} domain - Represents the logical network in which the decryption will be performed.
|
|
50
50
|
* Must match the `ritualId`.
|
|
51
51
|
* @param {ThresholdMessageKit} messageKit - The kit containing the message to be decrypted
|
|
52
|
-
* @param {
|
|
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
|
|
53
54
|
* from the Domain
|
|
54
|
-
* @param {ethers.Signer} [signer] - An optional signer for the decryption
|
|
55
|
-
* @param {Record<string, CustomContextParam>} [customParameters] - Optional custom parameters that may be required
|
|
56
|
-
* depending on the condition used
|
|
57
55
|
*
|
|
58
56
|
* @returns {Promise<Uint8Array>} Returns Promise that resolves with a decrypted message
|
|
59
57
|
*
|
|
60
58
|
* @throws {Error} If the active DKG Ritual cannot be retrieved or decryption process throws an error,
|
|
61
59
|
* an error is thrown.
|
|
62
60
|
*/
|
|
63
|
-
export declare const decrypt: (provider: ethers.providers.Provider, domain: Domain, messageKit: ThresholdMessageKit,
|
|
64
|
-
/**
|
|
65
|
-
* Checks if the encryption from the provided messageKit is authorized for the specified ritual.
|
|
66
|
-
*
|
|
67
|
-
* @export
|
|
68
|
-
* @param {ethers.providers.Provider} provider - Instance of ethers provider which is used to interact with
|
|
69
|
-
* your selected network.
|
|
70
|
-
* @param {Domain} domain - The domain which was used to encrypt the network. Must match the `ritualId`.
|
|
71
|
-
* @param {ThresholdMessageKit} messageKit - The encrypted message kit to be checked.
|
|
72
|
-
* @param {number} ritualId - The ID of the DKG Ritual under which the messageKit was supposedly encrypted.
|
|
73
|
-
*
|
|
74
|
-
* @returns {Promise<boolean>} Returns a Promise that resolves with the authorization status.
|
|
75
|
-
* True if authorized, false otherwise
|
|
76
|
-
*/
|
|
77
|
-
export declare const isAuthorized: (provider: ethers.providers.Provider, domain: Domain, messageKit: ThresholdMessageKit, ritualId: number) => Promise<boolean>;
|
|
78
|
-
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,6 +1,6 @@
|
|
|
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
6
|
const utils_1 = require("ethers/lib/utils");
|
|
@@ -64,7 +64,7 @@ const encryptWithPublicKey = async (message, condition, dkgPublicKey, authSigner
|
|
|
64
64
|
message = (0, shared_1.toBytes)(message);
|
|
65
65
|
}
|
|
66
66
|
const conditionExpr = new condition_expr_1.ConditionExpression(condition);
|
|
67
|
-
const [ciphertext, authenticatedData] = (0, nucypher_core_1.encryptForDkg)(message, dkgPublicKey, conditionExpr.
|
|
67
|
+
const [ciphertext, authenticatedData] = (0, nucypher_core_1.encryptForDkg)(message, dkgPublicKey, conditionExpr.toCoreCondition());
|
|
68
68
|
const headerHash = (0, utils_1.keccak256)(ciphertext.header.toBytes());
|
|
69
69
|
const authorization = await authSigner.signMessage((0, shared_1.fromHexString)(headerHash));
|
|
70
70
|
const acp = new nucypher_core_1.AccessControlPolicy(authenticatedData, (0, shared_1.fromHexString)(authorization));
|
|
@@ -80,43 +80,22 @@ exports.encryptWithPublicKey = encryptWithPublicKey;
|
|
|
80
80
|
* @param {Domain} domain - Represents the logical network in which the decryption will be performed.
|
|
81
81
|
* Must match the `ritualId`.
|
|
82
82
|
* @param {ThresholdMessageKit} messageKit - The kit containing the message to be decrypted
|
|
83
|
-
* @param {
|
|
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
|
|
84
85
|
* from the Domain
|
|
85
|
-
* @param {ethers.Signer} [signer] - An optional signer for the decryption
|
|
86
|
-
* @param {Record<string, CustomContextParam>} [customParameters] - Optional custom parameters that may be required
|
|
87
|
-
* depending on the condition used
|
|
88
86
|
*
|
|
89
87
|
* @returns {Promise<Uint8Array>} Returns Promise that resolves with a decrypted message
|
|
90
88
|
*
|
|
91
89
|
* @throws {Error} If the active DKG Ritual cannot be retrieved or decryption process throws an error,
|
|
92
90
|
* an error is thrown.
|
|
93
91
|
*/
|
|
94
|
-
const decrypt = async (provider, domain, messageKit,
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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);
|
|
98
97
|
const ritualId = await shared_1.DkgCoordinatorAgent.getRitualIdFromPublicKey(provider, domain, messageKit.acp.publicKey);
|
|
99
|
-
|
|
100
|
-
return (0, tdec_1.retrieveAndDecrypt)(provider, domain, porterUri, messageKit, ritualId, ritual.sharesNum, ritual.threshold, signer, customParameters);
|
|
98
|
+
return (0, tdec_1.retrieveAndDecrypt)(provider, domain, porter, messageKit, ritualId, context);
|
|
101
99
|
};
|
|
102
100
|
exports.decrypt = decrypt;
|
|
103
|
-
/**
|
|
104
|
-
* Checks if the encryption from the provided messageKit is authorized for the specified ritual.
|
|
105
|
-
*
|
|
106
|
-
* @export
|
|
107
|
-
* @param {ethers.providers.Provider} provider - Instance of ethers provider which is used to interact with
|
|
108
|
-
* your selected network.
|
|
109
|
-
* @param {Domain} domain - The domain which was used to encrypt the network. Must match the `ritualId`.
|
|
110
|
-
* @param {ThresholdMessageKit} messageKit - The encrypted message kit to be checked.
|
|
111
|
-
* @param {number} ritualId - The ID of the DKG Ritual under which the messageKit was supposedly encrypted.
|
|
112
|
-
*
|
|
113
|
-
* @returns {Promise<boolean>} Returns a Promise that resolves with the authorization status.
|
|
114
|
-
* True if authorized, false otherwise
|
|
115
|
-
*/
|
|
116
|
-
const isAuthorized = async (provider, domain, messageKit, ritualId) => shared_1.DkgCoordinatorAgent.isEncryptionAuthorized(provider, domain, ritualId, messageKit);
|
|
117
|
-
exports.isAuthorized = isAuthorized;
|
|
118
|
-
const registerEncrypters = async (provider, signer, domain, ritualId, encrypters) => {
|
|
119
|
-
await shared_1.GlobalAllowListAgent.registerEncrypters(provider, signer, domain, ritualId, encrypters);
|
|
120
|
-
};
|
|
121
|
-
exports.registerEncrypters = registerEncrypters;
|
|
122
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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