@nucypher/taco 0.6.0 → 0.7.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/conditions/base/address-allowlist.d.ts +10 -0
- package/dist/cjs/conditions/base/address-allowlist.js +19 -0
- package/dist/cjs/conditions/base/address-allowlist.js.map +1 -0
- package/dist/cjs/conditions/base/ecdsa.d.ts +7 -0
- package/dist/cjs/conditions/base/ecdsa.js +21 -0
- package/dist/cjs/conditions/base/ecdsa.js.map +1 -0
- package/dist/cjs/conditions/base/index.d.ts +3 -0
- package/dist/cjs/conditions/base/index.js +4 -1
- package/dist/cjs/conditions/base/index.js.map +1 -1
- package/dist/cjs/conditions/base/signing.d.ts +10 -0
- package/dist/cjs/conditions/base/signing.js +32 -0
- package/dist/cjs/conditions/base/signing.js.map +1 -0
- package/dist/cjs/conditions/condition-factory.js +11 -0
- package/dist/cjs/conditions/condition-factory.js.map +1 -1
- package/dist/cjs/conditions/context/context.d.ts +4 -0
- package/dist/cjs/conditions/context/context.js +28 -3
- package/dist/cjs/conditions/context/context.js.map +1 -1
- package/dist/cjs/conditions/schemas/address-allowlist.d.ts +16 -0
- package/dist/cjs/conditions/schemas/address-allowlist.js +20 -0
- package/dist/cjs/conditions/schemas/address-allowlist.js.map +1 -0
- package/dist/cjs/conditions/schemas/common.d.ts +2 -0
- package/dist/cjs/conditions/schemas/common.js +20 -3
- package/dist/cjs/conditions/schemas/common.js.map +1 -1
- package/dist/cjs/conditions/schemas/contract.d.ts +33 -30
- package/dist/cjs/conditions/schemas/ecdsa.d.ts +38 -0
- package/dist/cjs/conditions/schemas/ecdsa.js +40 -0
- package/dist/cjs/conditions/schemas/ecdsa.js.map +1 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.d.ts +3 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js +4 -0
- package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js.map +1 -1
- package/dist/cjs/conditions/schemas/json-api.d.ts +47 -14
- package/dist/cjs/conditions/schemas/json-api.js +16 -2
- package/dist/cjs/conditions/schemas/json-api.js.map +1 -1
- package/dist/cjs/conditions/schemas/json-rpc.d.ts +48 -13
- package/dist/cjs/conditions/schemas/json-rpc.js +16 -2
- package/dist/cjs/conditions/schemas/json-rpc.js.map +1 -1
- package/dist/cjs/conditions/schemas/jwt.d.ts +2 -4
- package/dist/cjs/conditions/schemas/return-value-test.d.ts +28 -12
- package/dist/cjs/conditions/schemas/return-value-test.js +19 -5
- package/dist/cjs/conditions/schemas/return-value-test.js.map +1 -1
- package/dist/cjs/conditions/schemas/rpc.d.ts +22 -16
- package/dist/cjs/conditions/schemas/sequential.js +31 -11
- package/dist/cjs/conditions/schemas/sequential.js.map +1 -1
- package/dist/cjs/conditions/schemas/signing.d.ts +12 -0
- package/dist/cjs/conditions/schemas/signing.js +204 -0
- package/dist/cjs/conditions/schemas/signing.js.map +1 -0
- package/dist/cjs/conditions/schemas/time.d.ts +18 -10
- package/dist/cjs/conditions/schemas/utils.js +8 -1
- package/dist/cjs/conditions/schemas/utils.js.map +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/sign.d.ts +26 -0
- package/dist/cjs/sign.js +99 -0
- package/dist/cjs/sign.js.map +1 -0
- package/dist/cjs/types.d.ts +1 -0
- package/dist/es/conditions/base/address-allowlist.d.ts +10 -0
- package/dist/es/conditions/base/address-allowlist.js +15 -0
- package/dist/es/conditions/base/address-allowlist.js.map +1 -0
- package/dist/es/conditions/base/ecdsa.d.ts +7 -0
- package/dist/es/conditions/base/ecdsa.js +12 -0
- package/dist/es/conditions/base/ecdsa.js.map +1 -0
- package/dist/es/conditions/base/index.d.ts +3 -0
- package/dist/es/conditions/base/index.js +3 -0
- package/dist/es/conditions/base/index.js.map +1 -1
- package/dist/es/conditions/base/signing.d.ts +10 -0
- package/dist/es/conditions/base/signing.js +20 -0
- package/dist/es/conditions/base/signing.js.map +1 -0
- package/dist/es/conditions/condition-factory.js +11 -0
- package/dist/es/conditions/condition-factory.js.map +1 -1
- package/dist/es/conditions/context/context.d.ts +4 -0
- package/dist/es/conditions/context/context.js +27 -2
- package/dist/es/conditions/context/context.js.map +1 -1
- package/dist/es/conditions/schemas/address-allowlist.d.ts +16 -0
- package/dist/es/conditions/schemas/address-allowlist.js +17 -0
- package/dist/es/conditions/schemas/address-allowlist.js.map +1 -0
- package/dist/es/conditions/schemas/common.d.ts +2 -0
- package/dist/es/conditions/schemas/common.js +19 -2
- package/dist/es/conditions/schemas/common.js.map +1 -1
- package/dist/es/conditions/schemas/contract.d.ts +33 -30
- package/dist/es/conditions/schemas/ecdsa.d.ts +38 -0
- package/dist/es/conditions/schemas/ecdsa.js +37 -0
- package/dist/es/conditions/schemas/ecdsa.js.map +1 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.d.ts +3 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.js +4 -0
- package/dist/es/conditions/schemas/export-for-zod-doc-gen.js.map +1 -1
- package/dist/es/conditions/schemas/json-api.d.ts +47 -14
- package/dist/es/conditions/schemas/json-api.js +17 -3
- package/dist/es/conditions/schemas/json-api.js.map +1 -1
- package/dist/es/conditions/schemas/json-rpc.d.ts +48 -13
- package/dist/es/conditions/schemas/json-rpc.js +17 -3
- package/dist/es/conditions/schemas/json-rpc.js.map +1 -1
- package/dist/es/conditions/schemas/jwt.d.ts +2 -4
- package/dist/es/conditions/schemas/return-value-test.d.ts +28 -12
- package/dist/es/conditions/schemas/return-value-test.js +19 -5
- package/dist/es/conditions/schemas/return-value-test.js.map +1 -1
- package/dist/es/conditions/schemas/rpc.d.ts +22 -16
- package/dist/es/conditions/schemas/sequential.js +31 -11
- package/dist/es/conditions/schemas/sequential.js.map +1 -1
- package/dist/es/conditions/schemas/signing.d.ts +12 -0
- package/dist/es/conditions/schemas/signing.js +201 -0
- package/dist/es/conditions/schemas/signing.js.map +1 -0
- package/dist/es/conditions/schemas/time.d.ts +18 -10
- package/dist/es/conditions/schemas/utils.js +8 -1
- package/dist/es/conditions/schemas/utils.js.map +1 -1
- package/dist/es/index.d.ts +1 -0
- package/dist/es/index.js +1 -0
- package/dist/es/index.js.map +1 -1
- package/dist/es/sign.d.ts +26 -0
- package/dist/es/sign.js +95 -0
- package/dist/es/sign.js.map +1 -0
- package/dist/es/types.d.ts +1 -0
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.es.tsbuildinfo +1 -1
- package/package.json +5 -4
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Condition } from '../condition';
|
|
2
|
+
import { AddressAllowlistConditionProps, AddressAllowlistConditionType } from '../schemas/address-allowlist';
|
|
3
|
+
import { OmitConditionType } from '../shared';
|
|
4
|
+
export { AddressAllowlistConditionProps, AddressAllowlistConditionType };
|
|
5
|
+
/**
|
|
6
|
+
* A condition that checks if a wallet address is in a list of allowed addresses.
|
|
7
|
+
*/
|
|
8
|
+
export declare class AddressAllowlistCondition extends Condition {
|
|
9
|
+
constructor(value: OmitConditionType<AddressAllowlistConditionProps>);
|
|
10
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddressAllowlistCondition = exports.AddressAllowlistConditionType = void 0;
|
|
4
|
+
const condition_1 = require("../condition");
|
|
5
|
+
const address_allowlist_1 = require("../schemas/address-allowlist");
|
|
6
|
+
Object.defineProperty(exports, "AddressAllowlistConditionType", { enumerable: true, get: function () { return address_allowlist_1.AddressAllowlistConditionType; } });
|
|
7
|
+
/**
|
|
8
|
+
* A condition that checks if a wallet address is in a list of allowed addresses.
|
|
9
|
+
*/
|
|
10
|
+
class AddressAllowlistCondition extends condition_1.Condition {
|
|
11
|
+
constructor(value) {
|
|
12
|
+
super(address_allowlist_1.addressAllowlistConditionSchema, {
|
|
13
|
+
conditionType: address_allowlist_1.AddressAllowlistConditionType,
|
|
14
|
+
...value,
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.AddressAllowlistCondition = AddressAllowlistCondition;
|
|
19
|
+
//# sourceMappingURL=address-allowlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-allowlist.js","sourceRoot":"","sources":["../../../../src/conditions/base/address-allowlist.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,oEAIsC;AAEG,8GAHvC,iDAA6B,OAGuC;AAEtE;;GAEG;AACH,MAAa,yBAA0B,SAAQ,qBAAS;IACtD,YAAY,KAAwD;QAClE,KAAK,CAAC,mDAA+B,EAAE;YACrC,aAAa,EAAE,iDAA6B;YAC5C,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF;AAPD,8DAOC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Condition } from '../condition';
|
|
2
|
+
import { ECDSAConditionProps } from '../schemas/ecdsa';
|
|
3
|
+
import { OmitConditionType } from '../shared';
|
|
4
|
+
export { ECDSA_MESSAGE_PARAM_DEFAULT, ECDSA_SIGNATURE_PARAM_DEFAULT, ECDSAConditionProps, ecdsaConditionSchema, ECDSAConditionType, ECDSACurve, SUPPORTED_ECDSA_CURVES, } from '../schemas/ecdsa';
|
|
5
|
+
export declare class ECDSACondition extends Condition {
|
|
6
|
+
constructor(value: OmitConditionType<ECDSAConditionProps>);
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ECDSACondition = exports.SUPPORTED_ECDSA_CURVES = exports.ECDSAConditionType = exports.ecdsaConditionSchema = exports.ECDSA_SIGNATURE_PARAM_DEFAULT = exports.ECDSA_MESSAGE_PARAM_DEFAULT = void 0;
|
|
4
|
+
const condition_1 = require("../condition");
|
|
5
|
+
const ecdsa_1 = require("../schemas/ecdsa");
|
|
6
|
+
var ecdsa_2 = require("../schemas/ecdsa");
|
|
7
|
+
Object.defineProperty(exports, "ECDSA_MESSAGE_PARAM_DEFAULT", { enumerable: true, get: function () { return ecdsa_2.ECDSA_MESSAGE_PARAM_DEFAULT; } });
|
|
8
|
+
Object.defineProperty(exports, "ECDSA_SIGNATURE_PARAM_DEFAULT", { enumerable: true, get: function () { return ecdsa_2.ECDSA_SIGNATURE_PARAM_DEFAULT; } });
|
|
9
|
+
Object.defineProperty(exports, "ecdsaConditionSchema", { enumerable: true, get: function () { return ecdsa_2.ecdsaConditionSchema; } });
|
|
10
|
+
Object.defineProperty(exports, "ECDSAConditionType", { enumerable: true, get: function () { return ecdsa_2.ECDSAConditionType; } });
|
|
11
|
+
Object.defineProperty(exports, "SUPPORTED_ECDSA_CURVES", { enumerable: true, get: function () { return ecdsa_2.SUPPORTED_ECDSA_CURVES; } });
|
|
12
|
+
class ECDSACondition extends condition_1.Condition {
|
|
13
|
+
constructor(value) {
|
|
14
|
+
super(ecdsa_1.ecdsaConditionSchema, {
|
|
15
|
+
conditionType: ecdsa_1.ECDSAConditionType,
|
|
16
|
+
...value,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ECDSACondition = ECDSACondition;
|
|
21
|
+
//# sourceMappingURL=ecdsa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ecdsa.js","sourceRoot":"","sources":["../../../../src/conditions/base/ecdsa.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,4CAI0B;AAG1B,0CAQ0B;AAPxB,oHAAA,2BAA2B,OAAA;AAC3B,sHAAA,6BAA6B,OAAA;AAE7B,6GAAA,oBAAoB,OAAA;AACpB,2GAAA,kBAAkB,OAAA;AAElB,+GAAA,sBAAsB,OAAA;AAGxB,MAAa,cAAe,SAAQ,qBAAS;IAC3C,YAAY,KAA6C;QACvD,KAAK,CAAC,4BAAoB,EAAE;YAC1B,aAAa,EAAE,0BAAkB;YACjC,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF;AAPD,wCAOC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
export * as addressAllowlist from './address-allowlist';
|
|
1
2
|
export * as contract from './contract';
|
|
3
|
+
export * as ecdsa from './ecdsa';
|
|
2
4
|
export * as jsonApi from './json-api';
|
|
3
5
|
export * as jsonRpc from './json-rpc';
|
|
4
6
|
export * as jwt from './jwt';
|
|
5
7
|
export * as rpc from './rpc';
|
|
8
|
+
export * as signing from './signing';
|
|
6
9
|
export * as time from './time';
|
|
@@ -35,11 +35,14 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
};
|
|
36
36
|
})();
|
|
37
37
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
exports.time = exports.rpc = exports.jwt = exports.jsonRpc = exports.jsonApi = exports.contract = void 0;
|
|
38
|
+
exports.time = exports.signing = exports.rpc = exports.jwt = exports.jsonRpc = exports.jsonApi = exports.ecdsa = exports.contract = exports.addressAllowlist = void 0;
|
|
39
|
+
exports.addressAllowlist = __importStar(require("./address-allowlist"));
|
|
39
40
|
exports.contract = __importStar(require("./contract"));
|
|
41
|
+
exports.ecdsa = __importStar(require("./ecdsa"));
|
|
40
42
|
exports.jsonApi = __importStar(require("./json-api"));
|
|
41
43
|
exports.jsonRpc = __importStar(require("./json-rpc"));
|
|
42
44
|
exports.jwt = __importStar(require("./jwt"));
|
|
43
45
|
exports.rpc = __importStar(require("./rpc"));
|
|
46
|
+
exports.signing = __importStar(require("./signing"));
|
|
44
47
|
exports.time = __importStar(require("./time"));
|
|
45
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conditions/base/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhD,uDAAuC;AACvC,sDAAsC;AACtC,sDAAsC;AACtC,6CAA6B;AAC7B,6CAA6B;AAC7B,+CAA+B"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conditions/base/index.ts"],"names":[],"mappings":";AAAA,qEAAqE;AACrE,gDAAgD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEhD,wEAAwD;AACxD,uDAAuC;AACvC,iDAAiC;AACjC,sDAAsC;AACtC,sDAAsC;AACtC,6CAA6B;AAC7B,6CAA6B;AAC7B,qDAAqC;AACrC,+CAA+B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Condition } from '../condition';
|
|
2
|
+
import { SigningObjectAbiAttributeConditionProps, SigningObjectAttributeConditionProps } from '../schemas/signing';
|
|
3
|
+
import { OmitConditionType } from '../shared';
|
|
4
|
+
export { AbiCallValidationProps, abiCallValidationSchema, AbiParameterValidationProps, abiParameterValidationSchema, SIGNING_CONDITION_OBJECT_CONTEXT_VAR, SigningObjectAbiAttributeConditionProps, signingObjectAbiAttributeConditionSchema, SigningObjectAbiAttributeConditionType, SigningObjectAttributeConditionProps, signingObjectAttributeConditionSchema, SigningObjectAttributeConditionType, } from '../schemas/signing';
|
|
5
|
+
export declare class SigningObjectAttributeCondition extends Condition {
|
|
6
|
+
constructor(value: OmitConditionType<SigningObjectAttributeConditionProps>);
|
|
7
|
+
}
|
|
8
|
+
export declare class SigningObjectAbiAttributeCondition extends Condition {
|
|
9
|
+
constructor(value: OmitConditionType<SigningObjectAbiAttributeConditionProps>);
|
|
10
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SigningObjectAbiAttributeCondition = exports.SigningObjectAttributeCondition = exports.SigningObjectAttributeConditionType = exports.signingObjectAttributeConditionSchema = exports.SigningObjectAbiAttributeConditionType = exports.signingObjectAbiAttributeConditionSchema = exports.SIGNING_CONDITION_OBJECT_CONTEXT_VAR = exports.abiParameterValidationSchema = exports.abiCallValidationSchema = void 0;
|
|
4
|
+
const condition_1 = require("../condition");
|
|
5
|
+
const signing_1 = require("../schemas/signing");
|
|
6
|
+
var signing_2 = require("../schemas/signing");
|
|
7
|
+
Object.defineProperty(exports, "abiCallValidationSchema", { enumerable: true, get: function () { return signing_2.abiCallValidationSchema; } });
|
|
8
|
+
Object.defineProperty(exports, "abiParameterValidationSchema", { enumerable: true, get: function () { return signing_2.abiParameterValidationSchema; } });
|
|
9
|
+
Object.defineProperty(exports, "SIGNING_CONDITION_OBJECT_CONTEXT_VAR", { enumerable: true, get: function () { return signing_2.SIGNING_CONDITION_OBJECT_CONTEXT_VAR; } });
|
|
10
|
+
Object.defineProperty(exports, "signingObjectAbiAttributeConditionSchema", { enumerable: true, get: function () { return signing_2.signingObjectAbiAttributeConditionSchema; } });
|
|
11
|
+
Object.defineProperty(exports, "SigningObjectAbiAttributeConditionType", { enumerable: true, get: function () { return signing_2.SigningObjectAbiAttributeConditionType; } });
|
|
12
|
+
Object.defineProperty(exports, "signingObjectAttributeConditionSchema", { enumerable: true, get: function () { return signing_2.signingObjectAttributeConditionSchema; } });
|
|
13
|
+
Object.defineProperty(exports, "SigningObjectAttributeConditionType", { enumerable: true, get: function () { return signing_2.SigningObjectAttributeConditionType; } });
|
|
14
|
+
class SigningObjectAttributeCondition extends condition_1.Condition {
|
|
15
|
+
constructor(value) {
|
|
16
|
+
super(signing_1.signingObjectAttributeConditionSchema, {
|
|
17
|
+
conditionType: signing_1.SigningObjectAttributeConditionType,
|
|
18
|
+
...value,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.SigningObjectAttributeCondition = SigningObjectAttributeCondition;
|
|
23
|
+
class SigningObjectAbiAttributeCondition extends condition_1.Condition {
|
|
24
|
+
constructor(value) {
|
|
25
|
+
super(signing_1.signingObjectAbiAttributeConditionSchema, {
|
|
26
|
+
conditionType: signing_1.SigningObjectAbiAttributeConditionType,
|
|
27
|
+
...value,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.SigningObjectAbiAttributeCondition = SigningObjectAbiAttributeCondition;
|
|
32
|
+
//# sourceMappingURL=signing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"signing.js","sourceRoot":"","sources":["../../../../src/conditions/base/signing.ts"],"names":[],"mappings":";;;AAAA,4CAAyC;AACzC,gDAO4B;AAG5B,8CAY4B;AAV1B,kHAAA,uBAAuB,OAAA;AAEvB,uHAAA,4BAA4B,OAAA;AAC5B,+HAAA,oCAAoC,OAAA;AAEpC,mIAAA,wCAAwC,OAAA;AACxC,iIAAA,sCAAsC,OAAA;AAEtC,gIAAA,qCAAqC,OAAA;AACrC,8HAAA,mCAAmC,OAAA;AAGrC,MAAa,+BAAgC,SAAQ,qBAAS;IAC5D,YAAY,KAA8D;QACxE,KAAK,CAAC,+CAAqC,EAAE;YAC3C,aAAa,EAAE,6CAAmC;YAClD,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF;AAPD,0EAOC;AAED,MAAa,kCAAmC,SAAQ,qBAAS;IAC/D,YACE,KAAiE;QAEjE,KAAK,CAAC,kDAAwC,EAAE;YAC9C,aAAa,EAAE,gDAAsC;YACrD,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF;AATD,gFASC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ConditionFactory = void 0;
|
|
4
|
+
const address_allowlist_1 = require("./base/address-allowlist");
|
|
4
5
|
const contract_1 = require("./base/contract");
|
|
6
|
+
const ecdsa_1 = require("./base/ecdsa");
|
|
5
7
|
const json_api_1 = require("./base/json-api");
|
|
6
8
|
const json_rpc_1 = require("./base/json-rpc");
|
|
7
9
|
const jwt_1 = require("./base/jwt");
|
|
8
10
|
const rpc_1 = require("./base/rpc");
|
|
11
|
+
const signing_1 = require("./base/signing");
|
|
9
12
|
const time_1 = require("./base/time");
|
|
10
13
|
const compound_condition_1 = require("./compound-condition");
|
|
11
14
|
const if_then_else_condition_1 = require("./if-then-else-condition");
|
|
@@ -21,12 +24,20 @@ class ConditionFactory {
|
|
|
21
24
|
return new time_1.TimeCondition(props);
|
|
22
25
|
case contract_1.ContractConditionType:
|
|
23
26
|
return new contract_1.ContractCondition(props);
|
|
27
|
+
case ecdsa_1.ECDSAConditionType:
|
|
28
|
+
return new ecdsa_1.ECDSACondition(props);
|
|
24
29
|
case json_api_1.JsonApiConditionType:
|
|
25
30
|
return new json_api_1.JsonApiCondition(props);
|
|
26
31
|
case json_rpc_1.JsonRpcConditionType:
|
|
27
32
|
return new json_rpc_1.JsonRpcCondition(props);
|
|
28
33
|
case jwt_1.JWTConditionType:
|
|
29
34
|
return new jwt_1.JWTCondition(props);
|
|
35
|
+
case address_allowlist_1.AddressAllowlistConditionType:
|
|
36
|
+
return new address_allowlist_1.AddressAllowlistCondition(props);
|
|
37
|
+
case signing_1.SigningObjectAttributeConditionType:
|
|
38
|
+
return new signing_1.SigningObjectAttributeCondition(props);
|
|
39
|
+
case signing_1.SigningObjectAbiAttributeConditionType:
|
|
40
|
+
return new signing_1.SigningObjectAbiAttributeCondition(props);
|
|
30
41
|
// Logical Conditions
|
|
31
42
|
case compound_condition_1.CompoundConditionType:
|
|
32
43
|
return new compound_condition_1.CompoundCondition(props);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"condition-factory.js","sourceRoot":"","sources":["../../../src/conditions/condition-factory.ts"],"names":[],"mappings":";;;AAAA,8CAIyB;AACzB,8CAIyB;AACzB,8CAIyB;AACzB,oCAA+E;AAC/E,oCAA+E;AAC/E,sCAIqB;AACrB,6DAI8B;AAE9B,qEAIkC;AAClC,6CAIsB;AAEtB,MAAM,0BAA0B,GAAG,CAAC,IAAY,EAAE,EAAE,CAClD,2BAA2B,IAAI,EAAE,CAAC;AAEpC,MAAa,gBAAgB;IACpB,MAAM,CAAC,kBAAkB,CAAC,KAAqB;QACpD,QAAQ,KAAK,CAAC,aAAa,EAAE,CAAC;YAC5B,kBAAkB;YAClB,KAAK,sBAAgB;gBACnB,OAAO,IAAI,kBAAY,CAAC,KAA0B,CAAC,CAAC;YACtD,KAAK,wBAAiB;gBACpB,OAAO,IAAI,oBAAa,CAAC,KAA2B,CAAC,CAAC;YACxD,KAAK,gCAAqB;gBACxB,OAAO,IAAI,4BAAiB,CAAC,KAA+B,CAAC,CAAC;YAChE,KAAK,+BAAoB;gBACvB,OAAO,IAAI,2BAAgB,CAAC,KAA8B,CAAC,CAAC;YAC9D,KAAK,+BAAoB;gBACvB,OAAO,IAAI,2BAAgB,CAAC,KAA8B,CAAC,CAAC;YAC9D,KAAK,sBAAgB;gBACnB,OAAO,IAAI,kBAAY,CAAC,KAA0B,CAAC,CAAC;YACtD,qBAAqB;YACrB,KAAK,0CAAqB;gBACxB,OAAO,IAAI,sCAAiB,CAAC,KAA+B,CAAC,CAAC;YAChE,KAAK,oCAAuB;gBAC1B,OAAO,IAAI,gCAAmB,CAAC,KAAiC,CAAC,CAAC;YACpE,KAAK,gDAAuB;gBAC1B,OAAO,IAAI,4CAAmB,CAAC,KAAiC,CAAC,CAAC;YACpE;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"condition-factory.js","sourceRoot":"","sources":["../../../src/conditions/condition-factory.ts"],"names":[],"mappings":";;;AAAA,gEAIkC;AAClC,8CAIyB;AACzB,wCAIsB;AACtB,8CAIyB;AACzB,8CAIyB;AACzB,oCAA+E;AAC/E,oCAA+E;AAC/E,4CAOwB;AACxB,sCAIqB;AACrB,6DAI8B;AAE9B,qEAIkC;AAClC,6CAIsB;AAEtB,MAAM,0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AAC,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;CACF;AAzCD,4CAyCC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import { ThresholdMessageKit } from '@nucypher/nucypher-core';
|
|
2
|
+
import { Domain } from '@nucypher/shared';
|
|
2
3
|
import { AuthProvider, AuthSignature } from '@nucypher/taco-auth';
|
|
4
|
+
import { ethers } from 'ethers';
|
|
3
5
|
import { CoreContext } from '../../types';
|
|
4
6
|
import { Condition } from '../condition';
|
|
5
7
|
export type CustomContextParam = string | number | boolean | bigint | Uint8Array;
|
|
6
8
|
export type ContextParam = CustomContextParam | AuthSignature;
|
|
9
|
+
export declare const AUTOMATICALLY_INJECTED_CONTEXT_PARAMS: string[];
|
|
7
10
|
export declare const RESERVED_CONTEXT_PARAMS: string[];
|
|
8
11
|
export declare class ConditionContext {
|
|
9
12
|
requestedContextParameters: Set<string>;
|
|
@@ -25,4 +28,5 @@ export declare class ConditionContext {
|
|
|
25
28
|
toCoreContext(): Promise<CoreContext>;
|
|
26
29
|
toContextParameters: () => Promise<Record<string, ContextParam>>;
|
|
27
30
|
static fromMessageKit(messageKit: ThresholdMessageKit): ConditionContext;
|
|
31
|
+
static forSigningCohort(provider: ethers.providers.JsonRpcProvider, domain: Domain, cohortId: number, chainId: number): Promise<ConditionContext>;
|
|
28
32
|
}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ConditionContext = exports.RESERVED_CONTEXT_PARAMS = void 0;
|
|
3
|
+
exports.ConditionContext = exports.RESERVED_CONTEXT_PARAMS = exports.AUTOMATICALLY_INJECTED_CONTEXT_PARAMS = void 0;
|
|
4
|
+
const shared_1 = require("@nucypher/shared");
|
|
4
5
|
const taco_auth_1 = require("@nucypher/taco-auth");
|
|
6
|
+
const ethers_1 = require("ethers");
|
|
5
7
|
const types_1 = require("../../types");
|
|
6
8
|
const utils_1 = require("../../utils");
|
|
7
9
|
const condition_expr_1 = require("../condition-expr");
|
|
8
10
|
const const_1 = require("../const");
|
|
11
|
+
const signing_1 = require("../schemas/signing");
|
|
9
12
|
const ERR_RESERVED_PARAM = (key) => `Cannot use reserved parameter name ${key} as custom parameter`;
|
|
10
13
|
const ERR_INVALID_CUSTOM_PARAM = (key) => `Custom parameter ${key} must start with ${const_1.CONTEXT_PARAM_PREFIX}`;
|
|
11
14
|
const ERR_AUTH_PROVIDER_REQUIRED = (key) => `No matching authentication provider to satisfy ${key} context variable in condition`;
|
|
@@ -13,6 +16,7 @@ const ERR_MISSING_CONTEXT_PARAMS = (params) => `Missing custom context parameter
|
|
|
13
16
|
const ERR_UNKNOWN_CUSTOM_CONTEXT_PARAM = (param) => `Unknown custom context parameter: ${param}`;
|
|
14
17
|
const ERR_INVALID_AUTH_PROVIDER_TYPE = (param, expected) => `Invalid AuthProvider type for ${param}; expected ${expected}`;
|
|
15
18
|
const ERR_AUTH_PROVIDER_NOT_NEEDED_FOR_CONTEXT_PARAM = (param) => `AuthProvider not necessary for context parameter: ${param}`;
|
|
19
|
+
const ERR_AUTO_INJECTED_CONTEXT_PARAM = (param) => `Context parameter ${param} is automatically injected and cannot be set manually`;
|
|
16
20
|
const EXPECTED_AUTH_PROVIDER_TYPES = {
|
|
17
21
|
[taco_auth_1.USER_ADDRESS_PARAM_DEFAULT]: [
|
|
18
22
|
taco_auth_1.EIP4361AuthProvider,
|
|
@@ -20,7 +24,14 @@ const EXPECTED_AUTH_PROVIDER_TYPES = {
|
|
|
20
24
|
taco_auth_1.SingleSignOnEIP4361AuthProvider,
|
|
21
25
|
],
|
|
22
26
|
};
|
|
23
|
-
exports.
|
|
27
|
+
exports.AUTOMATICALLY_INJECTED_CONTEXT_PARAMS = [
|
|
28
|
+
// These context parameters are automatically injected on the node side.
|
|
29
|
+
signing_1.SIGNING_CONDITION_OBJECT_CONTEXT_VAR,
|
|
30
|
+
];
|
|
31
|
+
exports.RESERVED_CONTEXT_PARAMS = [
|
|
32
|
+
taco_auth_1.USER_ADDRESS_PARAM_DEFAULT,
|
|
33
|
+
signing_1.SIGNING_CONDITION_OBJECT_CONTEXT_VAR,
|
|
34
|
+
];
|
|
24
35
|
class ConditionContext {
|
|
25
36
|
requestedContextParameters;
|
|
26
37
|
customContextParameters = {};
|
|
@@ -78,6 +89,9 @@ class ConditionContext {
|
|
|
78
89
|
if (!ConditionContext.isContextParameter(customParam)) {
|
|
79
90
|
throw new Error(ERR_INVALID_CUSTOM_PARAM(customParam));
|
|
80
91
|
}
|
|
92
|
+
if (exports.AUTOMATICALLY_INJECTED_CONTEXT_PARAMS.includes(customParam)) {
|
|
93
|
+
throw new Error(ERR_AUTO_INJECTED_CONTEXT_PARAM(customParam));
|
|
94
|
+
}
|
|
81
95
|
if (exports.RESERVED_CONTEXT_PARAMS.includes(customParam)) {
|
|
82
96
|
throw new Error(ERR_RESERVED_PARAM(customParam));
|
|
83
97
|
}
|
|
@@ -138,7 +152,9 @@ class ConditionContext {
|
|
|
138
152
|
const properties = Object.keys(condition);
|
|
139
153
|
properties.forEach((prop) => {
|
|
140
154
|
this.findContextParameter(condition[prop]).forEach((contextVar) => {
|
|
141
|
-
|
|
155
|
+
if (!exports.AUTOMATICALLY_INJECTED_CONTEXT_PARAMS.includes(contextVar)) {
|
|
156
|
+
requestedParameters.add(contextVar);
|
|
157
|
+
}
|
|
142
158
|
});
|
|
143
159
|
});
|
|
144
160
|
return requestedParameters;
|
|
@@ -177,6 +193,15 @@ class ConditionContext {
|
|
|
177
193
|
const conditionExpr = condition_expr_1.ConditionExpression.fromCoreConditions(messageKit.acp.conditions);
|
|
178
194
|
return new ConditionContext(conditionExpr.condition);
|
|
179
195
|
}
|
|
196
|
+
static async forSigningCohort(provider, domain, cohortId, chainId) {
|
|
197
|
+
// get signing condition from SigningCoordinator contract
|
|
198
|
+
const cohortConditionHex = await shared_1.SigningCoordinatorAgent.getSigningCohortConditions(provider, domain, cohortId, chainId);
|
|
199
|
+
// Convert hex string to UTF-8 JSON string
|
|
200
|
+
const cohortConditionJson = ethers_1.ethers.utils.toUtf8String(cohortConditionHex);
|
|
201
|
+
const cohortCondition = new types_1.CoreConditions(cohortConditionJson);
|
|
202
|
+
const conditionExpr = condition_expr_1.ConditionExpression.fromCoreConditions(cohortCondition);
|
|
203
|
+
return new ConditionContext(conditionExpr.condition);
|
|
204
|
+
}
|
|
180
205
|
}
|
|
181
206
|
exports.ConditionContext = ConditionContext;
|
|
182
207
|
//# sourceMappingURL=context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/conditions/context/context.ts"],"names":[],"mappings":";;;AACA,mDAO6B;
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/conditions/context/context.ts"],"names":[],"mappings":";;;AACA,6CAAmE;AACnE,mDAO6B;AAC7B,mCAAgC;AAEhC,uCAA0D;AAC1D,uCAAqC;AAErC,sDAAwD;AACxD,oCAKkB;AAClB,gDAA0E;AAU1E,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,8C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O,IAAI,gBAAgB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF;AA1OD,4CA0OC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const AddressAllowlistConditionType = "address-allowlist";
|
|
3
|
+
export declare const addressAllowlistConditionSchema: z.ZodObject<{} & {
|
|
4
|
+
conditionType: z.ZodLiteral<"address-allowlist">;
|
|
5
|
+
userAddress: z.ZodLiteral<":userAddress">;
|
|
6
|
+
addresses: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
|
|
7
|
+
}, "strict", z.ZodTypeAny, {
|
|
8
|
+
conditionType: "address-allowlist";
|
|
9
|
+
userAddress: ":userAddress";
|
|
10
|
+
addresses: string[];
|
|
11
|
+
}, {
|
|
12
|
+
conditionType: "address-allowlist";
|
|
13
|
+
userAddress: ":userAddress";
|
|
14
|
+
addresses: string[];
|
|
15
|
+
}>;
|
|
16
|
+
export type AddressAllowlistConditionProps = z.infer<typeof addressAllowlistConditionSchema>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addressAllowlistConditionSchema = exports.AddressAllowlistConditionType = void 0;
|
|
4
|
+
const shared_1 = require("@nucypher/shared");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const common_1 = require("./common");
|
|
7
|
+
exports.AddressAllowlistConditionType = 'address-allowlist';
|
|
8
|
+
exports.addressAllowlistConditionSchema = common_1.baseConditionSchema
|
|
9
|
+
.extend({
|
|
10
|
+
conditionType: zod_1.z.literal(exports.AddressAllowlistConditionType),
|
|
11
|
+
userAddress: common_1.UserAddressSchema,
|
|
12
|
+
addresses: zod_1.z
|
|
13
|
+
.array(shared_1.EthAddressSchemaStrict)
|
|
14
|
+
.min(1, 'At least one address must be provided')
|
|
15
|
+
.max(25, 'A maximum of 25 addresses is allowed')
|
|
16
|
+
.describe('List of wallet addresses allowed to decrypt. Addresses should be provided in checksummed form.'),
|
|
17
|
+
})
|
|
18
|
+
.strict()
|
|
19
|
+
.describe('Address Allowlist Condition for allowing decryption for specific wallet addresses. It is very handy when combined with other conditions.');
|
|
20
|
+
//# sourceMappingURL=address-allowlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"address-allowlist.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/address-allowlist.ts"],"names":[],"mappings":";;;AAAA,6CAA0D;AAC1D,6BAAwB;AAExB,qCAAkE;AAErD,QAAA,6BAA6B,GAAG,mBAAmB,CAAC;AAEpD,QAAA,+BAA+B,GAAG,4BAAmB;KAC/D,MAAM,CAAC;IACN,aAAa,EAAE,OAAC,CAAC,OAAO,CAAC,qCAA6B,CAAC;IACvD,WAAW,EAAE,0BAAiB;IAC9B,SAAS,EAAE,OAAC;SACT,KAAK,CAAC,+BAAsB,CAAC;SAC7B,GAAG,CAAC,CAAC,EAAE,uCAAuC,CAAC;SAC/C,GAAG,CAAC,EAAE,EAAE,sCAAsC,CAAC;SAC/C,QAAQ,CACP,gGAAgG,CACjG;CACJ,CAAC;KACD,MAAM,EAAE;KACR,QAAQ,CACP,0IAA0I,CAC3I,CAAC"}
|
|
@@ -11,4 +11,6 @@ export declare const baseConditionSchema: z.ZodObject<{
|
|
|
11
11
|
declare function createUnionSchema<T extends readonly Primitive[]>(values: T): z.ZodNever | z.ZodLiteral<Primitive> | z.ZodUnion<[z.ZodLiteral<Primitive>, z.ZodLiteral<Primitive>, ...z.ZodLiteral<Primitive>[]]>;
|
|
12
12
|
export default createUnionSchema;
|
|
13
13
|
export declare const jsonPathSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
14
|
+
export declare const jsonAuthorizationTypeSchema: z.ZodEnum<["Bearer", "Basic", "X-API-Key"]>;
|
|
14
15
|
export declare const httpsURLSchema: z.ZodEffects<z.ZodString, string, string>;
|
|
16
|
+
export declare const hexStringSchema: z.ZodString;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.httpsURLSchema = exports.jsonPathSchema = exports.baseConditionSchema = exports.UserAddressSchema = exports.plainStringSchema = void 0;
|
|
3
|
+
exports.hexStringSchema = exports.httpsURLSchema = exports.jsonAuthorizationTypeSchema = exports.jsonPathSchema = exports.baseConditionSchema = exports.UserAddressSchema = exports.plainStringSchema = void 0;
|
|
4
4
|
const jsonpath_1 = require("@astronautlabs/jsonpath");
|
|
5
5
|
const taco_auth_1 = require("@nucypher/taco-auth");
|
|
6
6
|
const zod_1 = require("zod");
|
|
@@ -19,7 +19,9 @@ exports.UserAddressSchema = zod_1.z
|
|
|
19
19
|
.literal(taco_auth_1.USER_ADDRESS_PARAM_DEFAULT)
|
|
20
20
|
.describe('This is a context variable that will be replaced at decryption time. It represents the Ethereum address of the requester attempting decryption.');
|
|
21
21
|
exports.baseConditionSchema = zod_1.z.object({
|
|
22
|
-
conditionType: zod_1.z
|
|
22
|
+
conditionType: zod_1.z
|
|
23
|
+
.string()
|
|
24
|
+
.describe('A unique identifier that indicates the condition variant in its serialized form. It is set automatically at every sub-class constructor when a new object is being created.'),
|
|
23
25
|
});
|
|
24
26
|
// Source: https://github.com/colinhacks/zod/issues/831#issuecomment-1063481764
|
|
25
27
|
const createUnion = (values) => {
|
|
@@ -57,8 +59,19 @@ exports.jsonPathSchema = zod_1.z
|
|
|
57
59
|
})
|
|
58
60
|
.describe('A string containing either a valid JSON Path Expression, or a Context Parameter.');
|
|
59
61
|
const validateHttpsURL = (url) => {
|
|
60
|
-
|
|
62
|
+
try {
|
|
63
|
+
const parsedUrl = new URL(url);
|
|
64
|
+
// Check if the URL is valid and uses HTTPS
|
|
65
|
+
return parsedUrl.protocol === 'https:';
|
|
66
|
+
}
|
|
67
|
+
catch (e) {
|
|
68
|
+
// If URL constructor throws, the URL is invalid
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
61
71
|
};
|
|
72
|
+
exports.jsonAuthorizationTypeSchema = zod_1.z
|
|
73
|
+
.enum(['Bearer', 'Basic', 'X-API-Key'])
|
|
74
|
+
.describe('The type of authorization to use when making the request.');
|
|
62
75
|
// Use our own URL refinement check due to https://github.com/colinhacks/zod/issues/2236
|
|
63
76
|
exports.httpsURLSchema = zod_1.z
|
|
64
77
|
.string()
|
|
@@ -66,4 +79,8 @@ exports.httpsURLSchema = zod_1.z
|
|
|
66
79
|
.refine((url) => validateHttpsURL(url), {
|
|
67
80
|
message: 'Invalid URL',
|
|
68
81
|
});
|
|
82
|
+
exports.hexStringSchema = zod_1.z
|
|
83
|
+
.string()
|
|
84
|
+
.regex(/^[0-9a-fA-F]+$/, 'Invalid hex string')
|
|
85
|
+
.describe('A string containing only hexadecimal characters (0-9, a-f, A-F)');
|
|
69
86
|
//# sourceMappingURL=common.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/common.ts"],"names":[],"mappings":";;;AAAA,sDAAmD;AACnD,mDAAiE;AACjE,6BAA+C;AAE/C,oCAAsE;AAEtE,kEAAkE;AAClE,mDAAmD;AACtC,QAAA,iBAAiB,GAAG,OAAC;KAC/B,MAAM,EAAE;KACR,MAAM,CACL,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;KACA,QAAQ,CACP,yEAAyE,4BAAoB,KAAK,CACnG,CAAC;AAES,QAAA,iBAAiB,GAAG,OAAC;KAC/B,OAAO,CAAC,sCAA0B,CAAC;KACnC,QAAQ,CACP,iJAAiJ,CAClJ,CAAC;AAES,QAAA,mBAAmB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC1C,aAAa,EAAE,OAAC,
|
|
1
|
+
{"version":3,"file":"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E;IACtC,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC;AAEQ,QAAA,eAAe,GAAG,OAAC;KAC7B,MAAM,EAAE;KACR,KAAK,CAAC,gBAAgB,EAAE,oBAAoB,CAAC;KAC7C,QAAQ,CAAC,iEAAiE,CAAC,CAAC"}
|
|
@@ -153,28 +153,31 @@ export declare const functionAbiSchema: z.ZodEffects<z.ZodEffects<z.ZodObject<{
|
|
|
153
153
|
}>;
|
|
154
154
|
export type FunctionAbiProps = z.infer<typeof functionAbiSchema>;
|
|
155
155
|
export declare const ContractConditionType = "contract";
|
|
156
|
-
export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<
|
|
157
|
-
conditionType: z.ZodString;
|
|
158
|
-
}, {
|
|
159
|
-
conditionType: z.ZodDefault<z.ZodLiteral<"rpc">>;
|
|
156
|
+
export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<{
|
|
160
157
|
chain: z.ZodNumber;
|
|
161
|
-
|
|
162
|
-
parameters: z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>, z.ZodUnion<[z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodEnum<["earliest", "finalized", "safe", "latest", "pending"]>]>, z.ZodString]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodEffects<z.ZodString, string, string>, z.ZodLiteral<":userAddress">, z.ZodString]>], null>]>;
|
|
163
|
-
returnValueTest: z.ZodObject<z.objectUtil.extendShape<{
|
|
158
|
+
returnValueTest: z.ZodEffects<z.ZodObject<{
|
|
164
159
|
index: z.ZodOptional<z.ZodNumber>;
|
|
165
|
-
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!="]>;
|
|
166
|
-
}
|
|
160
|
+
comparator: z.ZodEnum<["==", ">", "<", ">=", "<=", "!=", "in", "!in"]>;
|
|
161
|
+
} & {
|
|
167
162
|
value: z.ZodType<any, z.ZodTypeDef, any>;
|
|
168
|
-
}
|
|
169
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
163
|
+
}, "strip", z.ZodTypeAny, {
|
|
164
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
170
165
|
value?: any;
|
|
171
166
|
index?: number | undefined;
|
|
172
167
|
}, {
|
|
173
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
168
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
169
|
+
value?: any;
|
|
170
|
+
index?: number | undefined;
|
|
171
|
+
}>, {
|
|
172
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
173
|
+
value?: any;
|
|
174
|
+
index?: number | undefined;
|
|
175
|
+
}, {
|
|
176
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
174
177
|
value?: any;
|
|
175
178
|
index?: number | undefined;
|
|
176
179
|
}>;
|
|
177
|
-
}
|
|
180
|
+
} & {
|
|
178
181
|
conditionType: z.ZodDefault<z.ZodLiteral<"contract">>;
|
|
179
182
|
contractAddress: z.ZodEffects<z.ZodString, string, string>;
|
|
180
183
|
standardContractType: z.ZodOptional<z.ZodEnum<["ERC20", "ERC721"]>>;
|
|
@@ -319,17 +322,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectU
|
|
|
319
322
|
stateMutability: "view" | "pure";
|
|
320
323
|
}>>;
|
|
321
324
|
parameters: z.ZodArray<z.ZodType<any, z.ZodTypeDef, any>, "many">;
|
|
322
|
-
}
|
|
325
|
+
}, "strip", z.ZodTypeAny, {
|
|
323
326
|
conditionType: "contract";
|
|
324
|
-
chain: number;
|
|
325
327
|
method: string;
|
|
326
|
-
parameters: any[];
|
|
327
328
|
returnValueTest: {
|
|
328
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
329
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
329
330
|
value?: any;
|
|
330
331
|
index?: number | undefined;
|
|
331
332
|
};
|
|
333
|
+
parameters: any[];
|
|
334
|
+
chain: number;
|
|
332
335
|
contractAddress: string;
|
|
336
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
333
337
|
functionAbi?: {
|
|
334
338
|
type: "function";
|
|
335
339
|
name: string;
|
|
@@ -349,18 +353,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectU
|
|
|
349
353
|
}[]];
|
|
350
354
|
stateMutability: "view" | "pure";
|
|
351
355
|
} | undefined;
|
|
352
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
353
356
|
}, {
|
|
354
|
-
chain: number;
|
|
355
357
|
method: string;
|
|
356
|
-
parameters: any[];
|
|
357
358
|
returnValueTest: {
|
|
358
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
359
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
359
360
|
value?: any;
|
|
360
361
|
index?: number | undefined;
|
|
361
362
|
};
|
|
363
|
+
parameters: any[];
|
|
364
|
+
chain: number;
|
|
362
365
|
contractAddress: string;
|
|
363
366
|
conditionType?: "contract" | undefined;
|
|
367
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
364
368
|
functionAbi?: {
|
|
365
369
|
type: "function";
|
|
366
370
|
name: string;
|
|
@@ -380,18 +384,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectU
|
|
|
380
384
|
}[]];
|
|
381
385
|
stateMutability: "view" | "pure";
|
|
382
386
|
} | undefined;
|
|
383
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
384
387
|
}>, {
|
|
385
388
|
conditionType: "contract";
|
|
386
|
-
chain: number;
|
|
387
389
|
method: string;
|
|
388
|
-
parameters: any[];
|
|
389
390
|
returnValueTest: {
|
|
390
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
391
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
391
392
|
value?: any;
|
|
392
393
|
index?: number | undefined;
|
|
393
394
|
};
|
|
395
|
+
parameters: any[];
|
|
396
|
+
chain: number;
|
|
394
397
|
contractAddress: string;
|
|
398
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
395
399
|
functionAbi?: {
|
|
396
400
|
type: "function";
|
|
397
401
|
name: string;
|
|
@@ -411,18 +415,18 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectU
|
|
|
411
415
|
}[]];
|
|
412
416
|
stateMutability: "view" | "pure";
|
|
413
417
|
} | undefined;
|
|
414
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
415
418
|
}, {
|
|
416
|
-
chain: number;
|
|
417
419
|
method: string;
|
|
418
|
-
parameters: any[];
|
|
419
420
|
returnValueTest: {
|
|
420
|
-
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=";
|
|
421
|
+
comparator: "==" | ">" | "<" | ">=" | "<=" | "!=" | "in" | "!in";
|
|
421
422
|
value?: any;
|
|
422
423
|
index?: number | undefined;
|
|
423
424
|
};
|
|
425
|
+
parameters: any[];
|
|
426
|
+
chain: number;
|
|
424
427
|
contractAddress: string;
|
|
425
428
|
conditionType?: "contract" | undefined;
|
|
429
|
+
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
426
430
|
functionAbi?: {
|
|
427
431
|
type: "function";
|
|
428
432
|
name: string;
|
|
@@ -442,6 +446,5 @@ export declare const contractConditionSchema: z.ZodEffects<z.ZodObject<z.objectU
|
|
|
442
446
|
}[]];
|
|
443
447
|
stateMutability: "view" | "pure";
|
|
444
448
|
} | undefined;
|
|
445
|
-
standardContractType?: "ERC20" | "ERC721" | undefined;
|
|
446
449
|
}>;
|
|
447
450
|
export type ContractConditionProps = z.infer<typeof contractConditionSchema>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const ECDSA_MESSAGE_PARAM_DEFAULT = ":message";
|
|
3
|
+
export declare const ECDSA_SIGNATURE_PARAM_DEFAULT = ":signature";
|
|
4
|
+
export declare const ECDSAConditionType = "ecdsa";
|
|
5
|
+
export declare const SUPPORTED_ECDSA_CURVES: readonly ["SECP256k1", "NIST256p", "NIST384p", "NIST521p", "Ed25519", "BRAINPOOLP256r1"];
|
|
6
|
+
export type ECDSACurve = (typeof SUPPORTED_ECDSA_CURVES)[number];
|
|
7
|
+
export declare const ecdsaConditionSchema: z.ZodEffects<z.ZodObject<{} & {
|
|
8
|
+
conditionType: z.ZodDefault<z.ZodLiteral<"ecdsa">>;
|
|
9
|
+
message: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodString]>>;
|
|
10
|
+
signature: z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodString]>>;
|
|
11
|
+
verifyingKey: z.ZodString;
|
|
12
|
+
curve: z.ZodEnum<["SECP256k1", "NIST256p", "NIST384p", "NIST521p", "Ed25519", "BRAINPOOLP256r1"]>;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
message: string;
|
|
15
|
+
conditionType: "ecdsa";
|
|
16
|
+
signature: string;
|
|
17
|
+
verifyingKey: string;
|
|
18
|
+
curve: "SECP256k1" | "NIST256p" | "NIST384p" | "NIST521p" | "Ed25519" | "BRAINPOOLP256r1";
|
|
19
|
+
}, {
|
|
20
|
+
verifyingKey: string;
|
|
21
|
+
curve: "SECP256k1" | "NIST256p" | "NIST384p" | "NIST521p" | "Ed25519" | "BRAINPOOLP256r1";
|
|
22
|
+
message?: string | undefined;
|
|
23
|
+
conditionType?: "ecdsa" | undefined;
|
|
24
|
+
signature?: string | undefined;
|
|
25
|
+
}>, {
|
|
26
|
+
message: string;
|
|
27
|
+
conditionType: "ecdsa";
|
|
28
|
+
signature: string;
|
|
29
|
+
verifyingKey: string;
|
|
30
|
+
curve: "SECP256k1" | "NIST256p" | "NIST384p" | "NIST521p" | "Ed25519" | "BRAINPOOLP256r1";
|
|
31
|
+
}, {
|
|
32
|
+
verifyingKey: string;
|
|
33
|
+
curve: "SECP256k1" | "NIST256p" | "NIST384p" | "NIST521p" | "Ed25519" | "BRAINPOOLP256r1";
|
|
34
|
+
message?: string | undefined;
|
|
35
|
+
conditionType?: "ecdsa" | undefined;
|
|
36
|
+
signature?: string | undefined;
|
|
37
|
+
}>;
|
|
38
|
+
export type ECDSAConditionProps = z.infer<typeof ecdsaConditionSchema>;
|