@cheqi/sdk 0.2.0 → 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.
package/README.md CHANGED
@@ -55,3 +55,42 @@ const result = await sdk.receiptService.processCompleteReceipt(
55
55
  - The package ships `.d.ts` declarations so it can be consumed directly from TypeScript.
56
56
  - The full Java model class hierarchy is still not recreated as class-per-model; the payload contract is represented as typed object shapes instead.
57
57
  - XML verification currently normalizes formatting whitespace and hashes the result. If strict XML C14N compatibility is required, that part should be hardened next.
58
+ ## Deferred receipt download links
59
+
60
+ The SDK provides stateless primitives for creating a customer URL before Cheqi is
61
+ reachable. It does not store receipts, start background workers, or choose a retry
62
+ schedule. Your integration owns persistence and decides where and when deferred work
63
+ runs.
64
+
65
+ ```ts
66
+ import {
67
+ buildDownloadEnvelope,
68
+ encryptDownloadEnvelope,
69
+ generateDownloadLink
70
+ } from "@cheqi/sdk/download";
71
+
72
+ const link = generateDownloadLink("https://receipt.cheqi.io");
73
+
74
+ // Persist the complete template request, link.downloadId, and protected
75
+ // link.contentKey using your own durable storage before exposing link.url.
76
+ await receiptJobs.create({ templateRequest, ...link });
77
+ printQr(link.url);
78
+
79
+ // Later, on compute and a schedule controlled by your integration:
80
+ const template = await sdk.receiptService.generateReceiptTemplate(templateRequest);
81
+ const envelope = buildDownloadEnvelope(template);
82
+ const ciphertext = await encryptDownloadEnvelope(envelope, link.contentKey);
83
+
84
+ // Persist the exact ciphertext before its first upload attempt. After an ambiguous
85
+ // result, every retry must reuse these bytes rather than encrypting again.
86
+ await receiptJobs.markReady(link.downloadId, ciphertext);
87
+ await sdk.receiptService.uploadClientEncryptedReceipt({
88
+ downloadId: link.downloadId,
89
+ ciphertext
90
+ });
91
+ ```
92
+
93
+ The customer may open the URL before the receipt is uploaded. The download page reports
94
+ that the receipt is not yet available and can be visited again later. Do not implement
95
+ receipt template generation locally: call the normal template endpoint after connectivity
96
+ returns so CHEQI, UBL, seller, and VAT behavior remains canonical.
@@ -3,10 +3,15 @@
3
3
  * ("Download Link Contract v1" — the offline-first QR route).
4
4
  *
5
5
  * The download id and AES-256-GCM content key are generated locally, with no network,
6
- * so a terminal can render the QR `<baseUrl>/<downloadId>#<contentKey>` even while the
7
- * Cheqi API is unreachable. The content key travels only in the URL fragment, which
8
- * browsers never send to any server: Cheqi stores ciphertext it can never decrypt, and
9
- * decryption happens on the customer's device.
6
+ * so an integration can render the QR `<baseUrl>/<downloadId>#<contentKey>` even while
7
+ * the Cheqi API is unreachable. Before exposing the URL, the integration is responsible
8
+ * for retaining the original template request, download id, and content key so it can
9
+ * finish issuance later. This SDK does not provide storage, scheduling, or background
10
+ * retry behavior.
11
+ *
12
+ * The content key travels only in the URL fragment, which browsers never send to any
13
+ * server: Cheqi stores ciphertext it can never decrypt, and decryption happens on the
14
+ * customer's device.
10
15
  *
11
16
  * This module is intentionally separate from {@link ../services/decryption.js | DecryptionService}
12
17
  * (the Node-only RSA + AES path for receipts delivered to Cheqi wallets) and is
@@ -19,9 +24,11 @@
19
24
  * used for wallet delivery, so no separate download-route model exists.
20
25
  */
21
26
  import type { ReceiptEnvelope } from "../models/generated/ReceiptEnvelope.js";
27
+ import type { ReceiptTemplateResponse } from "../models/generated/ReceiptTemplateResponse.js";
28
+ export type { ReceiptEnvelope };
22
29
  /** Download id length in bytes (128 bits — the enumeration defense on the public endpoint). */
23
30
  export declare const DOWNLOAD_ID_LENGTH = 16;
24
- /** A freshly generated download link: render `url` as the QR immediately, upload later. */
31
+ /** A freshly generated download link. The integration owns persistence and later processing. */
25
32
  export interface DownloadLink {
26
33
  /** base64url (unpadded) download id; the only part of the link the server ever sees. */
27
34
  downloadId: string;
@@ -31,9 +38,10 @@ export interface DownloadLink {
31
38
  url: string;
32
39
  }
33
40
  /**
34
- * Generates a fresh download link locally — no network involved. Call this at transaction
35
- * close and render `url` as the QR regardless of connectivity; upload the encrypted
36
- * envelope asynchronously afterwards.
41
+ * Generates a fresh download link locally — no network involved. The URL does not depend
42
+ * on successful server issuance: a customer who opens it before upload sees the pending
43
+ * receipt page. The integration must retain the request, id, and key before exposing the
44
+ * URL so it can finish template generation, encryption, and upload later.
37
45
  */
38
46
  export declare function generateDownloadLink(baseUrl: string): DownloadLink;
39
47
  /** Builds the customer-facing URL. The content key MUST stay in the fragment. */
@@ -46,6 +54,12 @@ export declare function parseDownloadUrl(url: string): {
46
54
  downloadId: string;
47
55
  contentKey: string;
48
56
  };
57
+ /**
58
+ * Converts the canonical response from `POST /receipt/template` to the standard envelope
59
+ * encrypted for a client-generated download link. Receipt content is never generated or
60
+ * normalized locally; all formats present in the server response are preserved.
61
+ */
62
+ export declare function buildDownloadEnvelope(template: ReceiptTemplateResponse): ReceiptEnvelope;
49
63
  /**
50
64
  * Encrypts a receipt envelope with the content key. Returns `base64(iv || ciphertext || tag)` —
51
65
  * the exact bytes to upload as `ciphertext` to `POST /receipt/download`. Encrypt once and
@@ -55,7 +69,7 @@ export declare function parseDownloadUrl(url: string): {
55
69
  export declare function encryptDownloadEnvelope(envelope: ReceiptEnvelope, contentKey: string): Promise<string>;
56
70
  /**
57
71
  * Decrypts a `base64(iv || ciphertext || tag)` blob (as served by
58
- * `GET /public/receipt/v2/{downloadId}`) with the content key from the URL fragment.
72
+ * `GET /public/receipt/encrypted/{downloadId}`) with the content key from the URL fragment.
59
73
  * Throws {@link DecryptionError} when the key is wrong or the blob was tampered with.
60
74
  */
61
75
  export declare function decryptDownloadEnvelope(encryptedEnvelope: string, contentKey: string): Promise<ReceiptEnvelope>;
@@ -3,10 +3,15 @@
3
3
  * ("Download Link Contract v1" — the offline-first QR route).
4
4
  *
5
5
  * The download id and AES-256-GCM content key are generated locally, with no network,
6
- * so a terminal can render the QR `<baseUrl>/<downloadId>#<contentKey>` even while the
7
- * Cheqi API is unreachable. The content key travels only in the URL fragment, which
8
- * browsers never send to any server: Cheqi stores ciphertext it can never decrypt, and
9
- * decryption happens on the customer's device.
6
+ * so an integration can render the QR `<baseUrl>/<downloadId>#<contentKey>` even while
7
+ * the Cheqi API is unreachable. Before exposing the URL, the integration is responsible
8
+ * for retaining the original template request, download id, and content key so it can
9
+ * finish issuance later. This SDK does not provide storage, scheduling, or background
10
+ * retry behavior.
11
+ *
12
+ * The content key travels only in the URL fragment, which browsers never send to any
13
+ * server: Cheqi stores ciphertext it can never decrypt, and decryption happens on the
14
+ * customer's device.
10
15
  *
11
16
  * This module is intentionally separate from {@link ../services/decryption.js | DecryptionService}
12
17
  * (the Node-only RSA + AES path for receipts delivered to Cheqi wallets) and is
@@ -73,9 +78,10 @@ async function importContentKey(contentKey, usage) {
73
78
  return subtle().importKey("raw", keyBytes, "AES-GCM", false, [usage]);
74
79
  }
75
80
  /**
76
- * Generates a fresh download link locally — no network involved. Call this at transaction
77
- * close and render `url` as the QR regardless of connectivity; upload the encrypted
78
- * envelope asynchronously afterwards.
81
+ * Generates a fresh download link locally — no network involved. The URL does not depend
82
+ * on successful server issuance: a customer who opens it before upload sees the pending
83
+ * receipt page. The integration must retain the request, id, and key before exposing the
84
+ * URL so it can finish template generation, encryption, and upload later.
79
85
  */
80
86
  export function generateDownloadLink(baseUrl) {
81
87
  const downloadId = toBase64Url(randomBytes(DOWNLOAD_ID_LENGTH));
@@ -104,6 +110,22 @@ export function parseDownloadUrl(url) {
104
110
  }
105
111
  return { downloadId, contentKey };
106
112
  }
113
+ /**
114
+ * Converts the canonical response from `POST /receipt/template` to the standard envelope
115
+ * encrypted for a client-generated download link. Receipt content is never generated or
116
+ * normalized locally; all formats present in the server response are preserved.
117
+ */
118
+ export function buildDownloadEnvelope(template) {
119
+ if (!template) {
120
+ throw new EncryptionError("Receipt template response is required");
121
+ }
122
+ return {
123
+ cheqi: template.cheqi,
124
+ ublPurchaseReceipt: template.ublPurchaseReceipt,
125
+ ublInvoice: template.ublInvoice,
126
+ vatMetaData: template.vatMetadata
127
+ };
128
+ }
107
129
  /**
108
130
  * Encrypts a receipt envelope with the content key. Returns `base64(iv || ciphertext || tag)` —
109
131
  * the exact bytes to upload as `ciphertext` to `POST /receipt/download`. Encrypt once and
@@ -113,7 +135,12 @@ export function parseDownloadUrl(url) {
113
135
  export async function encryptDownloadEnvelope(envelope, contentKey) {
114
136
  const key = await importContentKey(contentKey, "encrypt");
115
137
  const iv = randomBytes(GCM_IV_LENGTH);
116
- const plaintext = new TextEncoder().encode(JSON.stringify(ReceiptEnvelopeToJSON(envelope)));
138
+ // Normalize through FromJSON first: callers commonly pass plain parsed JSON (e.g. a
139
+ // generateReceiptTemplate response, where issueDate is a string), while ToJSON assumes
140
+ // hydrated model objects (Date instances). The round-trip accepts both and allow-lists
141
+ // the envelope to known model fields.
142
+ const normalized = ReceiptEnvelopeToJSON(ReceiptEnvelopeFromJSON(envelope));
143
+ const plaintext = new TextEncoder().encode(JSON.stringify(normalized));
117
144
  const encrypted = new Uint8Array(await subtle().encrypt({ name: "AES-GCM", iv: iv }, key, plaintext));
118
145
  const combined = new Uint8Array(iv.length + encrypted.length);
119
146
  combined.set(iv, 0);
@@ -122,7 +149,7 @@ export async function encryptDownloadEnvelope(envelope, contentKey) {
122
149
  }
123
150
  /**
124
151
  * Decrypts a `base64(iv || ciphertext || tag)` blob (as served by
125
- * `GET /public/receipt/v2/{downloadId}`) with the content key from the URL fragment.
152
+ * `GET /public/receipt/encrypted/{downloadId}`) with the content key from the URL fragment.
126
153
  * Throws {@link DecryptionError} when the key is wrong or the blob was tampered with.
127
154
  */
128
155
  export async function decryptDownloadEnvelope(encryptedEnvelope, contentKey) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/download/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,wC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CAAC;QACH,SAAS,GAAG,MAAM,MAAM,EAAE,CAAC,OAAO,CAChC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAkB,EAAE,EAC3C,GAAG,EACH,iBAAiC,CAClC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,eAAe,CAAC,sEAAsE,CAAC,CAAC;IACpG,CAAC;IAED,IAAI,CAAC;QACH,OAAO,uBAAuB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,eAAe,CAAC,sCAAsC,CAAC,CAAC;IACpE,CAAC;AACH,CAAC"}
@@ -7,7 +7,7 @@ import { RetryHandler } from "./retry.js";
7
7
  const SDK_VERSION = (() => {
8
8
  try {
9
9
  // Dynamic import not needed — we just embed the constant at build time.
10
- return "0.1.2";
10
+ return "0.3.0";
11
11
  }
12
12
  catch {
13
13
  return "unknown";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cheqi/sdk",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Cheqi TypeScript SDK for encrypted receipt and credit note processing",
5
5
  "license": "MIT",
6
6
  "author": "Cheqi",