@forestrie/receipt-verify 0.1.1 → 0.3.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.
@@ -0,0 +1,4 @@
1
+ /** SCITT transparent statement unprotected receipt label (grants.md §3.2). */
2
+ export declare const HEADER_RECEIPT = 396;
3
+ export declare function attachReceiptAndIdtimestampToTransparentStatement(statementBytes: Uint8Array, receiptCborBytes: Uint8Array, idtimestampBe8: Uint8Array): Uint8Array;
4
+ //# sourceMappingURL=attach-transparent-statement-receipt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"attach-transparent-statement-receipt.d.ts","sourceRoot":"","sources":["../src/attach-transparent-statement-receipt.ts"],"names":[],"mappings":"AAWA,8EAA8E;AAC9E,eAAO,MAAM,cAAc,MAAM,CAAC;AAElC,wBAAgB,iDAAiD,CAC/D,cAAc,EAAE,UAAU,EAC1B,gBAAgB,EAAE,UAAU,EAC5B,cAAc,EAAE,UAAU,GACzB,UAAU,CAWZ"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Attach resolve-receipt bytes and idtimestamp to SCITT transparent statement
3
+ * unprotected headers (Plan 0005). Deterministic receipt construction moved
4
+ * from @forestrie/canopy-e2e-kit (plan-2607-12 Phase 2, FOR-353).
5
+ *
6
+ * Golden vectors for receipt construction/verification are tracked by
7
+ * FOR-289.
8
+ */
9
+ import { mergeUnprotectedIntoCoseSign1 } from "@forestrie/encoding";
10
+ import { HEADER_IDTIMESTAMP } from "./forest-genesis-labels.js";
11
+ /** SCITT transparent statement unprotected receipt label (grants.md §3.2). */
12
+ export const HEADER_RECEIPT = 396;
13
+ export function attachReceiptAndIdtimestampToTransparentStatement(statementBytes, receiptCborBytes, idtimestampBe8) {
14
+ if (idtimestampBe8.length !== 8) {
15
+ throw new Error("idtimestamp must be 8 bytes (big-endian)");
16
+ }
17
+ return mergeUnprotectedIntoCoseSign1(statementBytes, new Map([
18
+ [HEADER_RECEIPT, receiptCborBytes],
19
+ [HEADER_IDTIMESTAMP, idtimestampBe8],
20
+ ]));
21
+ }
@@ -1,4 +1,4 @@
1
- import type { Grant } from "./grant.js";
1
+ import type { Grant } from "@forestrie/encoding";
2
2
  /**
3
3
  * Decode Forestrie-Grant COSE Sign1 (Custodian transparent statement profile).
4
4
  */
