@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,93 +1,111 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { toJSON } from '@nucypher/shared';
|
|
2
|
+
import { EIP4361AuthProvider, SingleSignOnEIP4361AuthProvider, USER_ADDRESS_PARAM_DEFAULT, USER_ADDRESS_PARAM_EXTERNAL_EIP4361, } from '@nucypher/taco-auth';
|
|
3
|
+
import { CoreConditions, CoreContext } from '../../types';
|
|
3
4
|
import { CompoundConditionType } from '../compound-condition';
|
|
4
5
|
import { ConditionExpression } from '../condition-expr';
|
|
5
|
-
import { CONTEXT_PARAM_PREFIX, CONTEXT_PARAM_REGEXP,
|
|
6
|
-
import { WalletAuthenticationProvider } from './providers';
|
|
6
|
+
import { CONTEXT_PARAM_PREFIX, CONTEXT_PARAM_REGEXP, USER_ADDRESS_PARAMS, } from '../const';
|
|
7
7
|
const ERR_RESERVED_PARAM = (key) => `Cannot use reserved parameter name ${key} as custom parameter`;
|
|
8
8
|
const ERR_INVALID_CUSTOM_PARAM = (key) => `Custom parameter ${key} must start with ${CONTEXT_PARAM_PREFIX}`;
|
|
9
|
-
const
|
|
9
|
+
const ERR_AUTH_PROVIDER_REQUIRED = (key) => `No matching authentication provider to satisfy ${key} context variable in condition`;
|
|
10
10
|
const ERR_MISSING_CONTEXT_PARAMS = (params) => `Missing custom context parameter(s): ${params.join(', ')}`;
|
|
11
|
-
const
|
|
11
|
+
const ERR_UNKNOWN_CUSTOM_CONTEXT_PARAM = (param) => `Unknown custom context parameter: ${param}`;
|
|
12
|
+
const ERR_INVALID_AUTH_PROVIDER_TYPE = (param, expected) => `Invalid AuthProvider type for ${param}; expected ${expected}`;
|
|
13
|
+
const ERR_AUTH_PROVIDER_NOT_NEEDED_FOR_CONTEXT_PARAM = (param) => `AuthProvider not necessary for context parameter: ${param}`;
|
|
14
|
+
const EXPECTED_AUTH_PROVIDER_TYPES = {
|
|
15
|
+
[USER_ADDRESS_PARAM_DEFAULT]: EIP4361AuthProvider,
|
|
16
|
+
[USER_ADDRESS_PARAM_EXTERNAL_EIP4361]: SingleSignOnEIP4361AuthProvider,
|
|
17
|
+
};
|
|
18
|
+
export const RESERVED_CONTEXT_PARAMS = [
|
|
19
|
+
USER_ADDRESS_PARAM_EXTERNAL_EIP4361,
|
|
20
|
+
USER_ADDRESS_PARAM_DEFAULT,
|
|
21
|
+
];
|
|
12
22
|
export class ConditionContext {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
this.
|
|
20
|
-
|
|
21
|
-
this.customParameters = customParameters;
|
|
22
|
-
this.signer = signer;
|
|
23
|
-
if (this.signer) {
|
|
24
|
-
this.walletAuthProvider = new WalletAuthenticationProvider(this.provider, this.signer);
|
|
25
|
-
}
|
|
26
|
-
this.validate();
|
|
23
|
+
requestedContextParameters;
|
|
24
|
+
customContextParameters = {};
|
|
25
|
+
authProviders = {};
|
|
26
|
+
constructor(condition) {
|
|
27
|
+
const condProps = condition.toObj();
|
|
28
|
+
ConditionContext.validateCoreConditions(condProps);
|
|
29
|
+
this.requestedContextParameters =
|
|
30
|
+
ConditionContext.findContextParameters(condProps);
|
|
27
31
|
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
}
|
|
33
|
-
if (!key.startsWith(CONTEXT_PARAM_PREFIX)) {
|
|
34
|
-
throw new Error(ERR_INVALID_CUSTOM_PARAM(key));
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
if (this.condition.requiresSigner() && !this.signer) {
|
|
38
|
-
throw new Error(ERR_SIGNER_REQUIRED);
|
|
39
|
-
}
|
|
32
|
+
static validateCoreConditions(condObject) {
|
|
33
|
+
// Checking whether the condition is compatible with the current version of the library
|
|
34
|
+
// Intentionally ignoring the return value of the function
|
|
35
|
+
new CoreConditions(toJSON(condObject));
|
|
40
36
|
}
|
|
41
|
-
|
|
42
|
-
const condObject = this.condition.toObj();
|
|
43
|
-
const parsedCondObject = fromJSON(new WASMConditions(toJSON(condObject)).toString());
|
|
44
|
-
const requestedParameters = this.findRequestedParameters(parsedCondObject);
|
|
45
|
-
const parameters = await this.fillContextParameters(requestedParameters);
|
|
37
|
+
validateNoMissingContextParameters(parameters) {
|
|
46
38
|
// Ok, so at this point we should have all the parameters we need
|
|
47
39
|
// If we don't, we have a problem and we should throw
|
|
48
|
-
const missingParameters = Array.from(
|
|
40
|
+
const missingParameters = Array.from(this.requestedContextParameters).filter((key) => parameters[key] === undefined);
|
|
49
41
|
if (missingParameters.length > 0) {
|
|
50
42
|
throw new Error(ERR_MISSING_CONTEXT_PARAMS(missingParameters));
|
|
51
43
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
}
|
|
45
|
+
async fillContextParameters(requestedContextParameters) {
|
|
46
|
+
const parameters = await this.fillAuthContextParameters(requestedContextParameters);
|
|
47
|
+
for (const key in this.customContextParameters) {
|
|
48
|
+
parameters[key] = this.customContextParameters[key];
|
|
56
49
|
}
|
|
57
50
|
return parameters;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
51
|
+
}
|
|
52
|
+
validateAuthProviders() {
|
|
53
|
+
for (const param of this.requestedContextParameters) {
|
|
54
|
+
// If it's not a user address parameter, we can skip
|
|
55
|
+
if (!USER_ADDRESS_PARAMS.includes(param)) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
// we don't have a corresponding auth provider, we have a problem
|
|
59
|
+
if (!this.authProviders[param]) {
|
|
60
|
+
throw new Error(ERR_AUTH_PROVIDER_REQUIRED(param));
|
|
66
61
|
}
|
|
67
|
-
parameters[USER_ADDRESS_PARAM] =
|
|
68
|
-
await this.walletAuthProvider.getOrCreateWalletSignature();
|
|
69
|
-
// Remove from requested parameters
|
|
70
|
-
requestedParameters.delete(USER_ADDRESS_PARAM);
|
|
71
62
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
63
|
+
}
|
|
64
|
+
async fillAuthContextParameters(requestedParameters) {
|
|
65
|
+
const entries = await Promise.all([...requestedParameters]
|
|
66
|
+
.filter((param) => USER_ADDRESS_PARAMS.includes(param))
|
|
67
|
+
.map(async (param) => {
|
|
68
|
+
const maybeAuthProvider = this.authProviders[param];
|
|
69
|
+
// TODO: Throw here instead of validating in the constructor?
|
|
70
|
+
// TODO: Hide getOrCreateAuthSignature behind a more generic interface
|
|
71
|
+
return [param, await maybeAuthProvider.getOrCreateAuthSignature()];
|
|
72
|
+
}));
|
|
73
|
+
return Object.fromEntries(entries);
|
|
74
|
+
}
|
|
75
|
+
validateCustomContextParameter(customParam) {
|
|
76
|
+
if (!ConditionContext.isContextParameter(customParam)) {
|
|
77
|
+
throw new Error(ERR_INVALID_CUSTOM_PARAM(customParam));
|
|
78
|
+
}
|
|
79
|
+
if (RESERVED_CONTEXT_PARAMS.includes(customParam)) {
|
|
80
|
+
throw new Error(ERR_RESERVED_PARAM(customParam));
|
|
81
|
+
}
|
|
82
|
+
if (!this.requestedContextParameters.has(customParam)) {
|
|
83
|
+
throw new Error(ERR_UNKNOWN_CUSTOM_CONTEXT_PARAM(customParam));
|
|
75
84
|
}
|
|
76
|
-
return parameters;
|
|
77
85
|
}
|
|
78
|
-
isContextParameter(param) {
|
|
86
|
+
static isContextParameter(param) {
|
|
79
87
|
return !!String(param).match(CONTEXT_PARAM_REGEXP);
|
|
80
88
|
}
|
|
81
|
-
|
|
89
|
+
static findContextParameters(condition) {
|
|
82
90
|
// First, we want to find all the parameters we need to add
|
|
83
91
|
const requestedParameters = new Set();
|
|
84
|
-
// Search conditions for parameters
|
|
85
92
|
// Check return value test
|
|
86
93
|
if (condition.returnValueTest) {
|
|
87
94
|
const rvt = condition.returnValueTest.value;
|
|
88
|
-
|
|
95
|
+
// Return value test can be a single parameter or an array of parameters
|
|
96
|
+
if (Array.isArray(rvt)) {
|
|
97
|
+
rvt.forEach((value) => {
|
|
98
|
+
if (ConditionContext.isContextParameter(value)) {
|
|
99
|
+
requestedParameters.add(value);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
else if (ConditionContext.isContextParameter(rvt)) {
|
|
89
104
|
requestedParameters.add(rvt);
|
|
90
105
|
}
|
|
106
|
+
else {
|
|
107
|
+
// Not a context parameter, we can skip
|
|
108
|
+
}
|
|
91
109
|
}
|
|
92
110
|
// Check condition parameters
|
|
93
111
|
for (const param of condition.parameters ?? []) {
|
|
@@ -98,7 +116,7 @@ export class ConditionContext {
|
|
|
98
116
|
// If it's a compound condition, check operands
|
|
99
117
|
if (condition.conditionType === CompoundConditionType) {
|
|
100
118
|
for (const key in condition.operands) {
|
|
101
|
-
const innerParams = this.
|
|
119
|
+
const innerParams = this.findContextParameters(condition.operands[key]);
|
|
102
120
|
for (const param of innerParams) {
|
|
103
121
|
requestedParameters.add(param);
|
|
104
122
|
}
|
|
@@ -106,19 +124,38 @@ export class ConditionContext {
|
|
|
106
124
|
}
|
|
107
125
|
return requestedParameters;
|
|
108
126
|
}
|
|
127
|
+
addCustomContextParameterValues(customContextParameters) {
|
|
128
|
+
Object.keys(customContextParameters).forEach((key) => {
|
|
129
|
+
this.validateCustomContextParameter(key);
|
|
130
|
+
this.customContextParameters[key] = customContextParameters[key];
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
addAuthProvider(contextParam, authProvider) {
|
|
134
|
+
if (!(contextParam in EXPECTED_AUTH_PROVIDER_TYPES)) {
|
|
135
|
+
throw new Error(ERR_AUTH_PROVIDER_NOT_NEEDED_FOR_CONTEXT_PARAM(contextParam));
|
|
136
|
+
}
|
|
137
|
+
if (!(authProvider instanceof EXPECTED_AUTH_PROVIDER_TYPES[contextParam])) {
|
|
138
|
+
throw new Error(ERR_INVALID_AUTH_PROVIDER_TYPE(contextParam, typeof authProvider));
|
|
139
|
+
}
|
|
140
|
+
this.authProviders[contextParam] = authProvider;
|
|
141
|
+
}
|
|
109
142
|
async toJson() {
|
|
110
|
-
const parameters = await this.
|
|
143
|
+
const parameters = await this.toContextParameters();
|
|
111
144
|
return toJSON(parameters);
|
|
112
145
|
}
|
|
113
|
-
|
|
114
|
-
return new ConditionContext(this.provider, this.condition, params, this.signer);
|
|
115
|
-
}
|
|
116
|
-
async toWASMContext() {
|
|
146
|
+
async toCoreContext() {
|
|
117
147
|
const asJson = await this.toJson();
|
|
118
|
-
return new
|
|
148
|
+
return new CoreContext(asJson);
|
|
119
149
|
}
|
|
120
|
-
|
|
121
|
-
|
|
150
|
+
toContextParameters = async () => {
|
|
151
|
+
this.validateAuthProviders();
|
|
152
|
+
const parameters = await this.fillContextParameters(this.requestedContextParameters);
|
|
153
|
+
this.validateNoMissingContextParameters(parameters);
|
|
154
|
+
return parameters;
|
|
155
|
+
};
|
|
156
|
+
static fromMessageKit(messageKit) {
|
|
157
|
+
const conditionExpr = ConditionExpression.fromCoreConditions(messageKit.acp.conditions);
|
|
158
|
+
return new ConditionContext(conditionExpr.condition);
|
|
122
159
|
}
|
|
123
160
|
}
|
|
124
161
|
//# sourceMappingURL=context.js.map
|
|
@@ -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,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAGL,mBAAmB,EACnB,+BAA+B,EAC/B,0BAA0B,EAC1B,mCAAmC,GACpC,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,UAAU,CAAC;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,oBAAoB,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,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AC;QAED,IAAI,CAAC,aAAa,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;IAClD,CAAC;IAEM,KAAK,CAAC,MAAM;QACjB,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACpD,OAAO,MAAM,CAAC,UAAU,CAAC,CAAC;IAC5B,CAAC;IAEM,KAAK,CAAC,aAAa;QACxB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC;QACnC,OAAO,IAAI,WAAW,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,mBAAmB,CAAC,kBAAkB,CAC1D,UAAU,CAAC,GAAG,CAAC,UAAU,CAC1B,CAAC;QACF,OAAO,IAAI,gBAAgB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { USER_ADDRESS_PARAM_DEFAULT } from '@nucypher/taco-auth';
|
|
1
2
|
import { ContractCondition, ContractConditionType, } from '../base/contract';
|
|
2
|
-
import { USER_ADDRESS_PARAM } from '../const';
|
|
3
3
|
const ERC20BalanceDefaults = {
|
|
4
4
|
conditionType: ContractConditionType,
|
|
5
5
|
method: 'balanceOf',
|
|
6
|
-
parameters: [
|
|
6
|
+
parameters: [USER_ADDRESS_PARAM_DEFAULT],
|
|
7
7
|
standardContractType: 'ERC20',
|
|
8
8
|
};
|
|
9
9
|
export class ERC20Balance extends ContractCondition {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/erc20.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/erc20.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EACL,iBAAiB,EAEjB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,oBAAoB,GAAqD;IAC7E,aAAa,EAAE,qBAAqB;IACpC,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,CAAC,0BAA0B,CAAC;IACxC,oBAAoB,EAAE,OAAO;CAC9B,CAAC;AAEF,MAAM,OAAO,YAAa,SAAQ,iBAAiB;IACjD,YAAY,KAAuD;QACjE,KAAK,CAAC,EAAE,GAAG,oBAAoB,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAC/C,CAAC;CACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
+
import { USER_ADDRESS_PARAM_DEFAULT } from '@nucypher/taco-auth';
|
|
1
2
|
import { ContractCondition, ContractConditionType, } from '../base/contract';
|
|
2
|
-
import { USER_ADDRESS_PARAM } from '../const';
|
|
3
3
|
const ERC721OwnershipDefaults = {
|
|
4
4
|
conditionType: ContractConditionType,
|
|
5
5
|
method: 'ownerOf',
|
|
6
6
|
standardContractType: 'ERC721',
|
|
7
7
|
returnValueTest: {
|
|
8
8
|
comparator: '==',
|
|
9
|
-
value:
|
|
9
|
+
value: USER_ADDRESS_PARAM_DEFAULT,
|
|
10
10
|
},
|
|
11
11
|
};
|
|
12
12
|
export class ERC721Ownership extends ContractCondition {
|
|
@@ -17,7 +17,7 @@ export class ERC721Ownership extends ContractCondition {
|
|
|
17
17
|
const ERC721BalanceDefaults = {
|
|
18
18
|
conditionType: ContractConditionType,
|
|
19
19
|
method: 'balanceOf',
|
|
20
|
-
parameters: [
|
|
20
|
+
parameters: [USER_ADDRESS_PARAM_DEFAULT],
|
|
21
21
|
standardContractType: 'ERC721',
|
|
22
22
|
};
|
|
23
23
|
export class ERC721Balance extends ContractCondition {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/erc721.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"erc721.js","sourceRoot":"","sources":["../../../../src/conditions/predefined/erc721.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAEjE,OAAO,EACL,iBAAiB,EAEjB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAI1B,MAAM,uBAAuB,GAGzB;IACF,aAAa,EAAE,qBAAqB;IACpC,MAAM,EAAE,SAAS;IACjB,oBAAoB,EAAE,QAAQ;IAC9B,eAAe,EAAE;QACf,UAAU,EAAE,IAAI;QAChB,KAAK,EAAE,0BAA0B;KAClC;CACF,CAAC;AAEF,MAAM,OAAO,eAAgB,SAAQ,iBAAiB;IACpD,YAAY,KAA0D;QACpE,KAAK,CAAC,EAAE,GAAG,uBAAuB,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAClD,CAAC;CACF;AAID,MAAM,qBAAqB,GACzB;IACE,aAAa,EAAE,qBAAqB;IACpC,MAAM,EAAE,WAAW;IACnB,UAAU,EAAE,CAAC,0BAA0B,CAAC;IACxC,oBAAoB,EAAE,QAAQ;CAC/B,CAAC;AAEJ,MAAM,OAAO,aAAc,SAAQ,iBAAiB;IAClD,YAAY,KAAwD;QAClE,KAAK,CAAC,EAAE,GAAG,qBAAqB,EAAE,GAAG,KAAK,EAAE,CAAC,CAAC;IAChD,CAAC;CACF"}
|
|
@@ -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,12 +1,14 @@
|
|
|
1
|
+
import { EthAddressSchema } from '@nucypher/shared';
|
|
2
|
+
import { USER_ADDRESS_PARAM_DEFAULT, USER_ADDRESS_PARAM_EXTERNAL_EIP4361, } from '@nucypher/taco-auth';
|
|
1
3
|
import { z } from 'zod';
|
|
2
|
-
import { CONTEXT_PARAM_PREFIX, CONTEXT_PARAM_REGEXP
|
|
4
|
+
import { CONTEXT_PARAM_PREFIX, CONTEXT_PARAM_REGEXP } from './const';
|
|
3
5
|
export const contextParamSchema = z.string().regex(CONTEXT_PARAM_REGEXP);
|
|
4
6
|
// We want to discriminate between ContextParams and plain strings
|
|
5
7
|
// If a string starts with `:`, it's a ContextParam
|
|
6
8
|
export const plainStringSchema = z.string().refine((str) => {
|
|
7
9
|
return !str.startsWith(CONTEXT_PARAM_PREFIX);
|
|
8
10
|
}, {
|
|
9
|
-
message:
|
|
11
|
+
message: `String must not be a context parameter i.e. not start with "${CONTEXT_PARAM_PREFIX}"`,
|
|
10
12
|
});
|
|
11
13
|
const paramSchema = z.union([plainStringSchema, z.boolean(), z.number()]);
|
|
12
14
|
export const paramOrContextParamSchema = z.union([
|
|
@@ -19,8 +21,10 @@ export const returnValueTestSchema = z.object({
|
|
|
19
21
|
comparator: z.enum(['==', '>', '<', '>=', '<=', '!=']),
|
|
20
22
|
value: paramOrContextParamSchema,
|
|
21
23
|
});
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
+
const UserAddressSchema = z.enum([
|
|
25
|
+
USER_ADDRESS_PARAM_DEFAULT,
|
|
26
|
+
USER_ADDRESS_PARAM_EXTERNAL_EIP4361,
|
|
27
|
+
]);
|
|
24
28
|
export const EthAddressOrUserAddressSchema = z.union([
|
|
25
29
|
EthAddressSchema,
|
|
26
30
|
UserAddressSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/conditions/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/conditions/shared.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EACL,0BAA0B,EAC1B,mCAAmC,GACpC,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAErE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC;AACzE,kEAAkE;AAClE,mDAAmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAChD,CAAC,GAAG,EAAE,EAAE;IACN,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC;AAC/C,CAAC,EACD;IACE,OAAO,EAAE,+DAA+D,oBAAoB,GAAG;CAChG,CAC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;IACF,OAAO,CAAC,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,OAAO,EAAa,CAAC,EAAc,MAAM,KAAK,CAAC;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,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAIzD,CAAC;IACF,OAAO,CAAC,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,CAAC,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;IAED,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,WAAW,CAChB,MAAqE,CACtE,CAAC;AACJ,CAAC;AAED,eAAe,iBAAiB,CAAC"}
|
package/dist/es/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/es/dkg.js
CHANGED
|
@@ -37,9 +37,9 @@ export class DkgRitual {
|
|
|
37
37
|
}
|
|
38
38
|
const ERR_RITUAL_NOT_FINALIZED = (ritualId, ritual) => `Ritual ${ritualId} is not finalized. State: ${ritual.state}`;
|
|
39
39
|
export class DkgClient {
|
|
40
|
-
static async initializeRitual(provider, signer, domain, ursulas, authority, duration, accessController, waitUntilEnd = false) {
|
|
40
|
+
static async initializeRitual(provider, signer, domain, ursulas, authority, duration, feeModel, accessController, waitUntilEnd = false) {
|
|
41
41
|
const ritualId = await DkgCoordinatorAgent.initializeRitual(provider, signer, domain, ursulas.sort(), // Contract call requires sorted addresses
|
|
42
|
-
authority, duration, accessController);
|
|
42
|
+
authority, duration, feeModel, accessController);
|
|
43
43
|
if (waitUntilEnd) {
|
|
44
44
|
const isSuccessful = await DkgClient.waitUntilRitualEnd(provider, domain, ritualId);
|
|
45
45
|
if (!isSuccessful) {
|
package/dist/es/dkg.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dkg.js","sourceRoot":"","sources":["../../src/dkg.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAEL,mBAAmB,EACnB,cAAc,EAEd,aAAa,GACd,MAAM,kBAAkB,CAAC;AAW1B,MAAM,OAAO,SAAS;IAEF;IACA;IACA;IACA;IACA;IALlB,YACkB,EAAU,EACV,YAA0B,EAC1B,SAAiB,EACjB,SAAiB,EACjB,KAAqB;QAJrB,OAAE,GAA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C,QAAQ,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;QACrE,IAAI,MAAM,CAAC,KAAK,KAAK,cAAc,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"}
|
package/dist/es/index.d.ts
CHANGED
|
@@ -1,4 +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
|
|
4
|
+
export { decrypt, encrypt, encryptWithPublicKey } from './taco';
|
package/dist/es/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { DkgPublicKey, ThresholdMessageKit } from '@nucypher/nucypher-core';
|
|
2
|
-
export { domains, fromBytes,
|
|
2
|
+
export { domains, fromBytes, getPorterUris, initialize, toBytes, toHexString, } from '@nucypher/shared';
|
|
3
3
|
export * as conditions from './conditions';
|
|
4
|
-
|
|
5
|
-
export { decrypt, encrypt, encryptWithPublicKey, isAuthorized } from './taco';
|
|
4
|
+
export { decrypt, encrypt, encryptWithPublicKey } from './taco';
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
package/dist/es/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAEL,OAAO,EACP,SAAS,EACT,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAEL,OAAO,EACP,SAAS,EACT,aAAa,EACb,UAAU,EACV,OAAO,EACP,WAAW,GACZ,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAE3C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC"}
|
package/dist/es/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/es/taco.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AccessControlPolicy, encryptForDkg, ThresholdMessageKit, } from '@nucypher/nucypher-core';
|
|
2
|
-
import { DkgCoordinatorAgent, fromHexString,
|
|
2
|
+
import { DkgCoordinatorAgent, fromHexString, getPorterUris, PorterClient, toBytes, } from '@nucypher/shared';
|
|
3
3
|
import { keccak256 } from 'ethers/lib/utils';
|
|
4
4
|
import { ConditionExpression } from './conditions/condition-expr';
|
|
5
5
|
import { DkgClient } from './dkg';
|
|
@@ -60,7 +60,7 @@ export const encryptWithPublicKey = async (message, condition, dkgPublicKey, aut
|
|
|
60
60
|
message = toBytes(message);
|
|
61
61
|
}
|
|
62
62
|
const conditionExpr = new ConditionExpression(condition);
|
|
63
|
-
const [ciphertext, authenticatedData] = encryptForDkg(message, dkgPublicKey, conditionExpr.
|
|
63
|
+
const [ciphertext, authenticatedData] = encryptForDkg(message, dkgPublicKey, conditionExpr.toCoreCondition());
|
|
64
64
|
const headerHash = keccak256(ciphertext.header.toBytes());
|
|
65
65
|
const authorization = await authSigner.signMessage(fromHexString(headerHash));
|
|
66
66
|
const acp = new AccessControlPolicy(authenticatedData, fromHexString(authorization));
|
|
@@ -75,40 +75,21 @@ export const encryptWithPublicKey = async (message, condition, dkgPublicKey, aut
|
|
|
75
75
|
* @param {Domain} domain - Represents the logical network in which the decryption will be performed.
|
|
76
76
|
* Must match the `ritualId`.
|
|
77
77
|
* @param {ThresholdMessageKit} messageKit - The kit containing the message to be decrypted
|
|
78
|
-
* @param {
|
|
78
|
+
* @param {ConditionContext} context - Optional context data used for decryption time values for the condition(s) within the `messageKit`.
|
|
79
|
+
* @param {string[]} [porterUris] - Optional URI(s) for the Porter service. If not provided, a value will be obtained
|
|
79
80
|
* from the Domain
|
|
80
|
-
* @param {ethers.Signer} [signer] - An optional signer for the decryption
|
|
81
|
-
* @param {Record<string, CustomContextParam>} [customParameters] - Optional custom parameters that may be required
|
|
82
|
-
* depending on the condition used
|
|
83
81
|
*
|
|
84
82
|
* @returns {Promise<Uint8Array>} Returns Promise that resolves with a decrypted message
|
|
85
83
|
*
|
|
86
84
|
* @throws {Error} If the active DKG Ritual cannot be retrieved or decryption process throws an error,
|
|
87
85
|
* an error is thrown.
|
|
88
86
|
*/
|
|
89
|
-
export const decrypt = async (provider, domain, messageKit,
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
87
|
+
export const decrypt = async (provider, domain, messageKit, context, porterUris) => {
|
|
88
|
+
const porterUrisFull = porterUris
|
|
89
|
+
? porterUris
|
|
90
|
+
: await getPorterUris(domain);
|
|
91
|
+
const porter = new PorterClient(porterUrisFull);
|
|
93
92
|
const ritualId = await DkgCoordinatorAgent.getRitualIdFromPublicKey(provider, domain, messageKit.acp.publicKey);
|
|
94
|
-
|
|
95
|
-
return retrieveAndDecrypt(provider, domain, porterUri, messageKit, ritualId, ritual.sharesNum, ritual.threshold, signer, customParameters);
|
|
96
|
-
};
|
|
97
|
-
/**
|
|
98
|
-
* Checks if the encryption from the provided messageKit is authorized for the specified ritual.
|
|
99
|
-
*
|
|
100
|
-
* @export
|
|
101
|
-
* @param {ethers.providers.Provider} provider - Instance of ethers provider which is used to interact with
|
|
102
|
-
* your selected network.
|
|
103
|
-
* @param {Domain} domain - The domain which was used to encrypt the network. Must match the `ritualId`.
|
|
104
|
-
* @param {ThresholdMessageKit} messageKit - The encrypted message kit to be checked.
|
|
105
|
-
* @param {number} ritualId - The ID of the DKG Ritual under which the messageKit was supposedly encrypted.
|
|
106
|
-
*
|
|
107
|
-
* @returns {Promise<boolean>} Returns a Promise that resolves with the authorization status.
|
|
108
|
-
* True if authorized, false otherwise
|
|
109
|
-
*/
|
|
110
|
-
export const isAuthorized = async (provider, domain, messageKit, ritualId) => DkgCoordinatorAgent.isEncryptionAuthorized(provider, domain, ritualId, messageKit);
|
|
111
|
-
export const registerEncrypters = async (provider, signer, domain, ritualId, encrypters) => {
|
|
112
|
-
await GlobalAllowListAgent.registerEncrypters(provider, signer, domain, ritualId, encrypters);
|
|
93
|
+
return retrieveAndDecrypt(provider, domain, porter, messageKit, ritualId, context);
|
|
113
94
|
};
|
|
114
95
|
//# sourceMappingURL=taco.js.map
|
package/dist/es/taco.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"taco.js","sourceRoot":"","sources":["../../src/taco.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EAEnB,aAAa,EACb,mBAAmB,GACpB,MAAM,yBAAyB,CAAC;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/nucypher-core';
|
|
2
|
-
import { Domain } from '@nucypher/shared';
|
|
2
|
+
import { Domain, PorterClient } from '@nucypher/shared';
|
|
3
3
|
import { ethers } from 'ethers';
|
|
4
4
|
import { ConditionExpression } from './conditions/condition-expr';
|
|
5
|
-
import {
|
|
5
|
+
import { ConditionContext } from './conditions/context';
|
|
6
6
|
export declare const encryptMessage: (plaintext: Uint8Array | string, encryptingKey: DkgPublicKey, conditions: ConditionExpression, authSigner: ethers.Signer) => Promise<ThresholdMessageKit>;
|
|
7
|
-
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>;
|