@kagal/taistamp 0.1.1 → 0.2.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,29 @@
1
+ import { TAI64N_CONTENT_LENGTH, TAI64N_CONTENT_TYPE, TAI64N_EPOCH_HI, TAI64N_HEADER_KEY_SELECTOR, TAI64N_HEADER_LEAP_SECONDS, TAI64N_HEADER_NONCE, TAI64N_HEADER_SIGNATURE, TAI64N_LABEL_LENGTH, TAI64N_LABEL_PATTERN, TAI64N_PATH, TAI64_EPOCH_HI, fromUTC, now, tai64nLabel, tai64nLabelFromUTC, tai64nLabelToUTC } from "./_chunks/time.mjs";
2
+ import { Bytes } from "@kagal/ed25519-secret";
3
+ /**
4
+ * sf-binary item per RFC 9651 §3.3.5: standard base64
5
+ * with `=` padding, wrapped in a leading and trailing
6
+ * colon. The empty payload (`::`) is valid sf-binary;
7
+ * consumers impose their own length bounds. The
8
+ * alphabet contains no `,`, so a duplicated field
9
+ * (joined by the Web `Headers` API with `,`) fails the
10
+ * same check.
11
+ */
12
+ declare const SF_BINARY_PATTERN: RegExp;
13
+ /**
14
+ * Encode bytes as an sf-binary item (RFC 9651 §3.3.5):
15
+ * standard base64 wrapped in colons. The output
16
+ * satisfies {@link SF_BINARY_PATTERN} and round-trips
17
+ * through {@link decodeSFBinary}.
18
+ */
19
+ declare const encodeSFBinary: (bytes: Readonly<Uint8Array>) => string;
20
+ /**
21
+ * Decode an sf-binary item back into bytes. Enforces
22
+ * the full RFC 9651 §3.3.5 syntax: throws `TypeError`
23
+ * when `value` does not satisfy
24
+ * {@link SF_BINARY_PATTERN}; the thrown message is
25
+ * optionally prefixed `<context>: `.
26
+ */
27
+ declare const decodeSFBinary: (value: string, context?: string) => Bytes;
28
+ export { SF_BINARY_PATTERN, TAI64N_CONTENT_LENGTH, TAI64N_CONTENT_TYPE, TAI64N_EPOCH_HI, TAI64N_HEADER_KEY_SELECTOR, TAI64N_HEADER_LEAP_SECONDS, TAI64N_HEADER_NONCE, TAI64N_HEADER_SIGNATURE, TAI64N_LABEL_LENGTH, TAI64N_LABEL_PATTERN, TAI64N_PATH, TAI64_EPOCH_HI, decodeSFBinary, encodeSFBinary, fromUTC, now, tai64nLabel, tai64nLabelFromUTC, tai64nLabelToUTC };
29
+ //# sourceMappingURL=utils.d.mts.map
@@ -0,0 +1,29 @@
1
+ import { TAI64N_CONTENT_LENGTH, TAI64N_CONTENT_TYPE, TAI64N_EPOCH_HI, TAI64N_HEADER_KEY_SELECTOR, TAI64N_HEADER_LEAP_SECONDS, TAI64N_HEADER_NONCE, TAI64N_HEADER_SIGNATURE, TAI64N_LABEL_LENGTH, TAI64N_LABEL_PATTERN, TAI64N_PATH, TAI64_EPOCH_HI, fromUTC, now, tai64nLabel, tai64nLabelFromUTC, tai64nLabelToUTC } from "./_chunks/time.mjs";
2
+ import { Bytes } from "@kagal/ed25519-secret";
3
+ /**
4
+ * sf-binary item per RFC 9651 §3.3.5: standard base64
5
+ * with `=` padding, wrapped in a leading and trailing
6
+ * colon. The empty payload (`::`) is valid sf-binary;
7
+ * consumers impose their own length bounds. The
8
+ * alphabet contains no `,`, so a duplicated field
9
+ * (joined by the Web `Headers` API with `,`) fails the
10
+ * same check.
11
+ */
12
+ declare const SF_BINARY_PATTERN: RegExp;
13
+ /**
14
+ * Encode bytes as an sf-binary item (RFC 9651 §3.3.5):
15
+ * standard base64 wrapped in colons. The output
16
+ * satisfies {@link SF_BINARY_PATTERN} and round-trips
17
+ * through {@link decodeSFBinary}.
18
+ */
19
+ declare const encodeSFBinary: (bytes: Readonly<Uint8Array>) => string;
20
+ /**
21
+ * Decode an sf-binary item back into bytes. Enforces
22
+ * the full RFC 9651 §3.3.5 syntax: throws `TypeError`
23
+ * when `value` does not satisfy
24
+ * {@link SF_BINARY_PATTERN}; the thrown message is
25
+ * optionally prefixed `<context>: `.
26
+ */
27
+ declare const decodeSFBinary: (value: string, context?: string) => Bytes;
28
+ export { SF_BINARY_PATTERN, TAI64N_CONTENT_LENGTH, TAI64N_CONTENT_TYPE, TAI64N_EPOCH_HI, TAI64N_HEADER_KEY_SELECTOR, TAI64N_HEADER_LEAP_SECONDS, TAI64N_HEADER_NONCE, TAI64N_HEADER_SIGNATURE, TAI64N_LABEL_LENGTH, TAI64N_LABEL_PATTERN, TAI64N_PATH, TAI64_EPOCH_HI, decodeSFBinary, encodeSFBinary, fromUTC, now, tai64nLabel, tai64nLabelFromUTC, tai64nLabelToUTC };
29
+ //# sourceMappingURL=utils.d.mts.map
package/dist/utils.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { SF_BINARY_PATTERN, TAI64N_CONTENT_LENGTH, TAI64N_CONTENT_TYPE, TAI64N_EPOCH_HI, TAI64N_HEADER_KEY_SELECTOR, TAI64N_HEADER_LEAP_SECONDS, TAI64N_HEADER_NONCE, TAI64N_HEADER_SIGNATURE, TAI64N_LABEL_LENGTH, TAI64N_LABEL_PATTERN, TAI64N_PATH, TAI64_EPOCH_HI, decodeSFBinary, encodeSFBinary, fromUTC, now, tai64nLabel, tai64nLabelFromUTC, tai64nLabelToUTC } from "./_chunks/time.mjs";
2
+ export { SF_BINARY_PATTERN, TAI64N_CONTENT_LENGTH, TAI64N_CONTENT_TYPE, TAI64N_EPOCH_HI, TAI64N_HEADER_KEY_SELECTOR, TAI64N_HEADER_LEAP_SECONDS, TAI64N_HEADER_NONCE, TAI64N_HEADER_SIGNATURE, TAI64N_LABEL_LENGTH, TAI64N_LABEL_PATTERN, TAI64N_PATH, TAI64_EPOCH_HI, decodeSFBinary, encodeSFBinary, fromUTC, now, tai64nLabel, tai64nLabelFromUTC, tai64nLabelToUTC };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kagal/taistamp",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "Signed TAI64N timestamps over HTTP",
6
6
  "author": "Apptly Software Ltd <oss@apptly.co>",
