@nucypher/taco 0.6.0-alpha.3 → 0.7.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/dist/cjs/conditions/base/address-allowlist.d.ts +10 -0
  2. package/dist/cjs/conditions/base/address-allowlist.js +19 -0
  3. package/dist/cjs/conditions/base/address-allowlist.js.map +1 -0
  4. package/dist/cjs/conditions/base/index.d.ts +2 -0
  5. package/dist/cjs/conditions/base/index.js +3 -1
  6. package/dist/cjs/conditions/base/index.js.map +1 -1
  7. package/dist/cjs/conditions/base/signing.d.ts +10 -0
  8. package/dist/cjs/conditions/base/signing.js +32 -0
  9. package/dist/cjs/conditions/base/signing.js.map +1 -0
  10. package/dist/cjs/conditions/condition-factory.js +8 -0
  11. package/dist/cjs/conditions/condition-factory.js.map +1 -1
  12. package/dist/cjs/conditions/context/context.d.ts +4 -0
  13. package/dist/cjs/conditions/context/context.js +28 -3
  14. package/dist/cjs/conditions/context/context.js.map +1 -1
  15. package/dist/cjs/conditions/schemas/address-allowlist.d.ts +16 -0
  16. package/dist/cjs/conditions/schemas/address-allowlist.js +20 -0
  17. package/dist/cjs/conditions/schemas/address-allowlist.js.map +1 -0
  18. package/dist/cjs/conditions/schemas/common.d.ts +1 -0
  19. package/dist/cjs/conditions/schemas/common.js +16 -3
  20. package/dist/cjs/conditions/schemas/common.js.map +1 -1
  21. package/dist/cjs/conditions/schemas/contract.d.ts +21 -18
  22. package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.d.ts +2 -0
  23. package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js +3 -0
  24. package/dist/cjs/conditions/schemas/export-for-zod-doc-gen.js.map +1 -1
  25. package/dist/cjs/conditions/schemas/json-api.d.ts +47 -14
  26. package/dist/cjs/conditions/schemas/json-api.js +16 -2
  27. package/dist/cjs/conditions/schemas/json-api.js.map +1 -1
  28. package/dist/cjs/conditions/schemas/json-rpc.d.ts +48 -13
  29. package/dist/cjs/conditions/schemas/json-rpc.js +16 -2
  30. package/dist/cjs/conditions/schemas/json-rpc.js.map +1 -1
  31. package/dist/cjs/conditions/schemas/jwt.d.ts +2 -4
  32. package/dist/cjs/conditions/schemas/return-value-test.d.ts +28 -12
  33. package/dist/cjs/conditions/schemas/return-value-test.js +19 -5
  34. package/dist/cjs/conditions/schemas/return-value-test.js.map +1 -1
  35. package/dist/cjs/conditions/schemas/rpc.d.ts +18 -12
  36. package/dist/cjs/conditions/schemas/signing.d.ts +12 -0
  37. package/dist/cjs/conditions/schemas/signing.js +204 -0
  38. package/dist/cjs/conditions/schemas/signing.js.map +1 -0
  39. package/dist/cjs/conditions/schemas/time.d.ts +16 -8
  40. package/dist/cjs/conditions/schemas/utils.js +6 -1
  41. package/dist/cjs/conditions/schemas/utils.js.map +1 -1
  42. package/dist/cjs/index.d.ts +1 -0
  43. package/dist/cjs/index.js +3 -1
  44. package/dist/cjs/index.js.map +1 -1
  45. package/dist/cjs/sign.d.ts +24 -0
  46. package/dist/cjs/sign.js +88 -0
  47. package/dist/cjs/sign.js.map +1 -0
  48. package/dist/cjs/types.d.ts +1 -0
  49. package/dist/es/conditions/base/address-allowlist.d.ts +10 -0
  50. package/dist/es/conditions/base/address-allowlist.js +15 -0
  51. package/dist/es/conditions/base/address-allowlist.js.map +1 -0
  52. package/dist/es/conditions/base/index.d.ts +2 -0
  53. package/dist/es/conditions/base/index.js +2 -0
  54. package/dist/es/conditions/base/index.js.map +1 -1
  55. package/dist/es/conditions/base/signing.d.ts +10 -0
  56. package/dist/es/conditions/base/signing.js +20 -0
  57. package/dist/es/conditions/base/signing.js.map +1 -0
  58. package/dist/es/conditions/condition-factory.js +8 -0
  59. package/dist/es/conditions/condition-factory.js.map +1 -1
  60. package/dist/es/conditions/context/context.d.ts +4 -0
  61. package/dist/es/conditions/context/context.js +27 -2
  62. package/dist/es/conditions/context/context.js.map +1 -1
  63. package/dist/es/conditions/schemas/address-allowlist.d.ts +16 -0
  64. package/dist/es/conditions/schemas/address-allowlist.js +17 -0
  65. package/dist/es/conditions/schemas/address-allowlist.js.map +1 -0
  66. package/dist/es/conditions/schemas/common.d.ts +1 -0
  67. package/dist/es/conditions/schemas/common.js +15 -2
  68. package/dist/es/conditions/schemas/common.js.map +1 -1
  69. package/dist/es/conditions/schemas/contract.d.ts +21 -18
  70. package/dist/es/conditions/schemas/export-for-zod-doc-gen.d.ts +2 -0
  71. package/dist/es/conditions/schemas/export-for-zod-doc-gen.js +3 -0
  72. package/dist/es/conditions/schemas/export-for-zod-doc-gen.js.map +1 -1
  73. package/dist/es/conditions/schemas/json-api.d.ts +47 -14
  74. package/dist/es/conditions/schemas/json-api.js +17 -3
  75. package/dist/es/conditions/schemas/json-api.js.map +1 -1
  76. package/dist/es/conditions/schemas/json-rpc.d.ts +48 -13
  77. package/dist/es/conditions/schemas/json-rpc.js +17 -3
  78. package/dist/es/conditions/schemas/json-rpc.js.map +1 -1
  79. package/dist/es/conditions/schemas/jwt.d.ts +2 -4
  80. package/dist/es/conditions/schemas/return-value-test.d.ts +28 -12
  81. package/dist/es/conditions/schemas/return-value-test.js +19 -5
  82. package/dist/es/conditions/schemas/return-value-test.js.map +1 -1
  83. package/dist/es/conditions/schemas/rpc.d.ts +18 -12
  84. package/dist/es/conditions/schemas/signing.d.ts +12 -0
  85. package/dist/es/conditions/schemas/signing.js +201 -0
  86. package/dist/es/conditions/schemas/signing.js.map +1 -0
  87. package/dist/es/conditions/schemas/time.d.ts +16 -8
  88. package/dist/es/conditions/schemas/utils.js +6 -1
  89. package/dist/es/conditions/schemas/utils.js.map +1 -1
  90. package/dist/es/index.d.ts +1 -0
  91. package/dist/es/index.js +1 -0
  92. package/dist/es/index.js.map +1 -1
  93. package/dist/es/sign.d.ts +24 -0
  94. package/dist/es/sign.js +85 -0
  95. package/dist/es/sign.js.map +1 -0
  96. package/dist/es/types.d.ts +1 -0
  97. package/dist/tsconfig.cjs.tsbuildinfo +1 -1
  98. package/dist/tsconfig.es.tsbuildinfo +1 -1
  99. package/package.json +5 -4
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.anyConditionSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const compound_condition_1 = require("../compound-condition");
6
+ const address_allowlist_1 = require("./address-allowlist");
6
7
  const contract_1 = require("./contract");
