@nextera.one/axis-server-sdk 2.2.0 → 2.2.2

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.
Files changed (53) hide show
  1. package/dist/axis-sensor-GBEI3Fab.d.mts +209 -0
  2. package/dist/axis-sensor-GBEI3Fab.d.ts +209 -0
  3. package/dist/cce/index.d.mts +162 -0
  4. package/dist/cce/index.d.ts +162 -0
  5. package/dist/cce/index.js +1502 -0
  6. package/dist/cce/index.js.map +1 -0
  7. package/dist/cce/index.mjs +1442 -0
  8. package/dist/cce/index.mjs.map +1 -0
  9. package/dist/cce-pipeline-B-zUBHo3.d.mts +294 -0
  10. package/dist/cce-pipeline-DbGBSsCG.d.ts +294 -0
  11. package/dist/core/index.d.mts +23 -2
  12. package/dist/core/index.d.ts +23 -2
  13. package/dist/idel/index.d.mts +24 -0
  14. package/dist/idel/index.d.ts +24 -0
  15. package/dist/idel/index.js +306 -0
  16. package/dist/idel/index.js.map +1 -0
  17. package/dist/idel/index.mjs +279 -0
  18. package/dist/idel/index.mjs.map +1 -0
  19. package/dist/idel.types-DuUAcOnQ.d.mts +83 -0
  20. package/dist/idel.types-DuUAcOnQ.d.ts +83 -0
  21. package/dist/index-B2G6cbRL.d.mts +824 -0
  22. package/dist/index-DbSxdR0f.d.ts +824 -0
  23. package/dist/index-_S4fmVUJ.d.mts +501 -0
  24. package/dist/index-l3Hhirqb.d.ts +501 -0
  25. package/dist/index.d.mts +91 -3501
  26. package/dist/index.d.ts +91 -3501
  27. package/dist/index.js +5052 -4618
  28. package/dist/index.js.map +1 -1
  29. package/dist/index.mjs +5018 -4597
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/needle/index.d.mts +4 -0
  32. package/dist/needle/index.d.ts +4 -0
  33. package/dist/needle/index.js +3499 -0
  34. package/dist/needle/index.js.map +1 -0
  35. package/dist/needle/index.mjs +3528 -0
  36. package/dist/needle/index.mjs.map +1 -0
  37. package/dist/sensors/index.d.mts +5 -0
  38. package/dist/sensors/index.d.ts +5 -0
  39. package/dist/sensors/index.js +12860 -0
  40. package/dist/sensors/index.js.map +1 -0
  41. package/dist/sensors/index.mjs +12928 -0
  42. package/dist/sensors/index.mjs.map +1 -0
  43. package/dist/timeline/index.d.mts +54 -0
  44. package/dist/timeline/index.d.ts +54 -0
  45. package/dist/timeline/index.js +389 -0
  46. package/dist/timeline/index.js.map +1 -0
  47. package/dist/timeline/index.mjs +362 -0
  48. package/dist/timeline/index.mjs.map +1 -0
  49. package/dist/timeline.types-Cn0aqbUj.d.mts +125 -0
  50. package/dist/timeline.types-Cn0aqbUj.d.ts +125 -0
  51. package/package.json +28 -10
  52. package/dist/index-VxXqZPuH.d.mts +0 -51
  53. package/dist/index-VxXqZPuH.d.ts +0 -51