@@ -35,29 +35,34 @@
35
35
  ".": {
36
36
  "types": "./dist/index.d.mts",
37
37
  "default": "./dist/index.mjs"
38
+ },
39
+ "./utils": {
40
+ "types": "./dist/utils.d.mts",
41
+ "default": "./dist/utils.mjs"
38
42
  }
39
43
  },
40
44
  "files": [
41
45
  "dist"
42
46
  ],
43
47
  "dependencies": {
44
- "@kagal/ed25519-secret": "^0.2.1"
48
+ "@kagal/ed25519-secret": "^0.3.2"
45
49
  },
46
50
  "devDependencies": {
47
51
  "@cloudflare/vitest-pool-workers": "^0.13.1",
48
52
  "@cloudflare/workers-types": "^4.20260514.1",
53
+ "@kagal/build-tsdoc": "^0.2.1",
49
54
  "@kagal/cross-test": "^0.1.3",
50
55
  "@noble/ed25519": "^3.1.0",
51
- "@poupe/eslint-config": "^0.9.1",
56
+ "@poupe/eslint-config": "^0.9.3",
52
57
  "@types/node": "^20.19.41",
53
- "@vitest/coverage-istanbul": "^4.1.6",
58
+ "@vitest/coverage-istanbul": "^4.1.8",
54
59
  "eslint": "^9.39.4",
55
- "npm-run-all2": "^9.0.1",
56
- "obuild": "^0.4.35",
60
+ "npm-run-all2": "^9.0.2",
61
+ "obuild": "^0.4.36",
57
62
  "publint": "^0.3.21",
58
63
  "rimraf": "^6.1.3",
59
64
  "typescript": "^6.0.3",
60
- "vitest": "^4.1.6"
65
+ "vitest": "^4.1.8"
61
66
  },
62
67
  "engines": {
63
68
  "node": ">= 20.20.1",
@@ -75,7 +80,7 @@
75
80
  "lint": "eslint --fix .",
76
81
  "lint:_pkg-pr-new": "eslint --fix package.json",
77
82
  "lint:check": "eslint .",
78
- "precommit": "run-s dev:prepare lint type-check build test",
83
+ "precommit": "run-s dev:prepare lint type-check build test test:compat",
79
84
  "publint": "publint",
80
85
  "publish:maybe": "npm view ${npm_package_name}@${npm_package_version} version 2>/dev/null && echo \"${npm_package_name}@${npm_package_version} already published\" || pnpm publish",
81
86
  "test": "vitest run",