@nextera.one/axis-server-sdk 1.0.0 → 1.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.
@@ -1,3 +1,4 @@
1
+ export { 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';
1
2
  import * as z from 'zod';
2
3
 
3
4
  declare const AxisFrameZ: z.ZodObject<{
@@ -12,101 +13,6 @@ declare function encodeFrame(frame: AxisFrame): Uint8Array;
12
13
  declare function decodeFrame(buf: Uint8Array): AxisFrame;
13
14
  declare function getSignTarget(frame: AxisFrame): Uint8Array;
14
15
 
15
- declare const AXIS_MAGIC: Uint8Array<ArrayBuffer>;
16
- declare const AXIS_VERSION = 1;
17
- declare const MAX_HDR_LEN = 2048;
18
- declare const MAX_BODY_LEN = 65536;
19
- declare const MAX_SIG_LEN = 128;
20
- declare const MAX_FRAME_LEN: number;
21
- declare const FLAG_BODY_TLV = 1;
22
- declare const FLAG_CHAIN_REQ = 2;
23
- declare const FLAG_HAS_WITNESS = 4;
24
- declare const TLV_PID = 1;
25
- declare const TLV_TS = 2;
26
- declare const TLV_INTENT = 3;
27
- declare const TLV_ACTOR_ID = 4;
28
- declare const TLV_PROOF_TYPE = 5;
29
- declare const TLV_PROOF_REF = 6;
30
- declare const TLV_NONCE = 7;
31
- declare const TLV_AUD = 8;
32
- declare const TLV_REALM = 8;
33
- declare const TLV_NODE = 9;
34
- declare const TLV_TRACE_ID = 10;
35
- declare const TLV_KID = 11;
36
- declare const TLV_RID = 15;
37
- declare const TLV_OK = 16;
38
- declare const TLV_EFFECT = 17;
39
- declare const TLV_ERROR_CODE = 18;
40
- declare const TLV_ERROR_MSG = 19;
41
- declare const TLV_PREV_HASH = 20;
42
- declare const TLV_RECEIPT_HASH = 21;
43
- declare const TLV_NODE_KID = 30;
44
- declare const TLV_NODE_CERT_HASH = 34;
45
- declare const TLV_LOOM_PRESENCE_ID = 91;
46
- declare const TLV_LOOM_WRIT = 92;
47
- declare const TLV_LOOM_THREAD_HASH = 93;
48
- declare const TLV_UPLOAD_ID = 70;
49
- declare const TLV_INDEX = 71;
50
- declare const TLV_OFFSET = 72;
51
- declare const TLV_SHA256_CHUNK = 73;
52
- declare const TLV_CAPSULE = 90;
53
- declare const TLV_BODY_OBJ = 254;
54
- declare const TLV_BODY_ARR = 255;
55
- declare const NCERT_NODE_ID = 1;
56
- declare const NCERT_KID = 2;
57
- declare const NCERT_ALG = 3;
58
- declare const NCERT_PUB = 4;
59
- declare const NCERT_NBF = 5;
60
- declare const NCERT_EXP = 6;
61
- declare const NCERT_SCOPE = 7;
62
- declare const NCERT_ISSUER_KID = 8;
63
- declare const NCERT_PAYLOAD = 50;
64
- declare const NCERT_SIG = 51;
65
- declare const PROOF_NONE = 0;
66
- declare const PROOF_CAPSULE = 1;
67
- declare const PROOF_JWT = 2;
68
- declare const PROOF_MTLS = 3;
69
- declare const PROOF_LOOM = 4;
70
- declare const PROOF_WITNESS = 5;
71
- declare enum ProofType {
72
- NONE = 0,
73
- CAPSULE = 1,
74
- JWT = 2,
75
- MTLS = 3,
76
- LOOM = 4,
77
- WITNESS = 5
78
- }
79
- declare enum BodyProfile {
80
- RAW = 0,
81
- TLV_MAP = 1,
82
- OBJ = 2,
83
- ARR = 3
84
- }
85
- declare const ERR_INVALID_PACKET = "INVALID_PACKET";
86
- declare const ERR_BAD_SIGNATURE = "BAD_SIGNATURE";
87
- declare const ERR_REPLAY_DETECTED = "REPLAY_DETECTED";
88
- declare const ERR_CONTRACT_VIOLATION = "CONTRACT_VIOLATION";
89
-
90
- declare function encodeVarint(value: number): Uint8Array;
91
- declare function decodeVarint(buf: Uint8Array, offset?: number): {
92
- value: number;
93
- length: number;
94
- };
95
- declare function varintLength(value: number): number;
96
-
97
- interface TLV {
98
- type: number;
99
- value: Uint8Array;
100
- }
101
- declare function encodeTLVs(tlvs: TLV[]): Uint8Array;
102
- declare function decodeTLVsList(buf: Uint8Array, maxItems?: number): TLV[];
103
- declare function decodeTLVs(buf: Uint8Array): Map<number, Uint8Array>;
104
- declare function decodeObject(bytes: Uint8Array, depth?: number, limits?: {
105
- maxDepth: number;
106
- maxItems: number;
107
- }): Map<number, any>;
108
- declare function decodeArray(bytes: Uint8Array, itemType: number, maxItems?: number): Uint8Array[];
109
-
110
16
  declare function computeSignaturePayload(frame: AxisFrame): Buffer;
111
17
  declare function signFrame(frame: AxisFrame, privateKey: Buffer): Buffer;
112
18
  declare function verifyFrameSignature(frame: AxisFrame, publicKey: Buffer): boolean;
@@ -117,4 +23,4 @@ declare function generateEd25519KeyPair(): {
117
23
  declare function sha256(data: Buffer | Uint8Array): Buffer;
118
24
  declare function computeReceiptHash(receiptBytes: Buffer | Uint8Array, prevHash?: Buffer | Uint8Array): Buffer;
119
25
 
120
- export { AXIS_MAGIC, AXIS_VERSION, type AxisBinaryFrame, type AxisFrame, AxisFrameZ, 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, type 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, computeReceiptHash, computeSignaturePayload, decodeArray, decodeFrame, decodeObject, decodeTLVs, decodeTLVsList, decodeVarint, encodeFrame, encodeTLVs, encodeVarint, generateEd25519KeyPair, getSignTarget, sha256, signFrame, varintLength, verifyFrameSignature };
26
+ export { type AxisBinaryFrame, type AxisFrame, AxisFrameZ, computeReceiptHash, computeSignaturePayload, decodeFrame, encodeFrame, generateEd25519KeyPair, getSignTarget, sha256, signFrame, verifyFrameSignature };
@@ -1,3 +1,4 @@
1
+ export { 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';
1
2
  import * as z from 'zod';
2
3
 
3
4
  declare const AxisFrameZ: z.ZodObject<{
@@ -12,101 +13,6 @@ declare function encodeFrame(frame: AxisFrame): Uint8Array;
12
13
  declare function decodeFrame(buf: Uint8Array): AxisFrame;
13
14
  declare function getSignTarget(frame: AxisFrame): Uint8Array;
14
15
 
15
- declare const AXIS_MAGIC: Uint8Array<ArrayBuffer>;
16
- declare const AXIS_VERSION = 1;
17
- declare const MAX_HDR_LEN = 2048;
18
- declare const MAX_BODY_LEN = 65536;
19
- declare const MAX_SIG_LEN = 128;
20
- declare const MAX_FRAME_LEN: number;
21
- declare const FLAG_BODY_TLV = 1;
22
- declare const FLAG_CHAIN_REQ = 2;
23
- declare const FLAG_HAS_WITNESS = 4;
24
- declare const TLV_PID = 1;
25
- declare const TLV_TS = 2;
26
- declare const TLV_INTENT = 3;
27
- declare const TLV_ACTOR_ID = 4;
28
- declare const TLV_PROOF_TYPE = 5;
29
- declare const TLV_PROOF_REF = 6;
30
- declare const TLV_NONCE = 7;
31
- declare const TLV_AUD = 8;
32
- declare const TLV_REALM = 8;
33
- declare const TLV_NODE = 9;
34
- declare const TLV_TRACE_ID = 10;
35
- declare const TLV_KID = 11;
36
- declare const TLV_RID = 15;
37
- declare const TLV_OK = 16;
38
- declare const TLV_EFFECT = 17;
39
- declare const TLV_ERROR_CODE = 18;
40
- declare const TLV_ERROR_MSG = 19;
41
- declare const TLV_PREV_HASH = 20;
42
- declare const TLV_RECEIPT_HASH = 21;
43
- declare const TLV_NODE_KID = 30;
44
- declare const TLV_NODE_CERT_HASH = 34;
45
- declare const TLV_LOOM_PRESENCE_ID = 91;
46
- declare const TLV_LOOM_WRIT = 92;
47
- declare const TLV_LOOM_THREAD_HASH = 93;
48
- declare const TLV_UPLOAD_ID = 70;
49
- declare const TLV_INDEX = 71;
50
- declare const TLV_OFFSET = 72;
51
- declare const TLV_SHA256_CHUNK = 73;
52
- declare const TLV_CAPSULE = 90;
53
- declare const TLV_BODY_OBJ = 254;
54
- declare const TLV_BODY_ARR = 255;
55
- declare const NCERT_NODE_ID = 1;
56
- declare const NCERT_KID = 2;
57
- declare const NCERT_ALG = 3;
58
- declare const NCERT_PUB = 4;
59
- declare const NCERT_NBF = 5;
60
- declare const NCERT_EXP = 6;
61
- declare const NCERT_SCOPE = 7;
62
- declare const NCERT_ISSUER_KID = 8;
63
- declare const NCERT_PAYLOAD = 50;
64
- declare const NCERT_SIG = 51;
65
- declare const PROOF_NONE = 0;
66
- declare const PROOF_CAPSULE = 1;
67
- declare const PROOF_JWT = 2;
68
- declare const PROOF_MTLS = 3;
69
- declare const PROOF_LOOM = 4;
70
- declare const PROOF_WITNESS = 5;
71
- declare enum ProofType {
72
- NONE = 0,
73
- CAPSULE = 1,
74
- JWT = 2,
75
- MTLS = 3,
76
- LOOM = 4,
77
- WITNESS = 5
78
- }
79
- declare enum BodyProfile {
80
- RAW = 0,
81
- TLV_MAP = 1,
82
- OBJ = 2,
83
- ARR = 3
84
- }
85
- declare const ERR_INVALID_PACKET = "INVALID_PACKET";
86
- declare const ERR_BAD_SIGNATURE = "BAD_SIGNATURE";
87
- declare const ERR_REPLAY_DETECTED = "REPLAY_DETECTED";
88
- declare const ERR_CONTRACT_VIOLATION = "CONTRACT_VIOLATION";
89
-
90
- declare function encodeVarint(value: number): Uint8Array;
91
- declare function decodeVarint(buf: Uint8Array, offset?: number): {
92
- value: number;
93
- length: number;
94
- };
95
- declare function varintLength(value: number): number;
96
-
97
- interface TLV {
98
- type: number;
99
- value: Uint8Array;
100
- }
101
- declare function encodeTLVs(tlvs: TLV[]): Uint8Array;
102
- declare function decodeTLVsList(buf: Uint8Array, maxItems?: number): TLV[];
103
- declare function decodeTLVs(buf: Uint8Array): Map<number, Uint8Array>;
104
- declare function decodeObject(bytes: Uint8Array, depth?: number, limits?: {
105
- maxDepth: number;
106
- maxItems: number;
107
- }): Map<number, any>;
108
- declare function decodeArray(bytes: Uint8Array, itemType: number, maxItems?: number): Uint8Array[];
109
-
110
16
  declare function computeSignaturePayload(frame: AxisFrame): Buffer;
111
17
  declare function signFrame(frame: AxisFrame, privateKey: Buffer): Buffer;
112
18
  declare function verifyFrameSignature(frame: AxisFrame, publicKey: Buffer): boolean;
@@ -117,4 +23,4 @@ declare function generateEd25519KeyPair(): {
117
23
  declare function sha256(data: Buffer | Uint8Array): Buffer;
118
24
  declare function computeReceiptHash(receiptBytes: Buffer | Uint8Array, prevHash?: Buffer | Uint8Array): Buffer;
119
25
 
120
- export { AXIS_MAGIC, AXIS_VERSION, type AxisBinaryFrame, type AxisFrame, AxisFrameZ, 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, type 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, computeReceiptHash, computeSignaturePayload, decodeArray, decodeFrame, decodeObject, decodeTLVs, decodeTLVsList, decodeVarint, encodeFrame, encodeTLVs, encodeVarint, generateEd25519KeyPair, getSignTarget, sha256, signFrame, varintLength, verifyFrameSignature };
26
+ export { type AxisBinaryFrame, type AxisFrame, AxisFrameZ, computeReceiptHash, computeSignaturePayload, decodeFrame, encodeFrame, generateEd25519KeyPair, getSignTarget, sha256, signFrame, verifyFrameSignature };