@@ -0,0 +1,294 @@
1
+ import { A as AxisSensor } from './axis-sensor-GBEI3Fab.js';
2
+
3
+ declare const CCE_PROTOCOL_VERSION: "cce-v1";
4
+ declare const CCE_DERIVATION: {
5
+ readonly REQUEST: "axis:cce:req:v1";
6
+ readonly RESPONSE: "axis:cce:resp:v1";
7
+ readonly WITNESS: "axis:cce:witness:v1";
8
+ };
9
+ type CceAlgorithm = "AES-256-GCM";
10
+ type CceKemAlgorithm = "X25519" | "RSA-OAEP-256";
11
+ type CceKdfAlgorithm = "HKDF-SHA256";
12
+ declare const CCE_AES_KEY_BYTES = 32;
13
+ declare const CCE_IV_BYTES = 12;
14
+ declare const CCE_TAG_BYTES = 16;
15
+ declare const CCE_NONCE_BYTES = 32;
16
+ interface CceCapsuleClaims {
17
+ capsule_id: string;
18
+ ver: typeof CCE_PROTOCOL_VERSION;
19
+ sub: string;
20
+ kid: string;
21
+ intent: string;
22
+ aud: string;
23
+ tps_from: number;
24
+ tps_to: number;
25
+ capsule_nonce: string;
26
+ challenge_id: string;
27
+ proof_hash?: string;
28
+ policy_hash?: string;
29
+ iat: number;
30
+ exp: number;
31
+ mode: "SINGLE_USE" | "SESSION";
32
+ scope?: string[];
33
+ constraints?: CceConstraints;
34
+ issuer_sig: CceSignature;
35
+ }
36
+ interface CceConstraints {
37
+ max_payload_bytes?: number;
38
+ ip_allow?: string[];
39
+ device_allow?: string[];
40
+ country_allow?: string[];
41
+ }
42
+ interface CceSignature {
43
+ alg: "EdDSA" | "ES256";
44
+ kid: string;
45
+ value: string;
46
+ }
47
+ interface CceRequestEnvelope {
48
+ ver: typeof CCE_PROTOCOL_VERSION;
49
+ request_id: string;
50
+ correlation_id: string;
51
+ client_kid: string;
52
+ capsule: CceCapsuleClaims;
53
+ encrypted_key: CceEncryptedKey;
54
+ encrypted_payload: CceEncryptedPayload;
55
+ request_nonce: string;
56
+ client_sig: CceSignature;
57
+ content_type: string;
58
+ algorithms: CceAlgorithmDescriptor;
59
+ aad_descriptor?: string;
60
+ }
61
+ interface CceEncryptedKey {
62
+ alg: CceKemAlgorithm;
63
+ axis_kid: string;
64
+ ciphertext: string;
65
+ ephemeral_pk?: string;
66
+ }
67
+ interface CceEncryptedPayload {
68
+ alg: CceAlgorithm;
69
+ iv: string;
70
+ ciphertext: string;
71
+ tag: string;
72
+ }
73
+ interface CceAlgorithmDescriptor {
74
+ kem: CceKemAlgorithm;
75
+ enc: CceAlgorithm;
76
+ kdf: CceKdfAlgorithm;
77
+ sig: "EdDSA" | "ES256";
78
+ }
79
+ interface CceResponseEnvelope {
80
+ ver: typeof CCE_PROTOCOL_VERSION;
81
+ response_id: string;
82
+ request_id: string;
83
+ correlation_id: string;
84
+ capsule_id: string;
85
+ encrypted_key: CceEncryptedKey;
86
+ encrypted_payload: CceEncryptedPayload;
87
+ response_nonce: string;
88
+ axis_sig: CceSignature;
89
+ witness_ref?: string;
90
+ algorithms: CceAlgorithmDescriptor;
91
+ status: CceResponseStatus;
92
+ }
93
+ type CceResponseStatus = "SUCCESS" | "DENIED" | "PARTIAL" | "FAILED" | "ERROR";
94
+ interface CceExecutionContext {
95
+ execution_key_hash: string;
96
+ request_id: string;
97
+ capsule_id: string;
98
+ sub: string;
99
+ kid: string;
100
+ intent: string;
101
+ aud: string;
102
+ tps_from: number;
103
+ tps_to: number;
104
+ policy_hash?: string;
105
+ derived_at: number;
106
+ valid: boolean;
107
+ }
108
+ interface CceWitnessRecord {
109
+ witness_id: string;
110
+ request_id: string;
111
+ capsule_id: string;
112
+ sub: string;
113
+ intent: string;
114
+ aud: string;
115
+ tps_from: number;
116
+ tps_to: number;
117
+ timestamp: number;
118
+ verification: {
119
+ client_sig: boolean;
120
+ capsule_sig: boolean;
121
+ tps_valid: boolean;
122
+ audience_match: boolean;
123
+ intent_match: boolean;
124
+ replay_clean: boolean;
125
+ nonce_unique: boolean;
126
+ decryption_ok: boolean;
127
+ };
128
+ execution: {
129
+ status: CceResponseStatus;
130
+ handler_duration_ms: number;
131
+ effect?: string;
132
+ };
133
+ response_encrypted: boolean;
134
+ execution_context_hash: string;
135
+ request_payload_hash?: string;
136
+ response_payload_hash?: string;
137
+ }
138
+ declare const CCE_ERROR: {
139
+ readonly INVALID_ENVELOPE: "CCE_INVALID_ENVELOPE";
140
+ readonly UNSUPPORTED_VERSION: "CCE_UNSUPPORTED_VERSION";
141
+ readonly MISSING_CAPSULE: "CCE_MISSING_CAPSULE";
142
+ readonly MISSING_ENCRYPTED_KEY: "CCE_MISSING_ENCRYPTED_KEY";
143
+ readonly CLIENT_SIG_INVALID: "CCE_CLIENT_SIG_INVALID";
144
+ readonly CLIENT_KEY_NOT_FOUND: "CCE_CLIENT_KEY_NOT_FOUND";
145
+ readonly CAPSULE_SIG_INVALID: "CCE_CAPSULE_SIG_INVALID";
146
+ readonly CAPSULE_EXPIRED: "CCE_CAPSULE_EXPIRED";
147
+ readonly CAPSULE_NOT_YET_VALID: "CCE_CAPSULE_NOT_YET_VALID";
148
+ readonly CAPSULE_REVOKED: "CCE_CAPSULE_REVOKED";
149
+ readonly CAPSULE_CONSUMED: "CCE_CAPSULE_CONSUMED";
150
+ readonly AUDIENCE_MISMATCH: "CCE_AUDIENCE_MISMATCH";
151
+ readonly INTENT_MISMATCH: "CCE_INTENT_MISMATCH";
152
+ readonly TPS_WINDOW_EXPIRED: "CCE_TPS_WINDOW_EXPIRED";
153
+ readonly TPS_WINDOW_FUTURE: "CCE_TPS_WINDOW_FUTURE";
154
+ readonly REPLAY_DETECTED: "CCE_REPLAY_DETECTED";
155
+ readonly NONCE_REUSED: "CCE_NONCE_REUSED";
156
+ readonly DECRYPTION_FAILED: "CCE_DECRYPTION_FAILED";
157
+ readonly KEY_UNWRAP_FAILED: "CCE_KEY_UNWRAP_FAILED";
158
+ readonly AEAD_TAG_MISMATCH: "CCE_AEAD_TAG_MISMATCH";
159
+ readonly PAYLOAD_TOO_LARGE: "CCE_PAYLOAD_TOO_LARGE";
160
+ readonly PAYLOAD_SCHEMA_INVALID: "CCE_PAYLOAD_SCHEMA_INVALID";
161
+ readonly INTENT_SCHEMA_MISMATCH: "CCE_INTENT_SCHEMA_MISMATCH";
162
+ readonly POLICY_DENIED: "CCE_POLICY_DENIED";
163
+ readonly CONSTRAINT_VIOLATED: "CCE_CONSTRAINT_VIOLATED";
164
+ readonly HANDLER_NOT_FOUND: "CCE_HANDLER_NOT_FOUND";
165
+ readonly HANDLER_EXECUTION_FAILED: "CCE_HANDLER_EXECUTION_FAILED";
166
+ readonly HANDLER_TIMEOUT: "CCE_HANDLER_TIMEOUT";
167
+ readonly RESPONSE_ENCRYPTION_FAILED: "CCE_RESPONSE_ENCRYPTION_FAILED";
168
+ };
169
+ type CceErrorCode = (typeof CCE_ERROR)[keyof typeof CCE_ERROR];
170
+ declare class CceError extends Error {
171
+ readonly code: CceErrorCode;
172
+ readonly metadata?: Record<string, unknown> | undefined;
173
+ constructor(code: CceErrorCode, message: string, metadata?: Record<string, unknown> | undefined);
174
+ get clientSafe(): boolean;
175
+ toClientError(): {
176
+ code: CceErrorCode;
177
+ message: string;
178
+ };
179
+ }
180
+
181
+ interface CceClientKeyEncryptor {
182
+ wrapKey(aesKey: Uint8Array, clientKid: string, clientPublicKeyHex: string): Promise<CceEncryptedKey>;
183
+ }
184
+ interface CceAxisSigner {
185
+ sign(payload: Uint8Array): Promise<CceSignature>;
186
+ }
187
+ interface CceResponseOptions {
188
+ request: CceRequestEnvelope;
189
+ capsule: CceCapsuleClaims;
190
+ status: CceResponseStatus;
191
+ body: Uint8Array;
192
+ clientPublicKeyHex: string;
193
+ witnessRef?: string;
194
+ }
195
+ declare function buildCceResponse(options: CceResponseOptions, clientKeyEncryptor: CceClientKeyEncryptor, axisSigner: CceAxisSigner): Promise<{
196
+ envelope: CceResponseEnvelope;
197
+ responsePayloadHash: string;
198
+ }>;
199
+ declare function buildCceErrorResponse(requestId: string, correlationId: string, status: CceResponseStatus, errorCode: string, message: string): {
200
+ ver: string;
201
+ request_id: string;
202
+ correlation_id: string;
203
+ status: CceResponseStatus;
204
+ error: {
205
+ code: string;
206
+ message: string;
207
+ };
208
+ };
209
+
210
+ interface CceWitnessStore {
211
+ record(witness: CceWitnessRecord): Promise<void>;
212
+ }
213
+ declare class InMemoryCceWitnessStore implements CceWitnessStore {
214
+ readonly records: CceWitnessRecord[];
215
+ record(witness: CceWitnessRecord): Promise<void>;
216
+ getByRequestId(requestId: string): CceWitnessRecord | undefined;
217
+ getByCapsuleId(capsuleId: string): CceWitnessRecord[];
218
+ }
219
+ interface CceVerificationState {
220
+ clientSigVerified: boolean;
221
+ capsuleSigVerified: boolean;
222
+ tpsValid: boolean;
223
+ audienceMatch: boolean;
224
+ intentMatch: boolean;
225
+ replayClean: boolean;
226
+ nonceUnique: boolean;
227
+ decryptionOk: boolean;
228
+ }
229
+ declare function buildWitnessRecord(envelope: CceRequestEnvelope, capsule: CceCapsuleClaims, verification: CceVerificationState, execution: {
230
+ status: CceResponseStatus;
231
+ handlerDurationMs: number;
232
+ effect?: string;
233
+ }, options: {
234
+ axisLocalSecret: string;
235
+ requestPayload?: Uint8Array;
236
+ responsePayload?: Uint8Array;
237
+ responseEncrypted: boolean;
238
+ }): CceWitnessRecord;
239
+ declare function extractVerificationState(metadata: Record<string, any>): CceVerificationState;
240
+
241
+ type CceHandler = (payload: Uint8Array, context: CceHandlerContext) => Promise<CceHandlerResult>;
242
+ interface CceHandlerContext {
243
+ capsule: CceCapsuleClaims;
244
+ executionContext: CceExecutionContext;
245
+ envelope: CceRequestEnvelope;
246
+ clientPublicKeyHex: string;
247
+ intent: string;
248
+ sub: string;
249
+ }
250
+ interface CceHandlerResult {
251
+ status: CceResponseStatus;
252
+ body: Uint8Array;
253
+ effect?: string;
254
+ }
255
+ interface CcePolicyContext {
256
+ envelope: CceRequestEnvelope;
257
+ capsule: CceCapsuleClaims;
258
+ executionContext: CceExecutionContext;
259
+ decryptedPayload: Uint8Array;
260
+ clientPublicKeyHex: string;
261
+ }
262
+ interface CcePolicyDecision {
263
+ allow: boolean;
264
+ code?: string;
265
+ message?: string;
266
+ }
267
+ interface CcePolicyEvaluator {
268
+ evaluate(context: CcePolicyContext): Promise<CcePolicyDecision>;
269
+ }
270
+ interface CcePipelineConfig {
271
+ axisLocalSecret: string;
272
+ axisAudience: string;
273
+ sensors: AxisSensor[];
274
+ handlers: Map<string, CceHandler>;
275
+ witnessStore: CceWitnessStore;
276
+ clientKeyEncryptor: CceClientKeyEncryptor;
277
+ axisSigner: CceAxisSigner;
278
+ policyEvaluator?: CcePolicyEvaluator;
279
+ }
280
+ type CcePipelineResult = {
281
+ ok: true;
282
+ response: CceResponseEnvelope;
283
+ witnessId: string;
284
+ } | {
285
+ ok: false;
286
+ error: {
287
+ code: string;
288
+ message: string;
289
+ };
290
+ status: CceResponseStatus;
291
+ };
292
+ declare function executeCcePipeline(envelope: CceRequestEnvelope, config: CcePipelineConfig): Promise<CcePipelineResult>;
293
+
294
+ export { type CcePolicyDecision as A, type CcePolicyEvaluator as B, type CceCapsuleClaims as C, type CceResponseEnvelope as D, type CceResponseOptions as E, type CceResponseStatus as F, type CceSignature as G, type CceVerificationState as H, type CceWitnessRecord as I, type CceWitnessStore as J, InMemoryCceWitnessStore as K, buildCceErrorResponse as L, buildCceResponse as M, buildWitnessRecord as N, executeCcePipeline as O, extractVerificationState as P, type CceExecutionContext as a, type CceRequestEnvelope as b, CCE_AES_KEY_BYTES as c, CCE_DERIVATION as d, CCE_ERROR as e, CCE_IV_BYTES as f, CCE_NONCE_BYTES as g, CCE_PROTOCOL_VERSION as h, CCE_TAG_BYTES as i, type CceAlgorithm as j, type CceAlgorithmDescriptor as k, type CceAxisSigner as l, type CceClientKeyEncryptor as m, type CceConstraints as n, type CceEncryptedKey as o, type CceEncryptedPayload as p, CceError as q, type CceErrorCode as r, type CceHandler as s, type CceHandlerContext as t, type CceHandlerResult as u, type CceKdfAlgorithm as v, type CceKemAlgorithm as w, type CcePipelineConfig as x, type CcePipelineResult as y, type CcePolicyContext as z };
@@ -1,3 +1,24 @@
1
+ import { AxisFrame } from '@nextera.one/axis-protocol';
1
2
  export * from '@nextera.one/axis-protocol';
