opacity-issuer-core 0.2.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.
Files changed (43) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +44 -0
  3. package/dist/chunk-2STMWRIV.js +164 -0
  4. package/dist/chunk-2STMWRIV.js.map +1 -0
  5. package/dist/chunk-3L7NNVUV.cjs +184 -0
  6. package/dist/chunk-3L7NNVUV.cjs.map +1 -0
  7. package/dist/chunk-54Q3MU62.js +29 -0
  8. package/dist/chunk-54Q3MU62.js.map +1 -0
  9. package/dist/chunk-7ODYBEZH.js +889 -0
  10. package/dist/chunk-7ODYBEZH.js.map +1 -0
  11. package/dist/chunk-GMPQFX25.cjs +923 -0
  12. package/dist/chunk-GMPQFX25.cjs.map +1 -0
  13. package/dist/chunk-HJQZWNZJ.cjs +33 -0
  14. package/dist/chunk-HJQZWNZJ.cjs.map +1 -0
  15. package/dist/documents/index.cjs +170 -0
  16. package/dist/documents/index.cjs.map +1 -0
  17. package/dist/documents/index.d.cts +1370 -0
  18. package/dist/documents/index.d.ts +1370 -0
  19. package/dist/documents/index.js +5 -0
  20. package/dist/documents/index.js.map +1 -0
  21. package/dist/documents/validate.cjs +53 -0
  22. package/dist/documents/validate.cjs.map +1 -0
  23. package/dist/documents/validate.d.cts +70 -0
  24. package/dist/documents/validate.d.ts +70 -0
  25. package/dist/documents/validate.js +4 -0
  26. package/dist/documents/validate.js.map +1 -0
  27. package/dist/index.cjs +8917 -0
  28. package/dist/index.cjs.map +1 -0
  29. package/dist/index.d.cts +11088 -0
  30. package/dist/index.d.ts +11088 -0
  31. package/dist/index.js +8647 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/subgraph.cjs +891 -0
  34. package/dist/subgraph.cjs.map +1 -0
  35. package/dist/subgraph.d.cts +456 -0
  36. package/dist/subgraph.d.ts +456 -0
  37. package/dist/subgraph.js +882 -0
  38. package/dist/subgraph.js.map +1 -0
  39. package/dist/transport-0_X4HTI6.d.ts +39 -0
  40. package/dist/transport-uaC5Yl3p.d.cts +39 -0
  41. package/dist/types-B4Yi7WA4.d.cts +108 -0
  42. package/dist/types-B4Yi7WA4.d.ts +108 -0
  43. package/package.json +75 -0