7
8
  const if_then_else_1 = require("./if-then-else");
8
9
  const json_api_1 = require("./json-api");
@@ -10,15 +11,19 @@ const json_rpc_1 = require("./json-rpc");
10
11
  const jwt_1 = require("./jwt");
11
12
  const rpc_1 = require("./rpc");
12
13
  const sequential_1 = require("./sequential");
14
+ const signing_1 = require("./signing");
13
15
  const time_1 = require("./time");
14
16
  exports.anyConditionSchema = zod_1.z.lazy(() => zod_1.z.union([
15
17
  rpc_1.rpcConditionSchema,
16
18
  time_1.timeConditionSchema,
19
+ address_allowlist_1.addressAllowlistConditionSchema,
17
20
  contract_1.contractConditionSchema,
18
- compound_condition_1.compoundConditionSchema,
19
21
  json_api_1.jsonApiConditionSchema,
20
22
  json_rpc_1.jsonRpcConditionSchema,
21
23
  jwt_1.jwtConditionSchema,
24
+ signing_1.signingObjectAttributeConditionSchema,
25
+ signing_1.signingObjectAbiAttributeConditionSchema,
26
+ compound_condition_1.compoundConditionSchema,
22
27
  sequential_1.sequentialConditionSchema,
23
28
  if_then_else_1.ifThenElseConditionSchema,
24
29
  ]));
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/utils.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,8DAAgE;AAEhE,yCAAqD;AACrD,iDAA2D;AAC3D,yCAAoD;AACpD,yCAAoD;AACpD,+BAA2C;AAC3C,+BAA2C;AAC3C,6CAAyD;AACzD,iCAA6C;AAEhC,QAAA,kBAAkB,GAAgB,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACzD,OAAC,CAAC,KAAK,CAAC;IACN,wBAAkB;IAClB,0BAAmB;IACnB,kCAAuB;IACvB,4CAAuB;IACvB,iCAAsB;IACtB,iCAAsB;IACtB,wBAAkB;IAClB,sCAAyB;IACzB,wCAAyB;CAC1B,CAAC,CACH,CAAC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/utils.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,8DAAgE;AAEhE,2DAAsE;AACtE,yCAAqD;AACrD,iDAA2D;AAC3D,yCAAoD;AACpD,yCAAoD;AACpD,+BAA2C;AAC3C,+BAA2C;AAC3C,6CAAyD;AACzD,uCAGmB;AACnB,iCAA6C;AAEhC,QAAA,kBAAkB,GAAgB,OAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CACzD,OAAC,CAAC,KAAK,CAAC;IACN,wBAAkB;IAClB,0BAAmB;IACnB,mDAA+B;IAC/B,kCAAuB;IACvB,iCAAsB;IACtB,iCAAsB;IACtB,wBAAkB;IAClB,+CAAqC;IACrC,kDAAwC;IACxC,4CAAuB;IACvB,sCAAyB;IACzB,wCAAyB;CAC1B,CAAC,CACH,CAAC"}
@@ -1,4 +1,5 @@
1
1
  export { DkgPublicKey, ThresholdMessageKit } from '@nucypher/nucypher-core';