2
- export { A as AxisError, a as AxisFrameZ, c as computeReceiptHash, b as computeSignaturePayload, g as generateEd25519KeyPair, s as sha256, d as signFrame, v as verifyFrameSignature } from '../index-VxXqZPuH.mjs';
3
- import 'zod';
3
+ import * as z from 'zod';
4
+
5
+ declare const AxisFrameZ: z.ZodType<AxisFrame>;
6
+
7
+ declare function computeSignaturePayload(frame: AxisFrame): Buffer;
8
+ declare function signFrame(frame: AxisFrame, privateKey: Buffer): Buffer;
9
+ declare function verifyFrameSignature(frame: AxisFrame, publicKey: Buffer): boolean;
10
+ declare function generateEd25519KeyPair(): {
11
+ privateKey: Buffer;
12
+ publicKey: Buffer;
13
+ };
14
+ declare function sha256(data: Buffer | Uint8Array): Buffer;
15
+ declare function computeReceiptHash(receiptBytes: Buffer | Uint8Array, prevHash?: Buffer | Uint8Array): Buffer;
16
+
17
+ declare class AxisError extends Error {
18
+ code: string;
19
+ httpStatus: number;
20
+ details?: Record<string, any> | undefined;
21
+ constructor(code: string, message: string, httpStatus?: number, details?: Record<string, any> | undefined);
22
+ }
23
+
24
+ export { AxisError, AxisFrameZ, computeReceiptHash, computeSignaturePayload, generateEd25519KeyPair, sha256, signFrame, verifyFrameSignature };
@@ -1,3 +1,24 @@
1
+ import { AxisFrame } from '@nextera.one/axis-protocol';
1
2
  export * from '@nextera.one/axis-protocol';