@@ -0,0 +1,5 @@
1
+ export { SANDBOX_CHAIN_ID, SANDBOX_DEPLOYMENTS, SANDBOX_IMPLEMENTATION_VERSION, SANDBOX_TRAIT_IDS, SEPOLIA_CHAIN_ID, assertDocumentMatchesHash, buildAttestDocumentTransaction, buildDocumentAcceptanceTypedData, buildSandboxAddSelfTransaction, buildSandboxRegisterIssuerTransaction, buildSandboxSetSelfTraitTransaction, documentAttestorAbi, documentTraitId, getSandboxDeployment, hashDocument, hashDocumentAcceptance, probeSandboxRegistry, requireSandboxDeployment, sandboxAllowlistRegistryAbi, sandboxUserId, toEip1193Json, toEip1193TypedData, toEip712Json, toEip712JsonPayload, toEthersTypedData, toJsonRpcTransaction, toSandboxAddSelfWriteContractRequest, toSandboxRegisterIssuerWriteContractRequest, toSandboxSetSelfTraitWriteContractRequest, toViemTypedData, toWriteContractRequest, verifyAttestationSession } from '../chunk-7ODYBEZH.js';
2
+ export { DOCUMENT_ACCEPTANCE_PRIMARY_TYPE, DOCUMENT_ACCEPTANCE_TYPEHASH, DOCUMENT_ACCEPTANCE_TYPES, DOCUMENT_ATTESTOR_DOMAIN_NAME, DOCUMENT_ATTESTOR_DOMAIN_VERSION, ECDSA_SIGNATURE_BYTES, EIP712_DOMAIN_TYPE, MAX_ATTESTATION_LIFETIME_SECONDS } from '../chunk-2STMWRIV.js';
3
+ import '../chunk-54Q3MU62.js';
4
+ //# sourceMappingURL=index.js.map
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ var chunk3L7NNVUV_cjs = require('../chunk-3L7NNVUV.cjs');
4
+ require('../chunk-HJQZWNZJ.cjs');
5
+
6
+
7
+
8
+ Object.defineProperty(exports, "assertAddress", {
9
+ enumerable: true,
10
+ get: function () { return chunk3L7NNVUV_cjs.assertAddress; }
11
+ });
12
+ Object.defineProperty(exports, "assertBoolean", {
13
+ enumerable: true,
14
+ get: function () { return chunk3L7NNVUV_cjs.assertBoolean; }
15
+ });
16
+ Object.defineProperty(exports, "assertBytes32", {
17
+ enumerable: true,
18
+ get: function () { return chunk3L7NNVUV_cjs.assertBytes32; }
19
+ });
20
+ Object.defineProperty(exports, "assertChainId", {
21
+ enumerable: true,
22
+ get: function () { return chunk3L7NNVUV_cjs.assertChainId; }
23
+ });
24
+ Object.defineProperty(exports, "assertDocHash", {
25
+ enumerable: true,
26
+ get: function () { return chunk3L7NNVUV_cjs.assertDocHash; }
27
+ });
28
+ Object.defineProperty(exports, "assertNonce", {
29
+ enumerable: true,
30
+ get: function () { return chunk3L7NNVUV_cjs.assertNonce; }
31
+ });
32
+ Object.defineProperty(exports, "assertServerSignature", {
33
+ enumerable: true,
34
+ get: function () { return chunk3L7NNVUV_cjs.assertServerSignature; }
35
+ });
36
+ Object.defineProperty(exports, "assertSessionWindow", {
37
+ enumerable: true,
38
+ get: function () { return chunk3L7NNVUV_cjs.assertSessionWindow; }
39
+ });
40
+ Object.defineProperty(exports, "assertTimestamp", {
41
+ enumerable: true,
42
+ get: function () { return chunk3L7NNVUV_cjs.assertTimestamp; }
43
+ });
44
+ Object.defineProperty(exports, "assertTraitId", {
45
+ enumerable: true,
46
+ get: function () { return chunk3L7NNVUV_cjs.assertTraitId; }
47
+ });
48
+ Object.defineProperty(exports, "assertUserSignature", {
49
+ enumerable: true,
50
+ get: function () { return chunk3L7NNVUV_cjs.assertUserSignature; }
51
+ });
52
+ //# sourceMappingURL=validate.cjs.map
53
+ //# sourceMappingURL=validate.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"validate.cjs"}
@@ -0,0 +1,70 @@
1
+ import { Address, Hex } from 'viem';
2
+ import { C as ClockOptions } from '../types-B4Yi7WA4.cjs';
3
+
4
+ /**
5
+ * Normalises an address and rejects the zero address.
6
+ *
7
+ * Returns the checksummed form: `attestDocument` takes `wallet` as a plain `address`, so casing
8
+ * does not affect the calldata, but returning the canonical form keeps the descriptor comparable.
9
+ */
10
+ declare function assertAddress(value: Address, field: string): Address;
11
+ /**
12
+ * Rejects anything that is not 32 bytes of hex. Zero-ness is checked separately, per field.
13
+ *
14
+ * Length is checked on the string, not via `size()`, which rounds a half-byte up — `0x` followed
15
+ * by 63 hex chars has a `size()` of 32 but is not a valid `bytes32`.
16
+ */
17
+ declare function assertBytes32(value: Hex, field: string): Hex;
18
+ /**
19
+ * `traitId` must be non-zero — `InvalidTraitId`.
20
+ *
21
+ * A zero trait id is almost always an un-set config value rather than a real trait.
22
+ */
23
+ declare function assertTraitId(value: Hex): Hex;
24
+ /** Strict runtime boolean validation for callers that bypass TypeScript declarations. */
25
+ declare function assertBoolean(value: boolean, field: string): boolean;
26
+ /**
27
+ * `docHash` must be non-zero — `InvalidDocHash`.
28
+ *
29
+ * No executed document hashes to zero, so a zero here is a server-side bug and must not be attested.
30
+ */
31
+ declare function assertDocHash(value: Hex): Hex;
32
+ /**
33
+ * `nonce` must be well-formed, but may be zero.
34
+ *
35
+ * The contract applies no zero-check to the nonce — slot zero is burnable like any other — so
36
+ * rejecting it here would be stricter than the chain.
37
+ */
38
+ declare function assertNonce(value: Hex): Hex;
39
+ /** Rejects negative or non-`bigint` unix timestamps before they are encoded as `uint256`. */
40
+ declare function assertTimestamp(value: bigint, field: string): bigint;
41
+ /**
42
+ * The 65-byte rule for the SERVER signature only.
43
+ *
44
+ * `ECDSA.recover` accepts exactly one length and reverts `ECDSAInvalidSignatureLength` on any
45
+ * other. The investor signature must NOT be length-checked: `SignatureChecker` routes a
46
+ * code-bearing wallet (a Safe, or an EIP-7702-delegated EOA) to ERC-1271, where the signature is
47
+ * whatever that wallet's own validation logic accepts.
48
+ */
49
+ declare function assertServerSignature(value: Hex): Hex;
50
+ /**
51
+ * The investor signature: hex, any BYTE length — an ERC-1271 wallet is not 65 bytes.
52
+ *
53
+ * Only the half-byte case is rejected, since it cannot encode as `bytes`.
54
+ */
55
+ declare function assertUserSignature(value: Hex): Hex;
56
+ /**
57
+ * The session-lifetime rules, split by whether they need a clock.
58
+ *
59
+ * `deadline <= issuedAt + MAX_ATTESTATION_LIFETIME` is absolute and always checked. The two
60
+ * clock-relative rules run only when `now` is supplied — see {@link ClockOptions} for why that is
61
+ * opt-in.
62
+ */
63
+ declare function assertSessionWindow(session: {
64
+ issuedAt?: bigint | undefined;
65
+ deadline: bigint;
66
+ }, options?: ClockOptions): void;
67
+ /** Rejects a non-integer / out-of-range chain id before it lands in a signed domain. */
68
+ declare function assertChainId(value: number): number;
69
+
70
+ export { assertAddress, assertBoolean, assertBytes32, assertChainId, assertDocHash, assertNonce, assertServerSignature, assertSessionWindow, assertTimestamp, assertTraitId, assertUserSignature };
@@ -0,0 +1,70 @@
1
+ import { Address, Hex } from 'viem';
2
+ import { C as ClockOptions } from '../types-B4Yi7WA4.js';
3
+
4
+ /**
5
+ * Normalises an address and rejects the zero address.
6
+ *
7
+ * Returns the checksummed form: `attestDocument` takes `wallet` as a plain `address`, so casing
8
+ * does not affect the calldata, but returning the canonical form keeps the descriptor comparable.
9
+ */
10
+ declare function assertAddress(value: Address, field: string): Address;
11
+ /**
12
+ * Rejects anything that is not 32 bytes of hex. Zero-ness is checked separately, per field.
13
+ *
14
+ * Length is checked on the string, not via `size()`, which rounds a half-byte up — `0x` followed
15
+ * by 63 hex chars has a `size()` of 32 but is not a valid `bytes32`.
16
+ */
17
+ declare function assertBytes32(value: Hex, field: string): Hex;
18
+ /**
19
+ * `traitId` must be non-zero — `InvalidTraitId`.
20
+ *
21
+ * A zero trait id is almost always an un-set config value rather than a real trait.
22
+ */
23
+ declare function assertTraitId(value: Hex): Hex;
24
+ /** Strict runtime boolean validation for callers that bypass TypeScript declarations. */
25
+ declare function assertBoolean(value: boolean, field: string): boolean;
26
+ /**
27
+ * `docHash` must be non-zero — `InvalidDocHash`.
28
+ *
29
+ * No executed document hashes to zero, so a zero here is a server-side bug and must not be attested.
30
+ */
31
+ declare function assertDocHash(value: Hex): Hex;
32
+ /**
33
+ * `nonce` must be well-formed, but may be zero.
34
+ *
35
+ * The contract applies no zero-check to the nonce — slot zero is burnable like any other — so
36
+ * rejecting it here would be stricter than the chain.
37
+ */
38
+ declare function assertNonce(value: Hex): Hex;
39
+ /** Rejects negative or non-`bigint` unix timestamps before they are encoded as `uint256`. */
40
+ declare function assertTimestamp(value: bigint, field: string): bigint;
41
+ /**
42
+ * The 65-byte rule for the SERVER signature only.
43
+ *
44
+ * `ECDSA.recover` accepts exactly one length and reverts `ECDSAInvalidSignatureLength` on any
45
+ * other. The investor signature must NOT be length-checked: `SignatureChecker` routes a
46
+ * code-bearing wallet (a Safe, or an EIP-7702-delegated EOA) to ERC-1271, where the signature is
47
+ * whatever that wallet's own validation logic accepts.
48
+ */
49
+ declare function assertServerSignature(value: Hex): Hex;
50
+ /**
51
+ * The investor signature: hex, any BYTE length — an ERC-1271 wallet is not 65 bytes.
52
+ *
53
+ * Only the half-byte case is rejected, since it cannot encode as `bytes`.
54
+ */
55
+ declare function assertUserSignature(value: Hex): Hex;
56
+ /**
57
+ * The session-lifetime rules, split by whether they need a clock.
58
+ *
59
+ * `deadline <= issuedAt + MAX_ATTESTATION_LIFETIME` is absolute and always checked. The two
60
+ * clock-relative rules run only when `now` is supplied — see {@link ClockOptions} for why that is
61
+ * opt-in.
62
+ */
63
+ declare function assertSessionWindow(session: {
64
+ issuedAt?: bigint | undefined;
65
+ deadline: bigint;
66
+ }, options?: ClockOptions): void;
67
+ /** Rejects a non-integer / out-of-range chain id before it lands in a signed domain. */
68
+ declare function assertChainId(value: number): number;
69
+
70
+ export { assertAddress, assertBoolean, assertBytes32, assertChainId, assertDocHash, assertNonce, assertServerSignature, assertSessionWindow, assertTimestamp, assertTraitId, assertUserSignature };
@@ -0,0 +1,4 @@
1
+ export { assertAddress, assertBoolean, assertBytes32, assertChainId, assertDocHash, assertNonce, assertServerSignature, assertSessionWindow, assertTimestamp, assertTraitId, assertUserSignature } from '../chunk-2STMWRIV.js';
2
+ import '../chunk-54Q3MU62.js';
3
+ //# sourceMappingURL=validate.js.map
4
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"validate.js"}