@@ -1 +1 @@
1
- {"version":3,"file":"decode-forestrie-grant-cose.d.ts","sourceRoot":"","sources":["../src/decode-forestrie-grant-cose.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAmCxC;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,UAAU,GAAG;IAC3D,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,UAAU,CAAC;CAC5B,CAmCA"}
1
+ {"version":3,"file":"decode-forestrie-grant-cose.d.ts","sourceRoot":"","sources":["../src/decode-forestrie-grant-cose.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAmCjD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,UAAU,GAAG;IAC3D,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,UAAU,CAAC;CAC5B,CAmCA"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Decode permanent SCRAPI entryId (32 hex chars = idtimestamp_be8 ||
3
+ * mmrIndex_be8). Deterministic receipt helpers moved from
4
+ * @forestrie/canopy-e2e-kit (plan-2607-12 Phase 2, FOR-353).
5
+ */
6
+ export interface DecodedEntryId {
7
+ idtimestamp: bigint;
8
+ mmrIndex: bigint;
9
+ }
10
+ export declare function decodeEntryIdHex(entryIdHex: string): DecodedEntryId;
11
+ /** First half of entryId (permanent URL): idtimestamp big-endian 8 bytes for header -65537. */
12
+ export declare function entryIdHexToIdtimestampBe8(entryIdHex: string): Uint8Array;
13
+ //# sourceMappingURL=entry-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entry-id.d.ts","sourceRoot":"","sources":["../src/entry-id.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAkBD,wBAAgB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,cAAc,CAUnE;AAED,+FAA+F;AAC/F,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,MAAM,GAAG,UAAU,CAKzE"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Decode permanent SCRAPI entryId (32 hex chars = idtimestamp_be8 ||
3
+ * mmrIndex_be8). Deterministic receipt helpers moved from
4
+ * @forestrie/canopy-e2e-kit (plan-2607-12 Phase 2, FOR-353).
5
+ */
6
+ function readU64BE(buf, offset) {
7
+ let v = 0n;
8
+ for (let i = 0; i < 8; i++) {
9
+ v = (v << 8n) | BigInt(buf[offset + i]);
10
+ }
11
+ return v;
12
+ }
13
+ function hexToBytes(hex) {
14
+ const out = new Uint8Array(hex.length / 2);
15
+ for (let i = 0; i < out.length; i++) {
16
+ out[i] = Number.parseInt(hex.slice(i * 2, i * 2 + 2), 16);
17
+ }
18
+ return out;
19
+ }
20
+ export function decodeEntryIdHex(entryIdHex) {
21
+ if (!/^[0-9a-f]{32}$/i.test(entryIdHex)) {
22
+ throw new Error(`entryId must be 32 lowercase hex chars: ${entryIdHex}`);
23
+ }
24
+ const lower = entryIdHex.toLowerCase();
25
+ const bytes = hexToBytes(lower);
26
+ return {
27
+ idtimestamp: readU64BE(bytes, 0),
28
+ mmrIndex: readU64BE(bytes, 8),
29
+ };
30
+ }
31
+ /** First half of entryId (permanent URL): idtimestamp big-endian 8 bytes for header -65537. */
32
+ export function entryIdHexToIdtimestampBe8(entryIdHex) {
33
+ const { idtimestamp } = decodeEntryIdHex(entryIdHex);
34
+ const out = new Uint8Array(8);
35
+ new DataView(out.buffer).setBigUint64(0, idtimestamp, false);
36
+ return out;
37
+ }
@@ -1,4 +1,4 @@
1
- import type { Grant } from "./grant.js";
1
+ import type { Grant } from "@forestrie/encoding";
2
2
  export declare function decodeGrantPayload(bytes: Uint8Array): Grant;
3
3
  export declare function decodeGrantResponse(bytes: Uint8Array): {
4
4
  grant: Grant;
@@ -1 +1 @@
1
- {"version":3,"file":"grant-codec.d.ts","sourceRoot":"","sources":["../src/grant-codec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAuDxC,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAO3D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG;IACtD,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,UAAU,CAAC;CACzB,CAsBA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAa3D"}
1
+ {"version":3,"file":"grant-codec.d.ts","sourceRoot":"","sources":["../src/grant-codec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAuDjD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,KAAK,CAO3D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG;IACtD,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,UAAU,CAAC;CACzB,CAsBA;AAED,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,GAAG,UAAU,CAa3D"}
@@ -1,5 +1,5 @@
1
1
  import { decode as decodeCbor, encode as encodeCbor } from "cbor-x";
2
- import { grantDataToBytes } from "./grant-data.js";
2
+ import { grantDataToBytes } from "@forestrie/encoding";
3
3
  import { fromPaddedWire32, toPaddedWire32 } from "./uuid-bytes.js";
4
4
  const CBOR_KEY_IDTIMESTAMP = 0;
5
5
  const CBOR_KEY_LOG_ID = 1;
@@ -1,3 +1,3 @@
1
- import type { Grant } from "./grant.js";
1
+ import type { Grant } from "@forestrie/encoding";
2
2
  export declare function grantCommitmentHashFromGrant(grant: Grant): Promise<Uint8Array>;
3
3
  //# sourceMappingURL=grant-commitment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"grant-commitment.d.ts","sourceRoot":"","sources":["../src/grant-commitment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAwDxC,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,UAAU,CAAC,CAIrB"}
1
+ {"version":3,"file":"grant-commitment.d.ts","sourceRoot":"","sources":["../src/grant-commitment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAwDjD,wBAAsB,4BAA4B,CAChD,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,UAAU,CAAC,CAIrB"}
@@ -1,4 +1,4 @@
1
- import { grantDataToBytes } from "./grant-data.js";
1
+ import { grantDataToBytes } from "@forestrie/encoding";
2
2
  import { toPaddedWire32 } from "./uuid-bytes.js";
3
3
  const GRANT_FLAGS_32_BYTES = 32;
4
4
  const U64_BYTES = 8;
package/dist/index.d.ts CHANGED
@@ -1,9 +1,14 @@
1
1
  export type { ReceiptVerifyResult, ReceiptVerifyStage, } from "./receipt-verify-result.js";
2
- export type { Grant } from "./grant.js";
2
+ /** Canonical grant wire type owned by @forestrie/encoding (FOR-353, ADR-0048). */
3
+ export type { Grant } from "@forestrie/encoding";
3
4
  export type { VerifyGrantReceiptOfflineInput } from "./verify-grant-receipt-offline.js";
4
5
  export { parseReceipt } from "./parse-receipt.js";
5
6
  export { decodeTrustRootFromGenesis } from "./decode-trust-root-from-genesis.js";
6
7
  export { verifyGrantReceiptOffline } from "./verify-grant-receipt-offline.js";
7
8
  export { decodeForestrieGrantCose } from "./decode-forestrie-grant-cose.js";
8
9
  export { decodeGrantPayload, decodeGrantResponse } from "./grant-codec.js";
10
+ /** Deterministic receipt construction (plan-2607-12 Phase 2, FOR-353). */
11
+ export { HEADER_RECEIPT, attachReceiptAndIdtimestampToTransparentStatement, } from "./attach-transparent-statement-receipt.js";
12
+ export { decodeEntryIdHex, entryIdHexToIdtimestampBe8 } from "./entry-id.js";
13
+ export type { DecodedEntryId } from "./entry-id.js";
9
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AACpC,YAAY,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,4BAA4B,CAAC;AACpC,oFAAoF;AACpF,YAAY,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AACjD,YAAY,EAAE,8BAA8B,EAAE,MAAM,mCAAmC,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAE3E,0EAA0E;AAC1E,OAAO,EACL,cAAc,EACd,iDAAiD,GAClD,MAAM,2CAA2C,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAC7E,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -3,3 +3,6 @@ export { decodeTrustRootFromGenesis } from "./decode-trust-root-from-genesis.js"
3
3
  export { verifyGrantReceiptOffline } from "./verify-grant-receipt-offline.js";
4
4
  export { decodeForestrieGrantCose } from "./decode-forestrie-grant-cose.js";
5
5
  export { decodeGrantPayload, decodeGrantResponse } from "./grant-codec.js";
6
+ /** Deterministic receipt construction (plan-2607-12 Phase 2, FOR-353). */
7
+ export { HEADER_RECEIPT, attachReceiptAndIdtimestampToTransparentStatement, } from "./attach-transparent-statement-receipt.js";
8
+ export { decodeEntryIdHex, entryIdHexToIdtimestampBe8 } from "./entry-id.js";
@@ -1,4 +1,4 @@
1
- import type { Grant } from "./grant.js";
1
+ import type { Grant } from "@forestrie/encoding";
2
2
  import type { ReceiptVerifyResult } from "./receipt-verify-result.js";
3
3
  export type VerifyGrantReceiptOfflineInput = {
4
4
  genesisCbor: Uint8Array;
@@ -1 +1 @@
1
- {"version":3,"file":"verify-grant-receipt-offline.d.ts","sourceRoot":"","sources":["../src/verify-grant-receipt-offline.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAMxC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,MAAM,MAAM,8BAA8B,GAAG;IAC3C,WAAW,EAAE,UAAU,CAAC;IACxB,WAAW,EAAE,UAAU,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,UAAU,CAAC;CAC5B,CAAC;AA4EF;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,mBAAmB,CAAC,CA2C9B"}
1
+ {"version":3,"file":"verify-grant-receipt-offline.d.ts","sourceRoot":"","sources":["../src/verify-grant-receipt-offline.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAMjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGtE,MAAM,MAAM,8BAA8B,GAAG;IAC3C,WAAW,EAAE,UAAU,CAAC;IACxB,WAAW,EAAE,UAAU,CAAC;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,cAAc,EAAE,UAAU,CAAC;CAC5B,CAAC;AA4EF;;GAEG;AACH,wBAAsB,yBAAyB,CAC7C,KAAK,EAAE,8BAA8B,GACpC,OAAO,CAAC,mBAAmB,CAAC,CA2C9B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forestrie/receipt-verify",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "Offline SCITT grant receipt verification (ADR-0045)",
@@ -29,17 +29,19 @@
29
29
  "dependencies": {
30
30
  "@noble/hashes": "^1.7.1",
31
31
  "cbor-x": "^1.5.9",
32
- "@forestrie/encoding": "0.0.2",
33
- "@forestrie/merklelog": "0.0.2"
32
+ "@forestrie/encoding": "0.1.0",
33
+ "@forestrie/merklelog": "0.0.3"
34
34
  },
35
35
  "devDependencies": {
36
+ "esbuild": "^0.24.0",
36
37
  "typescript": "^5.9.2",
37
38
  "vitest": "^3.2.4"
38
39
  },
39
40
  "scripts": {
40
41
  "build": "tsc -p tsconfig.build.json",
41
42
  "typecheck": "tsc --noEmit",
42
- "test": "vitest --run",
43
+ "check:browser-safe": "node tools/check-browser-safe.mjs",
44
+ "test": "pnpm run check:browser-safe && vitest --run",
43
45
  "test:watch": "vitest"
44
46
  }
45
47
  }
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Attach resolve-receipt bytes and idtimestamp to SCITT transparent statement
3
+ * unprotected headers (Plan 0005). Deterministic receipt construction moved
4
+ * from @forestrie/canopy-e2e-kit (plan-2607-12 Phase 2, FOR-353).
5
+ *
6
+ * Golden vectors for receipt construction/verification are tracked by
7
+ * FOR-289.
8
+ */
9
+ import { mergeUnprotectedIntoCoseSign1 } from "@forestrie/encoding";
10
+ import { HEADER_IDTIMESTAMP } from "./forest-genesis-labels.js";
11
+
12
+ /** SCITT transparent statement unprotected receipt label (grants.md §3.2). */
13
+ export const HEADER_RECEIPT = 396;
14
+
15
+ export function attachReceiptAndIdtimestampToTransparentStatement(
16
+ statementBytes: Uint8Array,
17
+ receiptCborBytes: Uint8Array,
18
+ idtimestampBe8: Uint8Array,
19
+ ): Uint8Array {
20
+ if (idtimestampBe8.length !== 8) {
21
+ throw new Error("idtimestamp must be 8 bytes (big-endian)");
22
+ }
23
+ return mergeUnprotectedIntoCoseSign1(
24
+ statementBytes,
25
+ new Map<number, unknown>([
26
+ [HEADER_RECEIPT, receiptCborBytes],
27
+ [HEADER_IDTIMESTAMP, idtimestampBe8],
28
+ ]),
29
+ );
30
+ }
@@ -1,6 +1,6 @@
1
1
  import { sha256 } from "@noble/hashes/sha256";
2
2
  import { decode as decodeCbor } from "cbor-x";
3
- import type { Grant } from "./grant.js";
3
+ import type { Grant } from "@forestrie/encoding";
4
4
  import {
5
5
  HEADER_FORESTRIE_GRANT_V0,
6
6
  HEADER_IDTIMESTAMP,
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Decode permanent SCRAPI entryId (32 hex chars = idtimestamp_be8 ||
3
+ * mmrIndex_be8). Deterministic receipt helpers moved from
4
+ * @forestrie/canopy-e2e-kit (plan-2607-12 Phase 2, FOR-353).
5
+ */
6
+
7
+ export interface DecodedEntryId {
8
+ idtimestamp: bigint;
9
+ mmrIndex: bigint;
10
+ }
11
+
12
+ function readU64BE(buf: Uint8Array, offset: number): bigint {
13
+ let v = 0n;
14
+ for (let i = 0; i < 8; i++) {
15
+ v = (v << 8n) | BigInt(buf[offset + i]!);
16
+ }
17
+ return v;
18
+ }
19
+
20
+ function hexToBytes(hex: string): Uint8Array {
21
+ const out = new Uint8Array(hex.length / 2);
22
+ for (let i = 0; i < out.length; i++) {
23
+ out[i] = Number.parseInt(hex.slice(i * 2, i * 2 + 2), 16);
24
+ }
25
+ return out;
26
+ }
27
+
28
+ export function decodeEntryIdHex(entryIdHex: string): DecodedEntryId {
29
+ if (!/^[0-9a-f]{32}$/i.test(entryIdHex)) {
30
+ throw new Error(`entryId must be 32 lowercase hex chars: ${entryIdHex}`);
31
+ }
32
+ const lower = entryIdHex.toLowerCase();
33
+ const bytes = hexToBytes(lower);
34
+ return {
35
+ idtimestamp: readU64BE(bytes, 0),
36
+ mmrIndex: readU64BE(bytes, 8),
37
+ };
38
+ }
39
+
40
+ /** First half of entryId (permanent URL): idtimestamp big-endian 8 bytes for header -65537. */
41
+ export function entryIdHexToIdtimestampBe8(entryIdHex: string): Uint8Array {
42
+ const { idtimestamp } = decodeEntryIdHex(entryIdHex);
43
+ const out = new Uint8Array(8);
44
+ new DataView(out.buffer).setBigUint64(0, idtimestamp, false);
45
+ return out;
46
+ }
@@ -1,6 +1,6 @@
1
1
  import { decode as decodeCbor, encode as encodeCbor } from "cbor-x";
2
- import type { Grant } from "./grant.js";
3
- import { grantDataToBytes } from "./grant-data.js";
2
+ import type { Grant } from "@forestrie/encoding";
3
+ import { grantDataToBytes } from "@forestrie/encoding";
4
4
  import { fromPaddedWire32, toPaddedWire32 } from "./uuid-bytes.js";
5
5
 
6
6
  const CBOR_KEY_IDTIMESTAMP = 0;
@@ -1,5 +1,5 @@
1
- import { grantDataToBytes } from "./grant-data.js";
2
- import type { Grant } from "./grant.js";
1
+ import { grantDataToBytes } from "@forestrie/encoding";
2
+ import type { Grant } from "@forestrie/encoding";
3
3
  import { toPaddedWire32 } from "./uuid-bytes.js";
4
4
 
5
5
  const GRANT_FLAGS_32_BYTES = 32;
package/src/index.ts CHANGED
@@ -2,10 +2,19 @@ export type {
2
2
  ReceiptVerifyResult,
3
3
  ReceiptVerifyStage,
4
4
  } from "./receipt-verify-result.js";
5
- export type { Grant } from "./grant.js";
5
+ /** Canonical grant wire type owned by @forestrie/encoding (FOR-353, ADR-0048). */
6
+ export type { Grant } from "@forestrie/encoding";
6
7
  export type { VerifyGrantReceiptOfflineInput } from "./verify-grant-receipt-offline.js";
7
8
  export { parseReceipt } from "./parse-receipt.js";
8
9
  export { decodeTrustRootFromGenesis } from "./decode-trust-root-from-genesis.js";
9
10
  export { verifyGrantReceiptOffline } from "./verify-grant-receipt-offline.js";
10
11
  export { decodeForestrieGrantCose } from "./decode-forestrie-grant-cose.js";
11
12
  export { decodeGrantPayload, decodeGrantResponse } from "./grant-codec.js";
13
+
14
+ /** Deterministic receipt construction (plan-2607-12 Phase 2, FOR-353). */
15
+ export {
16
+ HEADER_RECEIPT,
17
+ attachReceiptAndIdtimestampToTransparentStatement,
18
+ } from "./attach-transparent-statement-receipt.js";
19
+ export { decodeEntryIdHex, entryIdHexToIdtimestampBe8 } from "./entry-id.js";
20
+ export type { DecodedEntryId } from "./entry-id.js";
@@ -4,7 +4,7 @@ import {
4
4
  verifyInclusion,
5
5
  type Proof,
6
6
  } from "@forestrie/merklelog";
7
- import type { Grant } from "./grant.js";
7
+ import type { Grant } from "@forestrie/encoding";
8
8
  import { grantCommitmentHashFromGrant } from "./grant-commitment.js";
9
9
  import { decodeTrustRootFromGenesis } from "./decode-trust-root-from-genesis.js";
10
10
  import { es256ReceiptVerifyKeys } from "./decode-trust-root-cbor.js";
@@ -1,7 +0,0 @@
1
- export interface GrantDataEs256Xy {
2
- readonly kind: "es256-xy";
3
- readonly xy: Uint8Array;
4
- }
5
- export type GrantData = Uint8Array | GrantDataEs256Xy;
6
- export declare function grantDataToBytes(data: Uint8Array | GrantData): Uint8Array;
7
- //# sourceMappingURL=grant-data.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"grant-data.d.ts","sourceRoot":"","sources":["../src/grant-data.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,QAAQ,CAAC,EAAE,EAAE,UAAU,CAAC;CACzB;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAEtD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,UAAU,CAIzE"}
@@ -1,7 +0,0 @@
1
- export function grantDataToBytes(data) {
2
- if (data instanceof Uint8Array)
3
- return data;
4
- if (data.kind === "es256-xy")
5
- return data.xy;
6
- throw new Error("Unsupported GrantData variant");
7
- }
package/dist/grant.d.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { GrantData } from "./grant-data.js";
2
- /** On-chain grant content aligned with Univocity `PublishGrant`. */
3
- export interface Grant {
4
- logId: Uint8Array;
5
- grant: Uint8Array;
6
- request?: bigint;
7
- maxHeight?: number;
8
- minGrowth?: number;
9
- ownerLogId: Uint8Array;
10
- grantData: Uint8Array | GrantData;
11
- }
12
- //# sourceMappingURL=grant.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"grant.d.ts","sourceRoot":"","sources":["../src/grant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,oEAAoE;AACpE,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,UAAU,CAAC;IACvB,SAAS,EAAE,UAAU,GAAG,SAAS,CAAC;CACnC"}
package/dist/grant.js DELETED
@@ -1 +0,0 @@
1
- export {};
package/src/grant-data.ts DELETED
@@ -1,12 +0,0 @@
1
- export interface GrantDataEs256Xy {
2
- readonly kind: "es256-xy";
3
- readonly xy: Uint8Array;
4
- }
5
-
6
- export type GrantData = Uint8Array | GrantDataEs256Xy;
7
-
8
- export function grantDataToBytes(data: Uint8Array | GrantData): Uint8Array {
9
- if (data instanceof Uint8Array) return data;
10
- if (data.kind === "es256-xy") return data.xy;
11
- throw new Error("Unsupported GrantData variant");
12
- }
package/src/grant.ts DELETED
@@ -1,12 +0,0 @@
1
- import type { GrantData } from "./grant-data.js";
2
-
3
- /** On-chain grant content aligned with Univocity `PublishGrant`. */
4
- export interface Grant {
5
- logId: Uint8Array;
6
- grant: Uint8Array;
7
- request?: bigint;
8
- maxHeight?: number;
9
- minGrowth?: number;
10
- ownerLogId: Uint8Array;
11
- grantData: Uint8Array | GrantData;
12
- }