@nextera.one/axis-server-sdk 1.9.0 → 2.0.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,11 @@
1
+ type Axis1DecodedFrame = {
2
+ ver: number;
3
+ flags: number;
4
+ hdr: Buffer;
5
+ body: Buffer;
6
+ sig: Buffer;
7
+ frameSize: number;
8
+ };
9
+ declare function decodeAxis1Frame(buf: Buffer): Axis1DecodedFrame;
10
+
11
+ export { type Axis1DecodedFrame, decodeAxis1Frame };
@@ -0,0 +1,11 @@
1
+ type Axis1DecodedFrame = {
2
+ ver: number;
3
+ flags: number;
4
+ hdr: Buffer;
5
+ body: Buffer;
6
+ sig: Buffer;
7
+ frameSize: number;
8
+ };
9
+ declare function decodeAxis1Frame(buf: Buffer): Axis1DecodedFrame;
10
+
11
+ export { type Axis1DecodedFrame, decodeAxis1Frame };
@@ -0,0 +1,78 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/types/frame.ts
20
+ var frame_exports = {};
21
+ __export(frame_exports, {
22
+ decodeAxis1Frame: () => decodeAxis1Frame
23
+ });
24
+ module.exports = __toCommonJS(frame_exports);
25
+ var import_axis_protocol = require("@nextera.one/axis-protocol");
26
+
27
+ // src/types/tlv.ts
28
+ function decVarint(buf, off) {
29
+ let shift = 0n;
30
+ let x = 0n;
31
+ while (true) {
32
+ if (off >= buf.length) throw new Error("varint overflow");
33
+ const b = BigInt(buf[off++]);
34
+ x |= (b & 0x7fn) << shift;
35
+ if ((b & 0x80n) === 0n) break;
36
+ shift += 7n;
37
+ if (shift > 63n) throw new Error("varint too large");
38
+ }
39
+ return { val: x, off };
40
+ }
41
+
42
+ // src/types/frame.ts
43
+ var MAGIC = Buffer.from(import_axis_protocol.AXIS_MAGIC);
44
+ function decodeAxis1Frame(buf) {
45
+ let off = 0;
46
+ const magic = buf.subarray(off, off + 5);
47
+ off += 5;
48
+ if (magic.length !== 5 || !magic.equals(MAGIC))
49
+ throw new Error("AXIS1_BAD_MAGIC");
50
+ if (off + 2 > buf.length) throw new Error("AXIS1_TRUNCATED");
51
+ const ver = buf[off++];
52
+ const flags = buf[off++];
53
+ const h1 = decVarint(buf, off);
54
+ off = h1.off;
55
+ const b1 = decVarint(buf, off);
56
+ off = b1.off;
57
+ const s1 = decVarint(buf, off);
58
+ off = s1.off;
59
+ const hdrLen = Number(h1.val);
60
+ const bodyLen = Number(b1.val);
61
+ const sigLen = Number(s1.val);
62
+ if (hdrLen < 0 || bodyLen < 0 || sigLen < 0) throw new Error("AXIS1_LEN_NEG");
63
+ if (off + hdrLen + bodyLen + sigLen > buf.length)
64
+ throw new Error("AXIS1_TRUNCATED_PAYLOAD");
65
+ const hdr = buf.subarray(off, off + hdrLen);
66
+ off += hdrLen;
67
+ const body = buf.subarray(off, off + bodyLen);
68
+ off += bodyLen;
69
+ const sig = buf.subarray(off, off + sigLen);
70
+ off += sigLen;
71
+ if (off !== buf.length) throw new Error("AXIS1_TRAILING_BYTES");
72
+ return { ver, flags, hdr, body, sig, frameSize: buf.length };
73
+ }
74
+ // Annotate the CommonJS export names for ESM import in node:
75
+ 0 && (module.exports = {
76
+ decodeAxis1Frame
77
+ });
78
+ //# sourceMappingURL=frame.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/frame.ts","../../src/types/tlv.ts"],"sourcesContent":["import { AXIS_MAGIC } from '@nextera.one/axis-protocol';\n\nimport { decVarint } from './tlv';\n\n/**\n * Axis1DecodedFrame\n *\n * Represents a parsed AXIS v1 binary frame.\n *\n * @typedef {Object} Axis1DecodedFrame\n */\nexport type Axis1DecodedFrame = {\n /** Protocol version (should be 1) */\n ver: number;\n /** Frame flags for protocol extensions */\n flags: number;\n /** Raw header bytes (containing primary TLVs) */\n hdr: Buffer;\n /** Raw body bytes (the main payload) */\n body: Buffer;\n /** Cryptographic signature bytes */\n sig: Buffer;\n /** Total original size of the frame in bytes */\n frameSize: number;\n};\n\nconst MAGIC = Buffer.from(AXIS_MAGIC);\n\n/**\n * Decodes a raw binary buffer into a structured Axis1DecodedFrame.\n * Implements the AXIS v1 wire format specification.\n *\n * **Binary Structure (canonical):**\n * 1. Magic: 'AXIS1' (5 bytes)\n * 2. Version: (1 byte)\n * 3. Flags: (1 byte)\n * 4. HDR_LEN: Varint\n * 5. BODY_LEN: Varint\n * 6. SIG_LEN: Varint\n * 7. HDR: (HDR_LEN bytes)\n * 8. BODY: (BODY_LEN bytes)\n * 9. SIG: (SIG_LEN bytes)\n *\n * @param {Buffer} buf - Raw bytes from the wire\n * @returns {Axis1DecodedFrame} Parsed frame object\n * @throws {Error} If magic is invalid, frame is truncated, or lengths are inconsistent\n */\nexport function decodeAxis1Frame(buf: Buffer): Axis1DecodedFrame {\n let off = 0;\n\n const magic = buf.subarray(off, off + 5);\n off += 5;\n if (magic.length !== 5 || !magic.equals(MAGIC))\n throw new Error('AXIS1_BAD_MAGIC');\n\n if (off + 2 > buf.length) throw new Error('AXIS1_TRUNCATED');\n const ver = buf[off++];\n const flags = buf[off++];\n\n // Read all three lengths first (canonical order: hdrLen, bodyLen, sigLen)\n const h1 = decVarint(buf, off);\n off = h1.off;\n const b1 = decVarint(buf, off);\n off = b1.off;\n const s1 = decVarint(buf, off);\n off = s1.off;\n\n const hdrLen = Number(h1.val);\n const bodyLen = Number(b1.val);\n const sigLen = Number(s1.val);\n\n if (hdrLen < 0 || bodyLen < 0 || sigLen < 0) throw new Error('AXIS1_LEN_NEG');\n\n if (off + hdrLen + bodyLen + sigLen > buf.length)\n throw new Error('AXIS1_TRUNCATED_PAYLOAD');\n\n // Then read payloads in order: HDR, BODY, SIG\n const hdr = buf.subarray(off, off + hdrLen);\n off += hdrLen;\n const body = buf.subarray(off, off + bodyLen);\n off += bodyLen;\n const sig = buf.subarray(off, off + sigLen);\n off += sigLen;\n\n if (off !== buf.length) throw new Error('AXIS1_TRAILING_BYTES');\n\n return { ver, flags, hdr, body, sig, frameSize: buf.length };\n}\n","/**\n * Decodes a variable-length integer (Varint) from a buffer.\n * Supports up to 64-bit integers.\n *\n * @param {Buffer} buf - The buffer to read from\n * @param {number} off - The offset to start reading from\n * @returns {Object} The decoded bigint value and the new offset\n * @throws {Error} If the varint is malformed or exceeds 64 bits\n */\nexport function decVarint(\n buf: Buffer,\n off: number,\n): { val: bigint; off: number } {\n let shift = 0n;\n let x = 0n;\n while (true) {\n if (off >= buf.length) throw new Error('varint overflow');\n const b = BigInt(buf[off++]);\n x |= (b & 0x7fn) << shift;\n if ((b & 0x80n) === 0n) break;\n shift += 7n;\n if (shift > 63n) throw new Error('varint too large');\n }\n return { val: x, off };\n}\n\nimport type { TLV } from '../core/tlv';\n\n/**\n * Parses a buffer into an array of TLV objects.\n *\n * @param {Buffer} buf - The buffer containing TLV-encoded data\n * @param {number} [maxItems=512] - Security limit for the number of TLVs to parse\n * @returns {TLV[]} An array of parsed TLVs\n * @throws {Error} If TLV structure is invalid or limits are exceeded\n */\nexport function parseTLVs(buf: Buffer, maxItems: number = 512): TLV[] {\n const out: TLV[] = [];\n let off = 0;\n while (off < buf.length) {\n if (out.length >= maxItems) throw new Error('TLV_TOO_MANY_ITEMS');\n const t1 = decVarint(buf, off);\n off = t1.off;\n const t2 = decVarint(buf, off);\n off = t2.off;\n const type = Number(t1.val);\n const len = Number(t2.val);\n if (len < 0 || off + len > buf.length) {\n throw new Error('TLV_LEN_INVALID');\n }\n const value = buf.subarray(off, off + len);\n off += len;\n out.push({ type, value });\n }\n return out;\n}\n\n/**\n * Parses TLVs and organizes them into a Map for efficient access.\n * Multiple values for the same type are preserved in an array.\n *\n * @param {Buffer} buf - The raw TLV-encoded buffer\n * @returns {Map<number, Buffer[]>} A map of Tag -> [Values]\n */\nexport function tlvMap(buf: Buffer): Map<number, Buffer[]> {\n const m = new Map<number, Buffer[]>();\n for (const it of parseTLVs(buf)) {\n const arr = m.get(it.type) ?? [];\n arr.push(it.value as Buffer);\n m.set(it.type, arr);\n }\n return m;\n}\n\nexport function asUtf8(b?: Buffer): string | undefined {\n if (!b) return undefined;\n return b.toString('utf8');\n}\n\nexport function asBigintVarint(b?: Buffer): bigint | undefined {\n if (!b) return undefined;\n const { val, off } = decVarint(b, 0);\n if (off !== b.length) throw new Error('VARINT_TRAILING_BYTES');\n return val;\n}\n\n/**\n * Parses an 8-byte big-endian buffer as a BigInt.\n * Used for timestamps which are sent as fixed 8-byte u64.\n */\nexport function asBigint64BE(b?: Buffer): bigint | undefined {\n if (!b) return undefined;\n if (b.length !== 8) throw new Error('Expected 8 bytes for u64');\n return b.readBigUInt64BE(0);\n}\n\nexport function encVarint(x: bigint): Buffer {\n if (x < 0n) throw new Error('varint neg');\n const out: number[] = [];\n while (x >= 0x80n) {\n out.push(Number((x & 0x7fn) | 0x80n));\n x >>= 7n;\n }\n out.push(Number(x));\n return Buffer.from(out);\n}\n\nexport function tlv(type: number, value: Buffer): Buffer {\n return Buffer.concat([\n encVarint(BigInt(type)),\n encVarint(BigInt(value.length)),\n value,\n ]);\n}\n\nexport function buildTLVs(items: { type: number; value: Buffer }[]): Buffer {\n // Canonical: sort by type ascending\n const sorted = [...items].sort((a, b) => a.type - b.type);\n\n // Canonical: forbid duplicate tags by default\n for (let i = 1; i < sorted.length; i++) {\n if (sorted[i].type === sorted[i - 1].type) {\n throw new Error(`TLV_DUP_TYPE_${sorted[i].type}`);\n }\n }\n\n return Buffer.concat(sorted.map((it) => tlv(it.type, it.value)));\n}\n\nexport function u64be(x: bigint): Buffer {\n const b = Buffer.alloc(8);\n b.writeBigUInt64BE(x);\n return b;\n}\n\nexport function utf8(s: string): Buffer {\n return Buffer.from(s, 'utf8');\n}\n\nexport function varintU(x: number | bigint): Buffer {\n const v = typeof x === 'number' ? BigInt(x) : x;\n return encVarint(v);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,2BAA2B;;;ACSpB,SAAS,UACd,KACA,KAC8B;AAC9B,MAAI,QAAQ;AACZ,MAAI,IAAI;AACR,SAAO,MAAM;AACX,QAAI,OAAO,IAAI,OAAQ,OAAM,IAAI,MAAM,iBAAiB;AACxD,UAAM,IAAI,OAAO,IAAI,KAAK,CAAC;AAC3B,UAAM,IAAI,UAAU;AACpB,SAAK,IAAI,WAAW,GAAI;AACxB,aAAS;AACT,QAAI,QAAQ,IAAK,OAAM,IAAI,MAAM,kBAAkB;AAAA,EACrD;AACA,SAAO,EAAE,KAAK,GAAG,IAAI;AACvB;;;ADEA,IAAM,QAAQ,OAAO,KAAK,+BAAU;AAqB7B,SAAS,iBAAiB,KAAgC;AAC/D,MAAI,MAAM;AAEV,QAAM,QAAQ,IAAI,SAAS,KAAK,MAAM,CAAC;AACvC,SAAO;AACP,MAAI,MAAM,WAAW,KAAK,CAAC,MAAM,OAAO,KAAK;AAC3C,UAAM,IAAI,MAAM,iBAAiB;AAEnC,MAAI,MAAM,IAAI,IAAI,OAAQ,OAAM,IAAI,MAAM,iBAAiB;AAC3D,QAAM,MAAM,IAAI,KAAK;AACrB,QAAM,QAAQ,IAAI,KAAK;AAGvB,QAAM,KAAK,UAAU,KAAK,GAAG;AAC7B,QAAM,GAAG;AACT,QAAM,KAAK,UAAU,KAAK,GAAG;AAC7B,QAAM,GAAG;AACT,QAAM,KAAK,UAAU,KAAK,GAAG;AAC7B,QAAM,GAAG;AAET,QAAM,SAAS,OAAO,GAAG,GAAG;AAC5B,QAAM,UAAU,OAAO,GAAG,GAAG;AAC7B,QAAM,SAAS,OAAO,GAAG,GAAG;AAE5B,MAAI,SAAS,KAAK,UAAU,KAAK,SAAS,EAAG,OAAM,IAAI,MAAM,eAAe;AAE5E,MAAI,MAAM,SAAS,UAAU,SAAS,IAAI;AACxC,UAAM,IAAI,MAAM,yBAAyB;AAG3C,QAAM,MAAM,IAAI,SAAS,KAAK,MAAM,MAAM;AAC1C,SAAO;AACP,QAAM,OAAO,IAAI,SAAS,KAAK,MAAM,OAAO;AAC5C,SAAO;AACP,QAAM,MAAM,IAAI,SAAS,KAAK,MAAM,MAAM;AAC1C,SAAO;AAEP,MAAI,QAAQ,IAAI,OAAQ,OAAM,IAAI,MAAM,sBAAsB;AAE9D,SAAO,EAAE,KAAK,OAAO,KAAK,MAAM,KAAK,WAAW,IAAI,OAAO;AAC7D;","names":[]}
@@ -0,0 +1,54 @@
1
+ // src/types/frame.ts
2
+ import { AXIS_MAGIC } from "@nextera.one/axis-protocol";
3
+
4
+ // src/types/tlv.ts
5
+ function decVarint(buf, off) {
6
+ let shift = 0n;
7
+ let x = 0n;
8
+ while (true) {
9
+ if (off >= buf.length) throw new Error("varint overflow");
10
+ const b = BigInt(buf[off++]);
11
+ x |= (b & 0x7fn) << shift;
12
+ if ((b & 0x80n) === 0n) break;
13
+ shift += 7n;
14
+ if (shift > 63n) throw new Error("varint too large");
15
+ }
16
+ return { val: x, off };
17
+ }
18
+
19
+ // src/types/frame.ts
20
+ var MAGIC = Buffer.from(AXIS_MAGIC);
21
+ function decodeAxis1Frame(buf) {
22
+ let off = 0;
23
+ const magic = buf.subarray(off, off + 5);
24
+ off += 5;
25
+ if (magic.length !== 5 || !magic.equals(MAGIC))
26
+ throw new Error("AXIS1_BAD_MAGIC");
27
+ if (off + 2 > buf.length) throw new Error("AXIS1_TRUNCATED");
28
+ const ver = buf[off++];
29
+ const flags = buf[off++];
30
+ const h1 = decVarint(buf, off);
31
+ off = h1.off;
32
+ const b1 = decVarint(buf, off);
33
+ off = b1.off;
34
+ const s1 = decVarint(buf, off);
35
+ off = s1.off;
36
+ const hdrLen = Number(h1.val);
37
+ const bodyLen = Number(b1.val);
38
+ const sigLen = Number(s1.val);
39
+ if (hdrLen < 0 || bodyLen < 0 || sigLen < 0) throw new Error("AXIS1_LEN_NEG");
40
+ if (off + hdrLen + bodyLen + sigLen > buf.length)
41
+ throw new Error("AXIS1_TRUNCATED_PAYLOAD");
42
+ const hdr = buf.subarray(off, off + hdrLen);
43
+ off += hdrLen;
44
+ const body = buf.subarray(off, off + bodyLen);
45
+ off += bodyLen;
46
+ const sig = buf.subarray(off, off + sigLen);
47
+ off += sigLen;
48
+ if (off !== buf.length) throw new Error("AXIS1_TRAILING_BYTES");
49
+ return { ver, flags, hdr, body, sig, frameSize: buf.length };
50
+ }
51
+ export {
52
+ decodeAxis1Frame
53
+ };
54
+ //# sourceMappingURL=frame.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/types/frame.ts","../../src/types/tlv.ts"],"sourcesContent":["import { AXIS_MAGIC } from '@nextera.one/axis-protocol';\n\nimport { decVarint } from './tlv';\n\n/**\n * Axis1DecodedFrame\n *\n * Represents a parsed AXIS v1 binary frame.\n *\n * @typedef {Object} Axis1DecodedFrame\n */\nexport type Axis1DecodedFrame = {\n /** Protocol version (should be 1) */\n ver: number;\n /** Frame flags for protocol extensions */\n flags: number;\n /** Raw header bytes (containing primary TLVs) */\n hdr: Buffer;\n /** Raw body bytes (the main payload) */\n body: Buffer;\n /** Cryptographic signature bytes */\n sig: Buffer;\n /** Total original size of the frame in bytes */\n frameSize: number;\n};\n\nconst MAGIC = Buffer.from(AXIS_MAGIC);\n\n/**\n * Decodes a raw binary buffer into a structured Axis1DecodedFrame.\n * Implements the AXIS v1 wire format specification.\n *\n * **Binary Structure (canonical):**\n * 1. Magic: 'AXIS1' (5 bytes)\n * 2. Version: (1 byte)\n * 3. Flags: (1 byte)\n * 4. HDR_LEN: Varint\n * 5. BODY_LEN: Varint\n * 6. SIG_LEN: Varint\n * 7. HDR: (HDR_LEN bytes)\n * 8. BODY: (BODY_LEN bytes)\n * 9. SIG: (SIG_LEN bytes)\n *\n * @param {Buffer} buf - Raw bytes from the wire\n * @returns {Axis1DecodedFrame} Parsed frame object\n * @throws {Error} If magic is invalid, frame is truncated, or lengths are inconsistent\n */\nexport function decodeAxis1Frame(buf: Buffer): Axis1DecodedFrame {\n let off = 0;\n\n const magic = buf.subarray(off, off + 5);\n off += 5;\n if (magic.length !== 5 || !magic.equals(MAGIC))\n throw new Error('AXIS1_BAD_MAGIC');\n\n if (off + 2 > buf.length) throw new Error('AXIS1_TRUNCATED');\n const ver = buf[off++];\n const flags = buf[off++];\n\n // Read all three lengths first (canonical order: hdrLen, bodyLen, sigLen)\n const h1 = decVarint(buf, off);\n off = h1.off;\n const b1 = decVarint(buf, off);\n off = b1.off;\n const s1 = decVarint(buf, off);\n off = s1.off;\n\n const hdrLen = Number(h1.val);\n const bodyLen = Number(b1.val);\n const sigLen = Number(s1.val);\n\n if (hdrLen < 0 || bodyLen < 0 || sigLen < 0) throw new Error('AXIS1_LEN_NEG');\n\n if (off + hdrLen + bodyLen + sigLen > buf.length)\n throw new Error('AXIS1_TRUNCATED_PAYLOAD');\n\n // Then read payloads in order: HDR, BODY, SIG\n const hdr = buf.subarray(off, off + hdrLen);\n off += hdrLen;\n const body = buf.subarray(off, off + bodyLen);\n off += bodyLen;\n const sig = buf.subarray(off, off + sigLen);\n off += sigLen;\n\n if (off !== buf.length) throw new Error('AXIS1_TRAILING_BYTES');\n\n return { ver, flags, hdr, body, sig, frameSize: buf.length };\n}\n","/**\n * Decodes a variable-length integer (Varint) from a buffer.\n * Supports up to 64-bit integers.\n *\n * @param {Buffer} buf - The buffer to read from\n * @param {number} off - The offset to start reading from\n * @returns {Object} The decoded bigint value and the new offset\n * @throws {Error} If the varint is malformed or exceeds 64 bits\n */\nexport function decVarint(\n buf: Buffer,\n off: number,\n): { val: bigint; off: number } {\n let shift = 0n;\n let x = 0n;\n while (true) {\n if (off >= buf.length) throw new Error('varint overflow');\n const b = BigInt(buf[off++]);\n x |= (b & 0x7fn) << shift;\n if ((b & 0x80n) === 0n) break;\n shift += 7n;\n if (shift > 63n) throw new Error('varint too large');\n }\n return { val: x, off };\n}\n\nimport type { TLV } from '../core/tlv';\n\n/**\n * Parses a buffer into an array of TLV objects.\n *\n * @param {Buffer} buf - The buffer containing TLV-encoded data\n * @param {number} [maxItems=512] - Security limit for the number of TLVs to parse\n * @returns {TLV[]} An array of parsed TLVs\n * @throws {Error} If TLV structure is invalid or limits are exceeded\n */\nexport function parseTLVs(buf: Buffer, maxItems: number = 512): TLV[] {\n const out: TLV[] = [];\n let off = 0;\n while (off < buf.length) {\n if (out.length >= maxItems) throw new Error('TLV_TOO_MANY_ITEMS');\n const t1 = decVarint(buf, off);\n off = t1.off;\n const t2 = decVarint(buf, off);\n off = t2.off;\n const type = Number(t1.val);\n const len = Number(t2.val);\n if (len < 0 || off + len > buf.length) {\n throw new Error('TLV_LEN_INVALID');\n }\n const value = buf.subarray(off, off + len);\n off += len;\n out.push({ type, value });\n }\n return out;\n}\n\n/**\n * Parses TLVs and organizes them into a Map for efficient access.\n * Multiple values for the same type are preserved in an array.\n *\n * @param {Buffer} buf - The raw TLV-encoded buffer\n * @returns {Map<number, Buffer[]>} A map of Tag -> [Values]\n */\nexport function tlvMap(buf: Buffer): Map<number, Buffer[]> {\n const m = new Map<number, Buffer[]>();\n for (const it of parseTLVs(buf)) {\n const arr = m.get(it.type) ?? [];\n arr.push(it.value as Buffer);\n m.set(it.type, arr);\n }\n return m;\n}\n\nexport function asUtf8(b?: Buffer): string | undefined {\n if (!b) return undefined;\n return b.toString('utf8');\n}\n\nexport function asBigintVarint(b?: Buffer): bigint | undefined {\n if (!b) return undefined;\n const { val, off } = decVarint(b, 0);\n if (off !== b.length) throw new Error('VARINT_TRAILING_BYTES');\n return val;\n}\n\n/**\n * Parses an 8-byte big-endian buffer as a BigInt.\n * Used for timestamps which are sent as fixed 8-byte u64.\n */\nexport function asBigint64BE(b?: Buffer): bigint | undefined {\n if (!b) return undefined;\n if (b.length !== 8) throw new Error('Expected 8 bytes for u64');\n return b.readBigUInt64BE(0);\n}\n\nexport function encVarint(x: bigint): Buffer {\n if (x < 0n) throw new Error('varint neg');\n const out: number[] = [];\n while (x >= 0x80n) {\n out.push(Number((x & 0x7fn) | 0x80n));\n x >>= 7n;\n }\n out.push(Number(x));\n return Buffer.from(out);\n}\n\nexport function tlv(type: number, value: Buffer): Buffer {\n return Buffer.concat([\n encVarint(BigInt(type)),\n encVarint(BigInt(value.length)),\n value,\n ]);\n}\n\nexport function buildTLVs(items: { type: number; value: Buffer }[]): Buffer {\n // Canonical: sort by type ascending\n const sorted = [...items].sort((a, b) => a.type - b.type);\n\n // Canonical: forbid duplicate tags by default\n for (let i = 1; i < sorted.length; i++) {\n if (sorted[i].type === sorted[i - 1].type) {\n throw new Error(`TLV_DUP_TYPE_${sorted[i].type}`);\n }\n }\n\n return Buffer.concat(sorted.map((it) => tlv(it.type, it.value)));\n}\n\nexport function u64be(x: bigint): Buffer {\n const b = Buffer.alloc(8);\n b.writeBigUInt64BE(x);\n return b;\n}\n\nexport function utf8(s: string): Buffer {\n return Buffer.from(s, 'utf8');\n}\n\nexport function varintU(x: number | bigint): Buffer {\n const v = typeof x === 'number' ? BigInt(x) : x;\n return encVarint(v);\n}\n"],"mappings":";AAAA,SAAS,kBAAkB;;;ACSpB,SAAS,UACd,KACA,KAC8B;AAC9B,MAAI,QAAQ;AACZ,MAAI,IAAI;AACR,SAAO,MAAM;AACX,QAAI,OAAO,IAAI,OAAQ,OAAM,IAAI,MAAM,iBAAiB;AACxD,UAAM,IAAI,OAAO,IAAI,KAAK,CAAC;AAC3B,UAAM,IAAI,UAAU;AACpB,SAAK,IAAI,WAAW,GAAI;AACxB,aAAS;AACT,QAAI,QAAQ,IAAK,OAAM,IAAI,MAAM,kBAAkB;AAAA,EACrD;AACA,SAAO,EAAE,KAAK,GAAG,IAAI;AACvB;;;ADEA,IAAM,QAAQ,OAAO,KAAK,UAAU;AAqB7B,SAAS,iBAAiB,KAAgC;AAC/D,MAAI,MAAM;AAEV,QAAM,QAAQ,IAAI,SAAS,KAAK,MAAM,CAAC;AACvC,SAAO;AACP,MAAI,MAAM,WAAW,KAAK,CAAC,MAAM,OAAO,KAAK;AAC3C,UAAM,IAAI,MAAM,iBAAiB;AAEnC,MAAI,MAAM,IAAI,IAAI,OAAQ,OAAM,IAAI,MAAM,iBAAiB;AAC3D,QAAM,MAAM,IAAI,KAAK;AACrB,QAAM,QAAQ,IAAI,KAAK;AAGvB,QAAM,KAAK,UAAU,KAAK,GAAG;AAC7B,QAAM,GAAG;AACT,QAAM,KAAK,UAAU,KAAK,GAAG;AAC7B,QAAM,GAAG;AACT,QAAM,KAAK,UAAU,KAAK,GAAG;AAC7B,QAAM,GAAG;AAET,QAAM,SAAS,OAAO,GAAG,GAAG;AAC5B,QAAM,UAAU,OAAO,GAAG,GAAG;AAC7B,QAAM,SAAS,OAAO,GAAG,GAAG;AAE5B,MAAI,SAAS,KAAK,UAAU,KAAK,SAAS,EAAG,OAAM,IAAI,MAAM,eAAe;AAE5E,MAAI,MAAM,SAAS,UAAU,SAAS,IAAI;AACxC,UAAM,IAAI,MAAM,yBAAyB;AAG3C,QAAM,MAAM,IAAI,SAAS,KAAK,MAAM,MAAM;AAC1C,SAAO;AACP,QAAM,OAAO,IAAI,SAAS,KAAK,MAAM,OAAO;AAC5C,SAAO;AACP,QAAM,MAAM,IAAI,SAAS,KAAK,MAAM,MAAM;AAC1C,SAAO;AAEP,MAAI,QAAQ,IAAI,OAAQ,OAAM,IAAI,MAAM,sBAAsB;AAE9D,SAAO,EAAE,KAAK,OAAO,KAAK,MAAM,KAAK,WAAW,IAAI,OAAO;AAC7D;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextera.one/axis-server-sdk",
3
- "version": "1.9.0",
3
+ "version": "2.0.0",
4
4
  "description": "Axis Protocol server-side SDK — decorators, interfaces, and routing primitives for building Axis handlers",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -32,6 +32,7 @@