2
- export { A as AxisError, a as AxisFrameZ, c as computeReceiptHash, b as computeSignaturePayload, g as generateEd25519KeyPair, s as sha256, d as signFrame, v as verifyFrameSignature } from '../index-VxXqZPuH.js';
3
- import 'zod';
3
+ import * as z from 'zod';
4
+
5
+ declare const AxisFrameZ: z.ZodType<AxisFrame>;
6
+
7
+ declare function computeSignaturePayload(frame: AxisFrame): Buffer;
8
+ declare function signFrame(frame: AxisFrame, privateKey: Buffer): Buffer;
9
+ declare function verifyFrameSignature(frame: AxisFrame, publicKey: Buffer): boolean;
10
+ declare function generateEd25519KeyPair(): {
11
+ privateKey: Buffer;
12
+ publicKey: Buffer;
13
+ };
14
+ declare function sha256(data: Buffer | Uint8Array): Buffer;
15
+ declare function computeReceiptHash(receiptBytes: Buffer | Uint8Array, prevHash?: Buffer | Uint8Array): Buffer;
16
+
17
+ declare class AxisError extends Error {
18
+ code: string;
19
+ httpStatus: number;
20
+ details?: Record<string, any> | undefined;
21
+ constructor(code: string, message: string, httpStatus?: number, details?: Record<string, any> | undefined);
22
+ }
23
+
24
+ export { AxisError, AxisFrameZ, computeReceiptHash, computeSignaturePayload, generateEd25519KeyPair, sha256, signFrame, verifyFrameSignature };
@@ -0,0 +1,24 @@
1
+ import { h as IntentSchema, f as IntentProposal, b as CompilationResult, c as CompiledIntent } from '../idel.types-DuUAcOnQ.mjs';
2
+ export { A as AlternativeIntent, C as ClarificationQuestion, a as CompilationError, d as ConstraintKind, I as IntentConstraint, e as IntentParamSchema, g as IntentRisk, R as RiskLevel } from '../idel.types-DuUAcOnQ.mjs';
3
+
4
+ declare class IdelSchemaRegistry {
5
+ private schemas;
6
+ private aliases;
7
+ register(schema: IntentSchema): void;
8
+ registerAlias(alias: string, intent: string): void;
9
+ get(intent: string): IntentSchema | undefined;
10
+ resolve(raw: string): IntentSchema | undefined;
11
+ findCandidates(raw: string): Array<{
12
+ schema: IntentSchema;
13
+ score: number;
14
+ }>;
15
+ list(): IntentSchema[];
16
+ }
17
+ declare class IdelCompiler {
18
+ private readonly registry;
19
+ constructor(registry: IdelSchemaRegistry);
20
+ compile(proposal: IntentProposal): CompilationResult;
21
+ applyClarifications(compiled: CompiledIntent, answers: Record<string, unknown>): CompilationResult;
22
+ }
23
+
24
+ export { CompilationResult, CompiledIntent, IdelCompiler, IdelSchemaRegistry, IntentProposal, IntentSchema };
@@ -0,0 +1,24 @@
1
+ import { h as IntentSchema, f as IntentProposal, b as CompilationResult, c as CompiledIntent } from '../idel.types-DuUAcOnQ.js';
2
+ export { A as AlternativeIntent, C as ClarificationQuestion, a as CompilationError, d as ConstraintKind, I as IntentConstraint, e as IntentParamSchema, g as IntentRisk, R as RiskLevel } from '../idel.types-DuUAcOnQ.js';
3
+
4
+ declare class IdelSchemaRegistry {
5
+ private schemas;
6
+ private aliases;
7
+ register(schema: IntentSchema): void;
8
+ registerAlias(alias: string, intent: string): void;
9
+ get(intent: string): IntentSchema | undefined;
10
+ resolve(raw: string): IntentSchema | undefined;
11
+ findCandidates(raw: string): Array<{
12
+ schema: IntentSchema;
13
+ score: number;
14
+ }>;
15
+ list(): IntentSchema[];
16
+ }
17
+ declare class IdelCompiler {
18
+ private readonly registry;
19
+ constructor(registry: IdelSchemaRegistry);
20
+ compile(proposal: IntentProposal): CompilationResult;
21
+ applyClarifications(compiled: CompiledIntent, answers: Record<string, unknown>): CompilationResult;
22
+ }
23
+
24
+ export { CompilationResult, CompiledIntent, IdelCompiler, IdelSchemaRegistry, IntentProposal, IntentSchema };