@oked/receipt-core 0.6.2 → 0.6.4

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/ids.d.ts CHANGED
@@ -1,7 +1,11 @@
1
1
  import type { ReceiptDecision } from "./types.js";
2
2
  /** `rcpt_` + 26 Crockford base32 characters (128 random bits). */
3
3
  export declare function newReceiptId(): string;
4
- /** The short form shown in Telegram and the dashboard, e.g. `rcpt_7Q2F`. */
4
+ /**
5
+ * The short form shown in Telegram and the dashboard, e.g. `rcpt_7Q2FABCD`.
6
+ * 8 characters (40 bits) so two receipts in one chain do not share a label
7
+ * until about a million receipts. 4 characters collided at about 1,200.
8
+ */
5
9
  export declare function shortReceiptId(receiptId: string): string;
6
10
  /** Chain key: per operator, or per API key for a key with no operator. */
7
11
  export declare function chainIdFor(operatorId: string | null, apiKeyId: string | null): string;
package/dist/ids.js CHANGED
@@ -18,9 +18,13 @@ export function newReceiptId() {
18
18
  out += CROCKFORD[(value << (5 - bits)) & 31];
19
19
  return `rcpt_${out}`;
20
20
  }
21
- /** The short form shown in Telegram and the dashboard, e.g. `rcpt_7Q2F`. */
21
+ /**
22
+ * The short form shown in Telegram and the dashboard, e.g. `rcpt_7Q2FABCD`.
23
+ * 8 characters (40 bits) so two receipts in one chain do not share a label
24
+ * until about a million receipts. 4 characters collided at about 1,200.
25
+ */
22
26
  export function shortReceiptId(receiptId) {
23
- return receiptId.slice(0, 9);
27
+ return receiptId.slice(0, 13);
24
28
  }
25
29
  /** Chain key: per operator, or per API key for a key with no operator. */
26
30
  export function chainIdFor(operatorId, apiKeyId) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oked/receipt-core",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "OKed signed approval receipts: format, canonical JSON, digests, signing and verification",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",