32
32
  ],
33
33
  "scripts": {
34
34
  "build": "tsup",
35
+ "test": "npm run build && node --test test/*.test.js",
35
36
  "prepublishOnly": "npm run build",
36
37
  "dev": "tsup --watch"
37
38
  },
@@ -1,122 +0,0 @@
1
- import { AXIS_MAGIC, AXIS_VERSION, BodyProfile, ERR_BAD_SIGNATURE, ERR_CONTRACT_VIOLATION, ERR_INVALID_PACKET, ERR_REPLAY_DETECTED, FLAG_BODY_TLV, FLAG_CHAIN_REQ, FLAG_HAS_WITNESS, MAX_BODY_LEN, MAX_FRAME_LEN, MAX_HDR_LEN, MAX_SIG_LEN, NCERT_ALG, NCERT_EXP, NCERT_ISSUER_KID, NCERT_KID, NCERT_NBF, NCERT_NODE_ID, NCERT_PAYLOAD, NCERT_PUB, NCERT_SCOPE, NCERT_SIG, PROOF_CAPSULE, PROOF_JWT, PROOF_LOOM, PROOF_MTLS, PROOF_NONE, PROOF_WITNESS, ProofType, TLV, TLV_ACTOR_ID, TLV_AUD, TLV_BODY_ARR, TLV_BODY_OBJ, TLV_CAPSULE, TLV_EFFECT, TLV_ERROR_CODE, TLV_ERROR_MSG, TLV_INDEX, TLV_INTENT, TLV_KID, TLV_LOOM_PRESENCE_ID, TLV_LOOM_THREAD_HASH, TLV_LOOM_WRIT, TLV_NODE, TLV_NODE_CERT_HASH, TLV_NODE_KID, TLV_NONCE, TLV_OFFSET, TLV_OK, TLV_PID, TLV_PREV_HASH, TLV_PROOF_REF, TLV_PROOF_TYPE, TLV_REALM, TLV_RECEIPT_HASH, TLV_RID, TLV_SHA256_CHUNK, TLV_TRACE_ID, TLV_TS, TLV_UPLOAD_ID, decodeArray, decodeObject, decodeTLVs, decodeTLVsList, decodeVarint, encodeTLVs, encodeVarint, varintLength } from '@nextera.one/axis-protocol';
2
- import * as z from 'zod';
3
-
4
- declare const AxisFrameZ: z.ZodObject<{
5
- flags: z.ZodNumber;
6
- headers: z.ZodMap<z.ZodNumber, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
7
- body: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
8
- sig: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
9
- }, z.core.$strip>;
10
- type AxisFrame = z.infer<typeof AxisFrameZ>;
11
- type AxisBinaryFrame = AxisFrame;
12
- declare function encodeFrame(frame: AxisFrame): Uint8Array;
13
- declare function decodeFrame(buf: Uint8Array): AxisFrame;
14
- declare function getSignTarget(frame: AxisFrame): Uint8Array;
15
-
16
- declare function computeSignaturePayload(frame: AxisFrame): Buffer;
17
- declare function signFrame(frame: AxisFrame, privateKey: Buffer): Buffer;
18
- declare function verifyFrameSignature(frame: AxisFrame, publicKey: Buffer): boolean;
19
- declare function generateEd25519KeyPair(): {
20
- privateKey: Buffer;
21
- publicKey: Buffer;
22
- };
23
- declare function sha256(data: Buffer | Uint8Array): Buffer;
24
- declare function computeReceiptHash(receiptBytes: Buffer | Uint8Array, prevHash?: Buffer | Uint8Array): Buffer;
25
-
26
- declare class AxisError extends Error {
27
- code: string;
28
- httpStatus: number;
29
- details?: Record<string, any> | undefined;
30
- constructor(code: string, message: string, httpStatus?: number, details?: Record<string, any> | undefined);
31
- }
32
-
33
- declare const index_AXIS_MAGIC: typeof AXIS_MAGIC;
34
- declare const index_AXIS_VERSION: typeof AXIS_VERSION;
35
- type index_AxisBinaryFrame = AxisBinaryFrame;
36
- type index_AxisError = AxisError;
37
- declare const index_AxisError: typeof AxisError;
38
- type index_AxisFrame = AxisFrame;
39
- declare const index_AxisFrameZ: typeof AxisFrameZ;
40
- declare const index_BodyProfile: typeof BodyProfile;
41
- declare const index_ERR_BAD_SIGNATURE: typeof ERR_BAD_SIGNATURE;
42
- declare const index_ERR_CONTRACT_VIOLATION: typeof ERR_CONTRACT_VIOLATION;
43
- declare const index_ERR_INVALID_PACKET: typeof ERR_INVALID_PACKET;
44
- declare const index_ERR_REPLAY_DETECTED: typeof ERR_REPLAY_DETECTED;
45
- declare const index_FLAG_BODY_TLV: typeof FLAG_BODY_TLV;
46
- declare const index_FLAG_CHAIN_REQ: typeof FLAG_CHAIN_REQ;
47
- declare const index_FLAG_HAS_WITNESS: typeof FLAG_HAS_WITNESS;
48
- declare const index_MAX_BODY_LEN: typeof MAX_BODY_LEN;
49
- declare const index_MAX_FRAME_LEN: typeof MAX_FRAME_LEN;
50
- declare const index_MAX_HDR_LEN: typeof MAX_HDR_LEN;
51
- declare const index_MAX_SIG_LEN: typeof MAX_SIG_LEN;
52
- declare const index_NCERT_ALG: typeof NCERT_ALG;
53
- declare const index_NCERT_EXP: typeof NCERT_EXP;
54
- declare const index_NCERT_ISSUER_KID: typeof NCERT_ISSUER_KID;
55
- declare const index_NCERT_KID: typeof NCERT_KID;
56
- declare const index_NCERT_NBF: typeof NCERT_NBF;
57
- declare const index_NCERT_NODE_ID: typeof NCERT_NODE_ID;
58
- declare const index_NCERT_PAYLOAD: typeof NCERT_PAYLOAD;
59
- declare const index_NCERT_PUB: typeof NCERT_PUB;
60
- declare const index_NCERT_SCOPE: typeof NCERT_SCOPE;
61
- declare const index_NCERT_SIG: typeof NCERT_SIG;
62
- declare const index_PROOF_CAPSULE: typeof PROOF_CAPSULE;
63
- declare const index_PROOF_JWT: typeof PROOF_JWT;
64
- declare const index_PROOF_LOOM: typeof PROOF_LOOM;
65
- declare const index_PROOF_MTLS: typeof PROOF_MTLS;
66
- declare const index_PROOF_NONE: typeof PROOF_NONE;
67
- declare const index_PROOF_WITNESS: typeof PROOF_WITNESS;
68
- declare const index_ProofType: typeof ProofType;
69
- declare const index_TLV: typeof TLV;
70
- declare const index_TLV_ACTOR_ID: typeof TLV_ACTOR_ID;
71
- declare const index_TLV_AUD: typeof TLV_AUD;
72
- declare const index_TLV_BODY_ARR: typeof TLV_BODY_ARR;
73
- declare const index_TLV_BODY_OBJ: typeof TLV_BODY_OBJ;
74
- declare const index_TLV_CAPSULE: typeof TLV_CAPSULE;
75
- declare const index_TLV_EFFECT: typeof TLV_EFFECT;
76
- declare const index_TLV_ERROR_CODE: typeof TLV_ERROR_CODE;
77
- declare const index_TLV_ERROR_MSG: typeof TLV_ERROR_MSG;
78
- declare const index_TLV_INDEX: typeof TLV_INDEX;
79
- declare const index_TLV_INTENT: typeof TLV_INTENT;
80
- declare const index_TLV_KID: typeof TLV_KID;
81
- declare const index_TLV_LOOM_PRESENCE_ID: typeof TLV_LOOM_PRESENCE_ID;
82
- declare const index_TLV_LOOM_THREAD_HASH: typeof TLV_LOOM_THREAD_HASH;
83
- declare const index_TLV_LOOM_WRIT: typeof TLV_LOOM_WRIT;
84
- declare const index_TLV_NODE: typeof TLV_NODE;
85
- declare const index_TLV_NODE_CERT_HASH: typeof TLV_NODE_CERT_HASH;
86
- declare const index_TLV_NODE_KID: typeof TLV_NODE_KID;
87
- declare const index_TLV_NONCE: typeof TLV_NONCE;
88
- declare const index_TLV_OFFSET: typeof TLV_OFFSET;
89
- declare const index_TLV_OK: typeof TLV_OK;
90
- declare const index_TLV_PID: typeof TLV_PID;
91
- declare const index_TLV_PREV_HASH: typeof TLV_PREV_HASH;
92
- declare const index_TLV_PROOF_REF: typeof TLV_PROOF_REF;
93
- declare const index_TLV_PROOF_TYPE: typeof TLV_PROOF_TYPE;
94
- declare const index_TLV_REALM: typeof TLV_REALM;
95
- declare const index_TLV_RECEIPT_HASH: typeof TLV_RECEIPT_HASH;
96
- declare const index_TLV_RID: typeof TLV_RID;
97
- declare const index_TLV_SHA256_CHUNK: typeof TLV_SHA256_CHUNK;
98
- declare const index_TLV_TRACE_ID: typeof TLV_TRACE_ID;
99
- declare const index_TLV_TS: typeof TLV_TS;
100
- declare const index_TLV_UPLOAD_ID: typeof TLV_UPLOAD_ID;
101
- declare const index_computeReceiptHash: typeof computeReceiptHash;
102
- declare const index_computeSignaturePayload: typeof computeSignaturePayload;
103
- declare const index_decodeArray: typeof decodeArray;
104
- declare const index_decodeFrame: typeof decodeFrame;
105
- declare const index_decodeObject: typeof decodeObject;
106
- declare const index_decodeTLVs: typeof decodeTLVs;
107
- declare const index_decodeTLVsList: typeof decodeTLVsList;
108
- declare const index_decodeVarint: typeof decodeVarint;
109
- declare const index_encodeFrame: typeof encodeFrame;
110
- declare const index_encodeTLVs: typeof encodeTLVs;
111
- declare const index_encodeVarint: typeof encodeVarint;
112
- declare const index_generateEd25519KeyPair: typeof generateEd25519KeyPair;
113
- declare const index_getSignTarget: typeof getSignTarget;
114
- declare const index_sha256: typeof sha256;
115
- declare const index_signFrame: typeof signFrame;
116
- declare const index_varintLength: typeof varintLength;
117
- declare const index_verifyFrameSignature: typeof verifyFrameSignature;
118
- declare namespace index {
119
- export { index_AXIS_MAGIC as AXIS_MAGIC, index_AXIS_VERSION as AXIS_VERSION, type index_AxisBinaryFrame as AxisBinaryFrame, index_AxisError as AxisError, type index_AxisFrame as AxisFrame, index_AxisFrameZ as AxisFrameZ, index_BodyProfile as BodyProfile, index_ERR_BAD_SIGNATURE as ERR_BAD_SIGNATURE, index_ERR_CONTRACT_VIOLATION as ERR_CONTRACT_VIOLATION, index_ERR_INVALID_PACKET as ERR_INVALID_PACKET, index_ERR_REPLAY_DETECTED as ERR_REPLAY_DETECTED, index_FLAG_BODY_TLV as FLAG_BODY_TLV, index_FLAG_CHAIN_REQ as FLAG_CHAIN_REQ, index_FLAG_HAS_WITNESS as FLAG_HAS_WITNESS, index_MAX_BODY_LEN as MAX_BODY_LEN, index_MAX_FRAME_LEN as MAX_FRAME_LEN, index_MAX_HDR_LEN as MAX_HDR_LEN, index_MAX_SIG_LEN as MAX_SIG_LEN, index_NCERT_ALG as NCERT_ALG, index_NCERT_EXP as NCERT_EXP, index_NCERT_ISSUER_KID as NCERT_ISSUER_KID, index_NCERT_KID as NCERT_KID, index_NCERT_NBF as NCERT_NBF, index_NCERT_NODE_ID as NCERT_NODE_ID, index_NCERT_PAYLOAD as NCERT_PAYLOAD, index_NCERT_PUB as NCERT_PUB, index_NCERT_SCOPE as NCERT_SCOPE, index_NCERT_SIG as NCERT_SIG, index_PROOF_CAPSULE as PROOF_CAPSULE, index_PROOF_JWT as PROOF_JWT, index_PROOF_LOOM as PROOF_LOOM, index_PROOF_MTLS as PROOF_MTLS, index_PROOF_NONE as PROOF_NONE, index_PROOF_WITNESS as PROOF_WITNESS, index_ProofType as ProofType, index_TLV as TLV, index_TLV_ACTOR_ID as TLV_ACTOR_ID, index_TLV_AUD as TLV_AUD, index_TLV_BODY_ARR as TLV_BODY_ARR, index_TLV_BODY_OBJ as TLV_BODY_OBJ, index_TLV_CAPSULE as TLV_CAPSULE, index_TLV_EFFECT as TLV_EFFECT, index_TLV_ERROR_CODE as TLV_ERROR_CODE, index_TLV_ERROR_MSG as TLV_ERROR_MSG, index_TLV_INDEX as TLV_INDEX, index_TLV_INTENT as TLV_INTENT, index_TLV_KID as TLV_KID, index_TLV_LOOM_PRESENCE_ID as TLV_LOOM_PRESENCE_ID, index_TLV_LOOM_THREAD_HASH as TLV_LOOM_THREAD_HASH, index_TLV_LOOM_WRIT as TLV_LOOM_WRIT, index_TLV_NODE as TLV_NODE, index_TLV_NODE_CERT_HASH as TLV_NODE_CERT_HASH, index_TLV_NODE_KID as TLV_NODE_KID, index_TLV_NONCE as TLV_NONCE, index_TLV_OFFSET as TLV_OFFSET, index_TLV_OK as TLV_OK, index_TLV_PID as TLV_PID, index_TLV_PREV_HASH as TLV_PREV_HASH, index_TLV_PROOF_REF as TLV_PROOF_REF, index_TLV_PROOF_TYPE as TLV_PROOF_TYPE, index_TLV_REALM as TLV_REALM, index_TLV_RECEIPT_HASH as TLV_RECEIPT_HASH, index_TLV_RID as TLV_RID, index_TLV_SHA256_CHUNK as TLV_SHA256_CHUNK, index_TLV_TRACE_ID as TLV_TRACE_ID, index_TLV_TS as TLV_TS, index_TLV_UPLOAD_ID as TLV_UPLOAD_ID, index_computeReceiptHash as computeReceiptHash, index_computeSignaturePayload as computeSignaturePayload, index_decodeArray as decodeArray, index_decodeFrame as decodeFrame, index_decodeObject as decodeObject, index_decodeTLVs as decodeTLVs, index_decodeTLVsList as decodeTLVsList, index_decodeVarint as decodeVarint, index_encodeFrame as encodeFrame, index_encodeTLVs as encodeTLVs, index_encodeVarint as encodeVarint, index_generateEd25519KeyPair as generateEd25519KeyPair, index_getSignTarget as getSignTarget, index_sha256 as sha256, index_signFrame as signFrame, index_varintLength as varintLength, index_verifyFrameSignature as verifyFrameSignature };
120
- }
121
-
122
- export { type AxisFrame as A, type AxisBinaryFrame as a, AxisError as b, AxisFrameZ as c, computeReceiptHash as d, computeSignaturePayload as e, decodeFrame as f, encodeFrame as g, generateEd25519KeyPair as h, index as i, getSignTarget as j, signFrame as k, sha256 as s, verifyFrameSignature as v };
@@ -1,122 +0,0 @@
1
- import { AXIS_MAGIC, AXIS_VERSION, BodyProfile, ERR_BAD_SIGNATURE, ERR_CONTRACT_VIOLATION, ERR_INVALID_PACKET, ERR_REPLAY_DETECTED, FLAG_BODY_TLV, FLAG_CHAIN_REQ, FLAG_HAS_WITNESS, MAX_BODY_LEN, MAX_FRAME_LEN, MAX_HDR_LEN, MAX_SIG_LEN, NCERT_ALG, NCERT_EXP, NCERT_ISSUER_KID, NCERT_KID, NCERT_NBF, NCERT_NODE_ID, NCERT_PAYLOAD, NCERT_PUB, NCERT_SCOPE, NCERT_SIG, PROOF_CAPSULE, PROOF_JWT, PROOF_LOOM, PROOF_MTLS, PROOF_NONE, PROOF_WITNESS, ProofType, TLV, TLV_ACTOR_ID, TLV_AUD, TLV_BODY_ARR, TLV_BODY_OBJ, TLV_CAPSULE, TLV_EFFECT, TLV_ERROR_CODE, TLV_ERROR_MSG, TLV_INDEX, TLV_INTENT, TLV_KID, TLV_LOOM_PRESENCE_ID, TLV_LOOM_THREAD_HASH, TLV_LOOM_WRIT, TLV_NODE, TLV_NODE_CERT_HASH, TLV_NODE_KID, TLV_NONCE, TLV_OFFSET, TLV_OK, TLV_PID, TLV_PREV_HASH, TLV_PROOF_REF, TLV_PROOF_TYPE, TLV_REALM, TLV_RECEIPT_HASH, TLV_RID, TLV_SHA256_CHUNK, TLV_TRACE_ID, TLV_TS, TLV_UPLOAD_ID, decodeArray, decodeObject, decodeTLVs, decodeTLVsList, decodeVarint, encodeTLVs, encodeVarint, varintLength } from '@nextera.one/axis-protocol';
2
- import * as z from 'zod';
3
-
4
- declare const AxisFrameZ: z.ZodObject<{
5
- flags: z.ZodNumber;
6
- headers: z.ZodMap<z.ZodNumber, z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>>;
7
- body: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
8
- sig: z.ZodCustom<Uint8Array<ArrayBufferLike>, Uint8Array<ArrayBufferLike>>;
9
- }, z.core.$strip>;
10
- type AxisFrame = z.infer<typeof AxisFrameZ>;
11
- type AxisBinaryFrame = AxisFrame;
12
- declare function encodeFrame(frame: AxisFrame): Uint8Array;
13
- declare function decodeFrame(buf: Uint8Array): AxisFrame;
14
- declare function getSignTarget(frame: AxisFrame): Uint8Array;
15
-
16
- declare function computeSignaturePayload(frame: AxisFrame): Buffer;
17
- declare function signFrame(frame: AxisFrame, privateKey: Buffer): Buffer;
18
- declare function verifyFrameSignature(frame: AxisFrame, publicKey: Buffer): boolean;
19
- declare function generateEd25519KeyPair(): {
20
- privateKey: Buffer;
21
- publicKey: Buffer;
22
- };
23
- declare function sha256(data: Buffer | Uint8Array): Buffer;
24
- declare function computeReceiptHash(receiptBytes: Buffer | Uint8Array, prevHash?: Buffer | Uint8Array): Buffer;
25
-
26
- declare class AxisError extends Error {
27
- code: string;
28
- httpStatus: number;
29
- details?: Record<string, any> | undefined;
30
- constructor(code: string, message: string, httpStatus?: number, details?: Record<string, any> | undefined);
31
- }
32
-
33
- declare const index_AXIS_MAGIC: typeof AXIS_MAGIC;
34
- declare const index_AXIS_VERSION: typeof AXIS_VERSION;
35
- type index_AxisBinaryFrame = AxisBinaryFrame;
36
- type index_AxisError = AxisError;
37
- declare const index_AxisError: typeof AxisError;
38
- type index_AxisFrame = AxisFrame;
39
- declare const index_AxisFrameZ: typeof AxisFrameZ;
40
- declare const index_BodyProfile: typeof BodyProfile;
41
- declare const index_ERR_BAD_SIGNATURE: typeof ERR_BAD_SIGNATURE;
42
- declare const index_ERR_CONTRACT_VIOLATION: typeof ERR_CONTRACT_VIOLATION;
43
- declare const index_ERR_INVALID_PACKET: typeof ERR_INVALID_PACKET;
44
- declare const index_ERR_REPLAY_DETECTED: typeof ERR_REPLAY_DETECTED;
45
- declare const index_FLAG_BODY_TLV: typeof FLAG_BODY_TLV;
46
- declare const index_FLAG_CHAIN_REQ: typeof FLAG_CHAIN_REQ;
47
- declare const index_FLAG_HAS_WITNESS: typeof FLAG_HAS_WITNESS;
48
- declare const index_MAX_BODY_LEN: typeof MAX_BODY_LEN;
49
- declare const index_MAX_FRAME_LEN: typeof MAX_FRAME_LEN;
50
- declare const index_MAX_HDR_LEN: typeof MAX_HDR_LEN;
51
- declare const index_MAX_SIG_LEN: typeof MAX_SIG_LEN;
52
- declare const index_NCERT_ALG: typeof NCERT_ALG;
53
- declare const index_NCERT_EXP: typeof NCERT_EXP;
54
- declare const index_NCERT_ISSUER_KID: typeof NCERT_ISSUER_KID;
55
- declare const index_NCERT_KID: typeof NCERT_KID;
56
- declare const index_NCERT_NBF: typeof NCERT_NBF;
57
- declare const index_NCERT_NODE_ID: typeof NCERT_NODE_ID;
58
- declare const index_NCERT_PAYLOAD: typeof NCERT_PAYLOAD;
59
- declare const index_NCERT_PUB: typeof NCERT_PUB;
60
- declare const index_NCERT_SCOPE: typeof NCERT_SCOPE;
61
- declare const index_NCERT_SIG: typeof NCERT_SIG;
62
- declare const index_PROOF_CAPSULE: typeof PROOF_CAPSULE;
63
- declare const index_PROOF_JWT: typeof PROOF_JWT;
64
- declare const index_PROOF_LOOM: typeof PROOF_LOOM;
65
- declare const index_PROOF_MTLS: typeof PROOF_MTLS;
66
- declare const index_PROOF_NONE: typeof PROOF_NONE;
67
- declare const index_PROOF_WITNESS: typeof PROOF_WITNESS;
68
- declare const index_ProofType: typeof ProofType;
69
- declare const index_TLV: typeof TLV;
70
- declare const index_TLV_ACTOR_ID: typeof TLV_ACTOR_ID;
71
- declare const index_TLV_AUD: typeof TLV_AUD;
72
- declare const index_TLV_BODY_ARR: typeof TLV_BODY_ARR;
73
- declare const index_TLV_BODY_OBJ: typeof TLV_BODY_OBJ;
74
- declare const index_TLV_CAPSULE: typeof TLV_CAPSULE;
75
- declare const index_TLV_EFFECT: typeof TLV_EFFECT;
76
- declare const index_TLV_ERROR_CODE: typeof TLV_ERROR_CODE;
77
- declare const index_TLV_ERROR_MSG: typeof TLV_ERROR_MSG;
78
- declare const index_TLV_INDEX: typeof TLV_INDEX;
79
- declare const index_TLV_INTENT: typeof TLV_INTENT;
80
- declare const index_TLV_KID: typeof TLV_KID;
81
- declare const index_TLV_LOOM_PRESENCE_ID: typeof TLV_LOOM_PRESENCE_ID;
82
- declare const index_TLV_LOOM_THREAD_HASH: typeof TLV_LOOM_THREAD_HASH;
83
- declare const index_TLV_LOOM_WRIT: typeof TLV_LOOM_WRIT;
84
- declare const index_TLV_NODE: typeof TLV_NODE;
85
- declare const index_TLV_NODE_CERT_HASH: typeof TLV_NODE_CERT_HASH;
86
- declare const index_TLV_NODE_KID: typeof TLV_NODE_KID;
87
- declare const index_TLV_NONCE: typeof TLV_NONCE;
88
- declare const index_TLV_OFFSET: typeof TLV_OFFSET;
89
- declare const index_TLV_OK: typeof TLV_OK;
90
- declare const index_TLV_PID: typeof TLV_PID;
91
- declare const index_TLV_PREV_HASH: typeof TLV_PREV_HASH;
92
- declare const index_TLV_PROOF_REF: typeof TLV_PROOF_REF;
93
- declare const index_TLV_PROOF_TYPE: typeof TLV_PROOF_TYPE;
94
- declare const index_TLV_REALM: typeof TLV_REALM;
95
- declare const index_TLV_RECEIPT_HASH: typeof TLV_RECEIPT_HASH;
96
- declare const index_TLV_RID: typeof TLV_RID;
97
- declare const index_TLV_SHA256_CHUNK: typeof TLV_SHA256_CHUNK;
98
- declare const index_TLV_TRACE_ID: typeof TLV_TRACE_ID;
99
- declare const index_TLV_TS: typeof TLV_TS;
100
- declare const index_TLV_UPLOAD_ID: typeof TLV_UPLOAD_ID;
101
- declare const index_computeReceiptHash: typeof computeReceiptHash;
102
- declare const index_computeSignaturePayload: typeof computeSignaturePayload;
103
- declare const index_decodeArray: typeof decodeArray;
104
- declare const index_decodeFrame: typeof decodeFrame;
105
- declare const index_decodeObject: typeof decodeObject;
106
- declare const index_decodeTLVs: typeof decodeTLVs;
107
- declare const index_decodeTLVsList: typeof decodeTLVsList;
108
- declare const index_decodeVarint: typeof decodeVarint;
109
- declare const index_encodeFrame: typeof encodeFrame;
110
- declare const index_encodeTLVs: typeof encodeTLVs;
111
- declare const index_encodeVarint: typeof encodeVarint;
112
- declare const index_generateEd25519KeyPair: typeof generateEd25519KeyPair;
113
- declare const index_getSignTarget: typeof getSignTarget;
114
- declare const index_sha256: typeof sha256;
115
- declare const index_signFrame: typeof signFrame;
116
- declare const index_varintLength: typeof varintLength;
117
- declare const index_verifyFrameSignature: typeof verifyFrameSignature;
118
- declare namespace index {
119
- export { index_AXIS_MAGIC as AXIS_MAGIC, index_AXIS_VERSION as AXIS_VERSION, type index_AxisBinaryFrame as AxisBinaryFrame, index_AxisError as AxisError, type index_AxisFrame as AxisFrame, index_AxisFrameZ as AxisFrameZ, index_BodyProfile as BodyProfile, index_ERR_BAD_SIGNATURE as ERR_BAD_SIGNATURE, index_ERR_CONTRACT_VIOLATION as ERR_CONTRACT_VIOLATION, index_ERR_INVALID_PACKET as ERR_INVALID_PACKET, index_ERR_REPLAY_DETECTED as ERR_REPLAY_DETECTED, index_FLAG_BODY_TLV as FLAG_BODY_TLV, index_FLAG_CHAIN_REQ as FLAG_CHAIN_REQ, index_FLAG_HAS_WITNESS as FLAG_HAS_WITNESS, index_MAX_BODY_LEN as MAX_BODY_LEN, index_MAX_FRAME_LEN as MAX_FRAME_LEN, index_MAX_HDR_LEN as MAX_HDR_LEN, index_MAX_SIG_LEN as MAX_SIG_LEN, index_NCERT_ALG as NCERT_ALG, index_NCERT_EXP as NCERT_EXP, index_NCERT_ISSUER_KID as NCERT_ISSUER_KID, index_NCERT_KID as NCERT_KID, index_NCERT_NBF as NCERT_NBF, index_NCERT_NODE_ID as NCERT_NODE_ID, index_NCERT_PAYLOAD as NCERT_PAYLOAD, index_NCERT_PUB as NCERT_PUB, index_NCERT_SCOPE as NCERT_SCOPE, index_NCERT_SIG as NCERT_SIG, index_PROOF_CAPSULE as PROOF_CAPSULE, index_PROOF_JWT as PROOF_JWT, index_PROOF_LOOM as PROOF_LOOM, index_PROOF_MTLS as PROOF_MTLS, index_PROOF_NONE as PROOF_NONE, index_PROOF_WITNESS as PROOF_WITNESS, index_ProofType as ProofType, index_TLV as TLV, index_TLV_ACTOR_ID as TLV_ACTOR_ID, index_TLV_AUD as TLV_AUD, index_TLV_BODY_ARR as TLV_BODY_ARR, index_TLV_BODY_OBJ as TLV_BODY_OBJ, index_TLV_CAPSULE as TLV_CAPSULE, index_TLV_EFFECT as TLV_EFFECT, index_TLV_ERROR_CODE as TLV_ERROR_CODE, index_TLV_ERROR_MSG as TLV_ERROR_MSG, index_TLV_INDEX as TLV_INDEX, index_TLV_INTENT as TLV_INTENT, index_TLV_KID as TLV_KID, index_TLV_LOOM_PRESENCE_ID as TLV_LOOM_PRESENCE_ID, index_TLV_LOOM_THREAD_HASH as TLV_LOOM_THREAD_HASH, index_TLV_LOOM_WRIT as TLV_LOOM_WRIT, index_TLV_NODE as TLV_NODE, index_TLV_NODE_CERT_HASH as TLV_NODE_CERT_HASH, index_TLV_NODE_KID as TLV_NODE_KID, index_TLV_NONCE as TLV_NONCE, index_TLV_OFFSET as TLV_OFFSET, index_TLV_OK as TLV_OK, index_TLV_PID as TLV_PID, index_TLV_PREV_HASH as TLV_PREV_HASH, index_TLV_PROOF_REF as TLV_PROOF_REF, index_TLV_PROOF_TYPE as TLV_PROOF_TYPE, index_TLV_REALM as TLV_REALM, index_TLV_RECEIPT_HASH as TLV_RECEIPT_HASH, index_TLV_RID as TLV_RID, index_TLV_SHA256_CHUNK as TLV_SHA256_CHUNK, index_TLV_TRACE_ID as TLV_TRACE_ID, index_TLV_TS as TLV_TS, index_TLV_UPLOAD_ID as TLV_UPLOAD_ID, index_computeReceiptHash as computeReceiptHash, index_computeSignaturePayload as computeSignaturePayload, index_decodeArray as decodeArray, index_decodeFrame as decodeFrame, index_decodeObject as decodeObject, index_decodeTLVs as decodeTLVs, index_decodeTLVsList as decodeTLVsList, index_decodeVarint as decodeVarint, index_encodeFrame as encodeFrame, index_encodeTLVs as encodeTLVs, index_encodeVarint as encodeVarint, index_generateEd25519KeyPair as generateEd25519KeyPair, index_getSignTarget as getSignTarget, index_sha256 as sha256, index_signFrame as signFrame, index_varintLength as varintLength, index_verifyFrameSignature as verifyFrameSignature };
120
- }
121
-
122
- export { type AxisFrame as A, type AxisBinaryFrame as a, AxisError as b, AxisFrameZ as c, computeReceiptHash as d, computeSignaturePayload as e, decodeFrame as f, encodeFrame as g, generateEd25519KeyPair as h, index as i, getSignTarget as j, signFrame as k, sha256 as s, verifyFrameSignature as v };