2
2
  export { Domain, domains, fromBytes, getPorterUris, initialize, toBytes, toHexString, } from '@nucypher/shared';
3
3
  export * as conditions from './conditions';
4
+ export { signUserOp } from './sign';
4
5
  export { decrypt, encrypt, encryptWithPublicKey } from './taco';
package/dist/cjs/index.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- 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;
36
+ exports.encryptWithPublicKey = exports.encrypt = exports.decrypt = exports.signUserOp = exports.conditions = exports.toHexString = exports.toBytes = exports.initialize = exports.getPorterUris = exports.fromBytes = exports.domains = exports.ThresholdMessageKit = exports.DkgPublicKey = void 0;
37
37
  var nucypher_core_1 = require("@nucypher/nucypher-core");
38
38
  Object.defineProperty(exports, "DkgPublicKey", { enumerable: true, get: function () { return nucypher_core_1.DkgPublicKey; } });
39
39
  Object.defineProperty(exports, "ThresholdMessageKit", { enumerable: true, get: function () { return nucypher_core_1.ThresholdMessageKit; } });
@@ -45,6 +45,8 @@ Object.defineProperty(exports, "initialize", { enumerable: true, get: function (
45
45
  Object.defineProperty(exports, "toBytes", { enumerable: true, get: function () { return shared_1.toBytes; } });
46
46
  Object.defineProperty(exports, "toHexString", { enumerable: true, get: function () { return shared_1.toHexString; } });
47
47
  exports.conditions = __importStar(require("./conditions"));
48
+ var sign_1 = require("./sign");
49
+ Object.defineProperty(exports, "signUserOp", { enumerable: true, get: function () { return sign_1.signUserOp; } });
48
50
  var taco_1 = require("./taco");
49
51
  Object.defineProperty(exports, "decrypt", { enumerable: true, get: function () { return taco_1.decrypt; } });
50
52
  Object.defineProperty(exports, "encrypt", { enumerable: true, get: function () { return taco_1.encrypt; } });
@@ -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,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"}
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,+BAAoC;AAA3B,kGAAA,UAAU,OAAA;AACnB,+BAAgE;AAAvD,+FAAA,OAAO,OAAA;AAAE,+FAAA,OAAO,OAAA;AAAE,4GAAA,oBAAoB,OAAA"}
@@ -0,0 +1,24 @@
1
+ import { Domain, TacoSignature, UserOperation } from '@nucypher/shared';
2
+ import { ethers } from 'ethers';
3
+ import { ConditionContext } from './conditions/context';
4
+ export type SignResult = {
5
+ messageHash: string;
6
+ aggregatedSignature: string;
7
+ signingResults: {
8
+ [ursulaAddress: string]: TacoSignature;
9
+ };
10
+ };
11
+ /**
12
+ * Signs a UserOperation.
13
+ * @param provider - The Ethereum provider to use for signing.
14
+ * @param domain - The TACo domain being used.
15
+ * @param cohortId - The cohort ID that identifies the signing cohort.
16
+ * @param chainId - The chain ID for the signing operation.
17
+ * @param userOp - The UserOperation to be signed.
18
+ * @param aaVersion - The AA version of the account abstraction to use for signing.
19
+ * @param context - Optional condition context for the context variable resolution.
20
+ * @param porterUris - Optional URIs for the Porter service. If not provided, will fetch the default URIs from the domain.
21
+ * @returns A promise that resolves to a SignResult containing the message hash, aggregated signature, and signing results from the Porter service.
22
+ * @throws An error if the signing process fails due to insufficient signatures or mismatched hashes.
23
+ */
24
+ export declare function signUserOp(provider: ethers.providers.Provider, domain: Domain, cohortId: number, chainId: number, userOp: UserOperation, aaVersion: 'mdt' | '0.8.0' | string, context?: ConditionContext, porterUris?: string[]): Promise<SignResult>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.signUserOp = signUserOp;
4
+ const shared_1 = require("@nucypher/shared");
5
+ const ERR_INSUFFICIENT_SIGNATURES = (errors) => `Threshold of signatures not met; TACo signing failed with errors: ${JSON.stringify(errors)}`;
6
+ const ERR_MISMATCHED_HASHES = (hashToSignatures) => `Threshold of signatures not met; multiple mismatched hashes found: ${JSON.stringify(Object.fromEntries(hashToSignatures.entries()))}`;
7
+ function aggregateSignatures(signaturesByAddress, threshold) {
8
+ // Aggregate hex signatures by concatenating them; being careful to remove the '0x' prefix from each signature except the first one.
9
+ const signatures = Object.values(signaturesByAddress)
10
+ .map((sig) => sig.signature)
11
+ .slice(0, threshold);
12
+ if (signatures.length === 1) {
13
+ return signatures[0];
14
+ }
15
+ // Concatenate signatures
16
+ const allBytes = signatures.flatMap((hex) => Array.from((0, shared_1.fromHexString)(hex)));
17
+ return `0x${(0, shared_1.toHexString)(new Uint8Array(allBytes))}`;
18
+ }
19
+ /**
20
+ * Signs a UserOperation.
21
+ * @param provider - The Ethereum provider to use for signing.
22
+ * @param domain - The TACo domain being used.
23
+ * @param cohortId - The cohort ID that identifies the signing cohort.
24
+ * @param chainId - The chain ID for the signing operation.
25
+ * @param userOp - The UserOperation to be signed.
26
+ * @param aaVersion - The AA version of the account abstraction to use for signing.
27
+ * @param context - Optional condition context for the context variable resolution.
28
+ * @param porterUris - Optional URIs for the Porter service. If not provided, will fetch the default URIs from the domain.
29
+ * @returns A promise that resolves to a SignResult containing the message hash, aggregated signature, and signing results from the Porter service.
30
+ * @throws An error if the signing process fails due to insufficient signatures or mismatched hashes.
31
+ */
32
+ async function signUserOp(provider, domain, cohortId, chainId, userOp, aaVersion, context, porterUris) {
33
+ const porterUrisFull = porterUris
34
+ ? porterUris
35
+ : await (0, shared_1.getPorterUris)(domain);
36
+ const porter = new shared_1.PorterClient(porterUrisFull);
37
+ const signers = await shared_1.SigningCoordinatorAgent.getParticipants(provider, domain, cohortId);
38
+ const threshold = await shared_1.SigningCoordinatorAgent.getThreshold(provider, domain, cohortId);
39
+ const pythonUserOp = (0, shared_1.convertUserOperationToPython)(userOp);
40
+ const signingRequest = new shared_1.UserOperationSignatureRequest(pythonUserOp, aaVersion, cohortId, chainId, context || {}, 'userop');
41
+ const signingRequests = Object.fromEntries(signers.map((signer) => [
42
+ signer.provider,
43
+ (0, shared_1.toBase64)(signingRequest.toBytes()),
44
+ ]));
45
+ // Build signing request for the user operation
46
+ const porterSignResult = await porter.signUserOp(signingRequests, threshold);
47
+ const hashToSignatures = new Map();
48
+ // Single pass: decode signatures and populate signingResults
49
+ for (const [ursulaAddress, signature] of Object.entries(porterSignResult.signingResults)) {
50
+ // For non-optimistic: track hashes and group signatures for aggregation
51
+ const hash = signature.messageHash;
52
+ if (!hashToSignatures.has(hash)) {
53
+ hashToSignatures.set(hash, {});
54
+ }
55
+ hashToSignatures.get(hash)[ursulaAddress] = signature;
56
+ }
57
+ let messageHash = undefined;
58
+ let signaturesToAggregate = undefined;
59
+ for (const [hash, signatures] of hashToSignatures.entries()) {
60
+ if (Object.keys(signatures).length >= threshold) {
61
+ signaturesToAggregate = signatures;
62
+ messageHash = hash;
63
+ break;
64
+ }
65
+ }
66
+ // Insufficient signatures for a message hash to meet the threshold
67
+ if (!messageHash || !signaturesToAggregate) {
68
+ if (hashToSignatures.size > 1 &&
69
+ Object.keys(porterSignResult.errors).length < signers.length - threshold) {
70
+ // Two things are true:
71
+ // 1. we have multiple hashes, which means we have mismatched hashes from different nodes
72
+ // we don't really expect this to happen (other than some malicious nodes)
73
+ // 2. number of errors still could have allowed for a threshold of signatures
74
+ console.error('Porter returned mismatched message hashes:', hashToSignatures);
75
+ throw new Error(ERR_MISMATCHED_HASHES(hashToSignatures));
76
+ }
77
+ else {
78
+ throw new Error(ERR_INSUFFICIENT_SIGNATURES(porterSignResult.errors));
79
+ }
80
+ }
81
+ const aggregatedSignature = aggregateSignatures(signaturesToAggregate, threshold);
82
+ return {
83
+ messageHash,
84
+ aggregatedSignature,
85
+ signingResults: porterSignResult.signingResults,
86
+ };
87
+ }
88
+ //# sourceMappingURL=sign.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sign.js","sourceRoot":"","sources":["../../src/sign.ts"],"names":[],"mappings":";;AAkEA,gCA4GC;AA9KD,6CAa0B;AAK1B,MAAM,2BAA2B,GAAG,CAAC,MAAe,EAAE,EAAE,CACtD,qEAAqE,IAAI,CAAC,SAAS,CACjF,MAAM,CACP,EAAE,CAAC;AACN,MAAM,qBAAqB,GAAG,CAC5B,gBAAyE,EACzE,EAAE,CACF,sEAAsE,IAAI,CAAC,SAAS,CAClF,MAAM,CAAC,WAAW,CAAC,gBAAgB,CAAC,OAAO,EAAE,CAAC,CAC/C,EAAE,CAAC;AAQN,SAAS,mBAAmB,CAC1B,mBAEC,EACD,SAAiB;IAEjB,oIAAoI;IACpI,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,mBAAmB,CAAC;SAClD,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,CAAC;SAC3B,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC;IACvB,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,UAAU,CAAC,CAAC,CAAC,CAAC;IACvB,CAAC;IACD,yBAAyB;IACzB,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAA,sBAAa,EAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAC7E,OAAO,KAAK,IAAA,oBAAW,EAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC;AACtD,CAAC;AAED;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,UAAU,CAC9B,QAAmC,EACnC,MAAc,EACd,QAAgB,EAChB,OAAe,EACf,MAAqB,EACrB,SAAmC,EACnC,OAA0B,EAC1B,UAA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{ Conditions as CoreConditions, Context as CoreContext, } from '@nucypher/nucypher-core';
2
+ export type { UserOperation } from '@nucypher/shared';
@@ -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,15 @@
1
+ import { Condition } from '../condition';
2
+ import { addressAllowlistConditionSchema, AddressAllowlistConditionType, } from '../schemas/address-allowlist';
3
+ export { AddressAllowlistConditionType };
4
+ /**
5
+ * A condition that checks if a wallet address is in a list of allowed addresses.
6
+ */
7
+ export class AddressAllowlistCondition extends Condition {
8
+ constructor(value) {
9
+ super(addressAllowlistConditionSchema, {
10
+ conditionType: AddressAllowlistConditionType,
11
+ ...value,
12
+ });
13
+ }
14
+ }
15
+ //# 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,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAEL,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAkC,6BAA6B,EAAE,CAAC;AAEzE;;GAEG;AACH,MAAM,OAAO,yBAA0B,SAAQ,SAAS;IACtD,YAAY,KAAwD;QAClE,KAAK,CAAC,+BAA+B,EAAE;YACrC,aAAa,EAAE,6BAA6B;YAC5C,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,6 +1,8 @@
1
+ export * as addressAllowlist from './address-allowlist';
1
2
  export * as contract from './contract';
2
3
  export * as jsonApi from './json-api';
3
4
  export * as jsonRpc from './json-rpc';
4
5
  export * as jwt from './jwt';
5
6
  export * as rpc from './rpc';
7
+ export * as signing from './signing';
6
8
  export * as time from './time';
@@ -1,9 +1,11 @@
1
1
  // Exporting classes here instead of their respective schema files to
2
2
  // avoid circular dependency on Condition class.
3
+ export * as addressAllowlist from './address-allowlist';
3
4
  export * as contract from './contract';
4
5
  export * as jsonApi from './json-api';
5
6
  export * as jsonRpc from './json-rpc';
6
7
  export * as jwt from './jwt';
7
8
  export * as rpc from './rpc';
9
+ export * as signing from './signing';
8
10
  export * as time from './time';
9
11
  //# 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,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/conditions/base/index.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,gDAAgD;AAEhD,OAAO,KAAK,gBAAgB,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,QAAQ,CAAC"}
@@ -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,20 @@
1
+ import { Condition } from '../condition';
2
+ import { signingObjectAbiAttributeConditionSchema, SigningObjectAbiAttributeConditionType, signingObjectAttributeConditionSchema, SigningObjectAttributeConditionType, } from '../schemas/signing';
3
+ export { abiCallValidationSchema, abiParameterValidationSchema, SIGNING_CONDITION_OBJECT_CONTEXT_VAR, signingObjectAbiAttributeConditionSchema, SigningObjectAbiAttributeConditionType, signingObjectAttributeConditionSchema, SigningObjectAttributeConditionType, } from '../schemas/signing';
4
+ export class SigningObjectAttributeCondition extends Condition {
5
+ constructor(value) {
6
+ super(signingObjectAttributeConditionSchema, {
7
+ conditionType: SigningObjectAttributeConditionType,
8
+ ...value,
9
+ });
10
+ }
11
+ }
12
+ export class SigningObjectAbiAttributeCondition extends Condition {
13
+ constructor(value) {
14
+ super(signingObjectAbiAttributeConditionSchema, {
15
+ conditionType: SigningObjectAbiAttributeConditionType,
16
+ ...value,
17
+ });
18
+ }
19
+ }
20
+ //# sourceMappingURL=signing.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing.js","sourceRoot":"","sources":["../../../../src/conditions/base/signing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAEL,wCAAwC,EACxC,sCAAsC,EAEtC,qCAAqC,EACrC,mCAAmC,GACpC,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAEL,uBAAuB,EAEvB,4BAA4B,EAC5B,oCAAoC,EAEpC,wCAAwC,EACxC,sCAAsC,EAEtC,qCAAqC,EACrC,mCAAmC,GACpC,MAAM,oBAAoB,CAAC;AAE5B,MAAM,OAAO,+BAAgC,SAAQ,SAAS;IAC5D,YAAY,KAA8D;QACxE,KAAK,CAAC,qCAAqC,EAAE;YAC3C,aAAa,EAAE,mCAAmC;YAClD,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF;AAED,MAAM,OAAO,kCAAmC,SAAQ,SAAS;IAC/D,YACE,KAAiE;QAEjE,KAAK,CAAC,wCAAwC,EAAE;YAC9C,aAAa,EAAE,sCAAsC;YACrD,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,8 +1,10 @@
1
+ import { AddressAllowlistCondition, AddressAllowlistConditionType, } from './base/address-allowlist';
1
2
  import { ContractCondition, ContractConditionType, } from './base/contract';
2
3
  import { JsonApiCondition, JsonApiConditionType, } from './base/json-api';
3
4
  import { JsonRpcCondition, JsonRpcConditionType, } from './base/json-rpc';
4
5
  import { JWTCondition, JWTConditionType } from './base/jwt';
5
6
  import { RpcCondition, RpcConditionType } from './base/rpc';
7
+ import { SigningObjectAbiAttributeCondition, SigningObjectAbiAttributeConditionType, SigningObjectAttributeCondition, SigningObjectAttributeConditionType, } from './base/signing';
6
8
  import { TimeCondition, TimeConditionType, } from './base/time';
7
9
  import { CompoundCondition, CompoundConditionType, } from './compound-condition';
8
10
  import { IfThenElseCondition, IfThenElseConditionType, } from './if-then-else-condition';
@@ -24,6 +26,12 @@ export class ConditionFactory {
24
26
  return new JsonRpcCondition(props);
25
27
  case JWTConditionType:
26
28
  return new JWTCondition(props);
29
+ case AddressAllowlistConditionType:
30
+ return new AddressAllowlistCondition(props);
31
+ case SigningObjectAttributeConditionType:
32
+ return new SigningObjectAttributeCondition(props);
33
+ case SigningObjectAbiAttributeConditionType:
34
+ return new SigningObjectAbiAttributeCondition(props);
27
35
  // Logical Conditions
28
36
  case CompoundConditionType:
29
37
  return new CompoundCondition(props);
@@ -1 +1 @@
1
- {"version":3,"file":"condition-factory.js","sourceRoot":"","sources":["../../../src/conditions/condition-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAEjB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAqB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAqB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EACL,aAAa,EAEb,iBAAiB,GAClB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,iBAAiB,EAEjB,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,mBAAmB,EAEnB,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,mBAAmB,EAEnB,uBAAuB,GACxB,MAAM,cAAc,CAAC;AAEtB,MAAM,0BAA0B,GAAG,CAAC,IAAY,EAAE,EAAE,CAClD,2BAA2B,IAAI,EAAE,CAAC;AAEpC,MAAM,OAAO,gBAAgB;IACpB,MAAM,CAAC,kBAAkB,CAAC,KAAqB;QACpD,QAAQ,KAAK,CAAC,aAAa,EAAE,CAAC;YAC5B,kBAAkB;YAClB,KAAK,gBAAgB;gBACnB,OAAO,IAAI,YAAY,CAAC,KAA0B,CAAC,CAAC;YACtD,KAAK,iBAAiB;gBACpB,OAAO,IAAI,aAAa,CAAC,KAA2B,CAAC,CAAC;YACxD,KAAK,qBAAqB;gBACxB,OAAO,IAAI,iBAAiB,CAAC,KAA+B,CAAC,CAAC;YAChE,KAAK,oBAAoB;gBACvB,OAAO,IAAI,gBAAgB,CAAC,KAA8B,CAAC,CAAC;YAC9D,KAAK,oBAAoB;gBACvB,OAAO,IAAI,gBAAgB,CAAC,KAA8B,CAAC,CAAC;YAC9D,KAAK,gBAAgB;gBACnB,OAAO,IAAI,YAAY,CAAC,KAA0B,CAAC,CAAC;YACtD,qBAAqB;YACrB,KAAK,qBAAqB;gBACxB,OAAO,IAAI,iBAAiB,CAAC,KAA+B,CAAC,CAAC;YAChE,KAAK,uBAAuB;gBAC1B,OAAO,IAAI,mBAAmB,CAAC,KAAiC,CAAC,CAAC;YACpE,KAAK,uBAAuB;gBAC1B,OAAO,IAAI,mBAAmB,CAAC,KAAiC,CAAC,CAAC;YACpE;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;CACF"}
1
+ {"version":3,"file":"condition-factory.js","sourceRoot":"","sources":["../../../src/conditions/condition-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yBAAyB,EAEzB,6BAA6B,GAC9B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,iBAAiB,EAEjB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAEhB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAqB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAqB,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/E,OAAO,EACL,kCAAkC,EAElC,sCAAsC,EACtC,+BAA+B,EAE/B,mCAAmC,GACpC,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,CAAC;YAChE,KAAK,uBAAuB;gBAC1B,OAAO,IAAI,mBAAmB,CAAC,KAAiC,CAAC,CAAC;YACpE,KAAK,uBAAuB;gBAC1B,OAAO,IAAI,mBAAmB,CAAC,KAAiC,CAAC,CAAC;YACpE;gBACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC;QACrE,CAAC;IACH,CAAC;CACF"}
@@ -1,9 +1,12 @@
1
1
  import { ThresholdMessageKit } from '@nucypher/nucypher-core';
2
+ import { Domain } from '@nucypher/shared';
2
3
  import { AuthProvider, AuthSignature } from '@nucypher/taco-auth';
4
+ import { ethers } from 'ethers';
3
5
  import { CoreContext } from '../../types';
4
6
  import { Condition } from '../condition';
5
7
  export type CustomContextParam = string | number | boolean | bigint | Uint8Array;
6
8
  export type ContextParam = CustomContextParam | AuthSignature;
9
+ export declare const AUTOMATICALLY_INJECTED_CONTEXT_PARAMS: string[];
7
10
  export declare const RESERVED_CONTEXT_PARAMS: string[];
8
11
  export declare class ConditionContext {
9
12
  requestedContextParameters: Set<string>;
@@ -25,4 +28,5 @@ export declare class ConditionContext {
25
28
  toCoreContext(): Promise<CoreContext>;
26
29
  toContextParameters: () => Promise<Record<string, ContextParam>>;
27
30
  static fromMessageKit(messageKit: ThresholdMessageKit): ConditionContext;
31
+ static forSigningCohort(provider: ethers.providers.JsonRpcProvider, domain: Domain, cohortId: number, chainId: number): Promise<ConditionContext>;
28
32
  }
@@ -1,8 +1,11 @@
1
+ import { SigningCoordinatorAgent } from '@nucypher/shared';
1
2
  import { EIP1271AuthProvider, EIP4361AuthProvider, SingleSignOnEIP4361AuthProvider, USER_ADDRESS_PARAM_DEFAULT, } from '@nucypher/taco-auth';
3
+ import { ethers } from 'ethers';
2
4
  import { CoreConditions, CoreContext } from '../../types';
3
5
  import { toJSON } from '../../utils';
4
6
  import { ConditionExpression } from '../condition-expr';
5
7
  import { CONTEXT_PARAM_FULL_MATCH_REGEXP, CONTEXT_PARAM_PREFIX, CONTEXT_PARAM_REGEXP, USER_ADDRESS_PARAMS, } from '../const';
8
+ import { SIGNING_CONDITION_OBJECT_CONTEXT_VAR } from '../schemas/signing';
6
9
  const ERR_RESERVED_PARAM = (key) => `Cannot use reserved parameter name ${key} as custom parameter`;
7
10
  const ERR_INVALID_CUSTOM_PARAM = (key) => `Custom parameter ${key} must start with ${CONTEXT_PARAM_PREFIX}`;
8
11
  const ERR_AUTH_PROVIDER_REQUIRED = (key) => `No matching authentication provider to satisfy ${key} context variable in condition`;
@@ -10,6 +13,7 @@ const ERR_MISSING_CONTEXT_PARAMS = (params) => `Missing custom context parameter
10
13
  const ERR_UNKNOWN_CUSTOM_CONTEXT_PARAM = (param) => `Unknown custom context parameter: ${param}`;
11
14
  const ERR_INVALID_AUTH_PROVIDER_TYPE = (param, expected) => `Invalid AuthProvider type for ${param}; expected ${expected}`;
12
15
  const ERR_AUTH_PROVIDER_NOT_NEEDED_FOR_CONTEXT_PARAM = (param) => `AuthProvider not necessary for context parameter: ${param}`;
16
+ const ERR_AUTO_INJECTED_CONTEXT_PARAM = (param) => `Context parameter ${param} is automatically injected and cannot be set manually`;
13
17
  const EXPECTED_AUTH_PROVIDER_TYPES = {
14
18
  [USER_ADDRESS_PARAM_DEFAULT]: [
15
19
  EIP4361AuthProvider,
@@ -17,7 +21,14 @@ const EXPECTED_AUTH_PROVIDER_TYPES = {
17
21
  SingleSignOnEIP4361AuthProvider,
18
22
  ],
19
23
  };
20
- export const RESERVED_CONTEXT_PARAMS = [USER_ADDRESS_PARAM_DEFAULT];
24
+ export const AUTOMATICALLY_INJECTED_CONTEXT_PARAMS = [
25
+ // These context parameters are automatically injected on the node side.
26
+ SIGNING_CONDITION_OBJECT_CONTEXT_VAR,
27
+ ];
28
+ export const RESERVED_CONTEXT_PARAMS = [
29
+ USER_ADDRESS_PARAM_DEFAULT,
30
+ SIGNING_CONDITION_OBJECT_CONTEXT_VAR,
31
+ ];
21
32
  export class ConditionContext {
22
33
  requestedContextParameters;
23
34
  customContextParameters = {};
@@ -75,6 +86,9 @@ export class ConditionContext {
75
86
  if (!ConditionContext.isContextParameter(customParam)) {
76
87
  throw new Error(ERR_INVALID_CUSTOM_PARAM(customParam));
77
88
  }
89
+ if (AUTOMATICALLY_INJECTED_CONTEXT_PARAMS.includes(customParam)) {
90
+ throw new Error(ERR_AUTO_INJECTED_CONTEXT_PARAM(customParam));
91
+ }
78
92
  if (RESERVED_CONTEXT_PARAMS.includes(customParam)) {
79
93
  throw new Error(ERR_RESERVED_PARAM(customParam));
80
94
  }
@@ -135,7 +149,9 @@ export class ConditionContext {
135
149
  const properties = Object.keys(condition);
136
150
  properties.forEach((prop) => {
137
151
  this.findContextParameter(condition[prop]).forEach((contextVar) => {
138
- requestedParameters.add(contextVar);
152
+ if (!AUTOMATICALLY_INJECTED_CONTEXT_PARAMS.includes(contextVar)) {
153
+ requestedParameters.add(contextVar);
154
+ }
139
155
  });
140
156
  });
141
157
  return requestedParameters;
@@ -174,5 +190,14 @@ export class ConditionContext {
174
190
  const conditionExpr = ConditionExpression.fromCoreConditions(messageKit.acp.conditions);
175
191
  return new ConditionContext(conditionExpr.condition);
176
192
  }
193
+ static async forSigningCohort(provider, domain, cohortId, chainId) {
194
+ // get signing condition from SigningCoordinator contract
195
+ const cohortConditionHex = await SigningCoordinatorAgent.getSigningCohortConditions(provider, domain, cohortId, chainId);
196
+ // Convert hex string to UTF-8 JSON string
197
+ const cohortConditionJson = ethers.utils.toUtf8String(cohortConditionHex);
198
+ const cohortCondition = new CoreConditions(cohortConditionJson);
199
+ const conditionExpr = ConditionExpression.fromCoreConditions(cohortCondition);
200
+ return new ConditionContext(conditionExpr.condition);
201
+ }
177
202
  }
178
203
  //# sourceMappingURL=context.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"context.js","sourceRoot":"","sources":["../../../../src/conditions/context/context.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,mBAAmB,EACnB,mBAAmB,EACnB,+BAA+B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AAC;QAC1D,OAAO,IAAI,gBAAgB,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;CACF"}
@@ -0,0 +1,16 @@
1
+ import { z } from 'zod';
2
+ export declare const AddressAllowlistConditionType = "address-allowlist";
3
+ export declare const addressAllowlistConditionSchema: z.ZodObject<{} & {
4
+ conditionType: z.ZodLiteral<"address-allowlist">;
5
+ userAddress: z.ZodLiteral<":userAddress">;
6
+ addresses: z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">;
7
+ }, "strict", z.ZodTypeAny, {
8
+ conditionType: "address-allowlist";
9
+ userAddress: ":userAddress";
10
+ addresses: string[];
11
+ }, {
12
+ conditionType: "address-allowlist";
13
+ userAddress: ":userAddress";
14
+ addresses: string[];
15
+ }>;
16
+ export type AddressAllowlistConditionProps = z.infer<typeof addressAllowlistConditionSchema>;
@@ -0,0 +1,17 @@
1
+ import { EthAddressSchemaStrict } from '@nucypher/shared';
2
+ import { z } from 'zod';
3
+ import { baseConditionSchema, UserAddressSchema } from './common';
4
+ export const AddressAllowlistConditionType = 'address-allowlist';
5
+ export const addressAllowlistConditionSchema = baseConditionSchema
6
+ .extend({
7
+ conditionType: z.literal(AddressAllowlistConditionType),
8
+ userAddress: UserAddressSchema,
9
+ addresses: z
10
+ .array(EthAddressSchemaStrict)
11
+ .min(1, 'At least one address must be provided')
12
+ .max(25, 'A maximum of 25 addresses is allowed')
13
+ .describe('List of wallet addresses allowed to decrypt. Addresses should be provided in checksummed form.'),
14
+ })
15
+ .strict()
16
+ .describe('Address Allowlist Condition for allowing decryption for specific wallet addresses. It is very handy when combined with other conditions.');
17
+ //# sourceMappingURL=address-allowlist.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"address-allowlist.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/address-allowlist.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAElE,MAAM,CAAC,MAAM,6BAA6B,GAAG,mBAAmB,CAAC;AAEjE,MAAM,CAAC,MAAM,+BAA+B,GAAG,mBAAmB;KAC/D,MAAM,CAAC;IACN,aAAa,EAAE,CAAC,CAAC,OAAO,CAAC,6BAA6B,CAAC;IACvD,WAAW,EAAE,iBAAiB;IAC9B,SAAS,EAAE,CAAC;SACT,KAAK,CAAC,sBAAsB,CAAC;SAC7B,GAAG,CAAC,CAAC,EAAE,uCAAuC,CAAC;SAC/C,GAAG,CAAC,EAAE,EAAE,sCAAsC,CAAC;SAC/C,QAAQ,CACP,gGAAgG,CACjG;CACJ,CAAC;KACD,MAAM,EAAE;KACR,QAAQ,CACP,0IAA0I,CAC3I,CAAC"}
@@ -11,4 +11,5 @@ 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,7 +16,9 @@ export const UserAddressSchema = z
16
16
  .literal(USER_ADDRESS_PARAM_DEFAULT)
17
17
  .describe('This is a context variable that will be replaced at decryption time. It represents the Ethereum address of the requester attempting decryption.');
18
18
  export const baseConditionSchema = z.object({
19
- conditionType: z.string(),
19
+ conditionType: z
20
+ .string()
21
+ .describe('A unique identifier that indicates the condition variant in its serialized form. It is set automatically at every sub-class constructor when a new object is being created.'),
20
22
  });
21
23
  // Source: https://github.com/colinhacks/zod/issues/831#issuecomment-1063481764
22
24
  const createUnion = (values) => {
@@ -54,8 +56,19 @@ export const jsonPathSchema = z
54
56
  })
55
57
  .describe('A string containing either a valid JSON Path Expression, or a Context Parameter.');
56
58
  const validateHttpsURL = (url) => {
57
- return URL.canParse(url) && url.startsWith('https://');
59
+ try {
60
+ const parsedUrl = new URL(url);
61
+ // Check if the URL is valid and uses HTTPS
62
+ return parsedUrl.protocol === 'https:';
63
+ }
64
+ catch (e) {
65
+ // If URL constructor throws, the URL is invalid
66
+ return false;
67
+ }
58
68
  };
69
+ export const jsonAuthorizationTypeSchema = z
70
+ .enum(['Bearer', 'Basic', 'X-API-Key'])
71
+ .describe('The type of authorization to use when making the request.');
59
72
  // Use our own URL refinement check due to https://github.com/colinhacks/zod/issues/2236
60
73
  export const httpsURLSchema = z
61
74
  .string()
@@ -1 +1 @@
1
- {"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/conditions/schemas/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AACjE,OAAO,EAAa,CAAC,EAAc,MAAM,KAAK,CAAC;AAE/C,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAEtE,kEAAkE;AAClE,mDAAmD;AACnD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,MAAM,EAAE;KACR,MAAM,CACL,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,CACF;KACA,QAAQ,CACP,yEAAyE,oBAAoB,KAAK,CACnG,CAAC;AAEJ,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC;KAC/B,OAAO,CAAC,0BAA0B,CAAC;KACnC,QAAQ,CACP,iJAAiJ,CAClJ,C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