@nextera.one/axis-server-sdk 0.5.0 → 0.7.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.
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AxisFrame } from './core/index.mjs';
2
- export { AXIS_MAGIC, AXIS_VERSION, AxisBinaryFrame, AxisFrameZ, TLV as AxisTlvType, 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, PROOF_CAPSULE, PROOF_JWT, PROOF_LOOM, PROOF_MTLS, TLV, TLV_ACTOR_ID, TLV_AUD, 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 } from './core/index.mjs';
2
+ export { AXIS_MAGIC, AXIS_VERSION, AxisBinaryFrame, AxisFrameZ, TLV as AxisTlvType, 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, computeReceiptHash, computeSignaturePayload, decodeArray, decodeFrame, decodeObject, decodeTLVs, decodeTLVsList, decodeVarint, encodeFrame, encodeTLVs, encodeVarint, generateEd25519KeyPair, getSignTarget, sha256, signFrame, varintLength, verifyFrameSignature } from './core/index.mjs';
3
3
  import { OnModuleInit } from '@nestjs/common';
4
4
  import 'zod';
5
5
 
@@ -683,4 +683,60 @@ interface AxisCrudHandler extends AxisHandlerInit {
683
683
  remove(body: Uint8Array, headers?: Map<number, Uint8Array>): Promise<Uint8Array>;
684
684
  }
685
685
 
686
- export { ATS1_HDR, ATS1_SCHEMA, type ActorKeyRecord, ats1 as Ats1Codec, type Axis1DecodedFrame, type Axis1FrameToEncode, type AxisAlg, type AxisPacket as AxisBinaryPacket, type AxisCapsule, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCrudHandler, type AxisEffect, type AxisHandler, type AxisHandlerInit, type AxisObservedContext, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, type AxisPostSensor, type AxisPreSensor, type AxisRequestContext, type AxisResponse, type AxisSensor, type AxisSensorInit, type AxisSig, type CapsuleBatchBody, type CapsuleBatchResult, type CapsuleIssueBody, type CapsuleIssueResult, type CapsuleMode, type CapsuleRecord, type CapsuleRevokeBody, type CapsuleStatus, ContractViolationError, DEFAULT_CONTRACTS, Decision, type ExecutionContract, ExecutionMeter, type ExecutionMetrics, FALLBACK_CONTRACT, HANDLER_METADATA_KEY, Handler, INTENT_ROUTES_KEY, Intent, type IntentExecBody, type IntentOptions, type IntentRoute, IntentRouter, type IssuerKeyRecord, type KeyStatus, Schema2002_PasskeyLoginOptionsRes, Schema2011_PasskeyLoginVerifyReq, Schema2012_PasskeyLoginVerifyRes, Schema2021_PasskeyRegisterOptionsReq, type SensorDecision, SensorDecisions, type SensorInput, type SensorMinifiedDecision, type SensorPhaseMetadata, type TickWindow, axis1SigningBytes, b64urlDecode, b64urlDecodeString, b64urlEncode, b64urlEncodeString, buildAts1Hdr, buildPacket, buildTLVs, bytes, canonicalJson, canonicalJsonExcluding, decodeAxis1Frame, encVarint, encodeAxis1Frame, nonce16, normalizeSensorDecision, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, utf8, varintU };
686
+ declare function hasScope(scopes: string[], required: string): boolean;
687
+ declare function parseScope(scope: string): {
688
+ resource: string;
689
+ id: string;
690
+ } | null;
691
+ declare function canAccessResource(scopes: string[], resourceType: string, resourceId: string): boolean;
692
+
693
+ declare const CAPABILITIES: {
694
+ readonly read: "read";
695
+ readonly write: "write";
696
+ readonly execute: "execute";
697
+ readonly admin: "admin";
698
+ readonly sign: "sign";
699
+ readonly witness: "witness";
700
+ };
701
+ type Capability = keyof typeof CAPABILITIES;
702
+ declare const PROOF_CAPABILITIES: Record<number, Capability[]>;
703
+ declare const INTENT_REQUIREMENTS: Record<string, Capability[]>;
704
+
705
+ declare function validateFrameShape(frame: any): boolean;
706
+ declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
707
+
708
+ declare const AXIS_OPCODES: Set<string>;
709
+ declare function isKnownOpcode(op: string): boolean;
710
+ declare function isAdminOpcode(op: string): boolean;
711
+
712
+ type ReceiptEffect = 'ALLOW' | 'DENY' | 'ERROR';
713
+ declare function buildReceiptHash(prevHash: Buffer | null, pid: Buffer, actorId: string, intent: string, effect: ReceiptEffect, ts: bigint): Buffer;
714
+
715
+ declare enum IntentSensitivity {
716
+ LOW = 1,
717
+ MEDIUM = 2,
718
+ HIGH = 3,
719
+ CRITICAL = 4
720
+ }
721
+ declare const INTENT_SENSITIVITY_MAP: Record<string, IntentSensitivity>;
722
+ declare function classifyIntent(intent: string): IntentSensitivity;
723
+ declare function sensitivityName(level: IntentSensitivity): string;
724
+
725
+ declare const INTENT_TIMEOUTS: Record<string, number>;
726
+ declare const DEFAULT_TIMEOUT = 10000;
727
+ declare function resolveTimeout(intent: string): number;
728
+
729
+ interface IntentDefinition {
730
+ intent: string;
731
+ description: string;
732
+ sensitivity: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
733
+ requiredProof: string[];
734
+ contract: {
735
+ maxDbWrites: number;
736
+ maxTimeMs: number;
737
+ };
738
+ examples?: string[];
739
+ deprecated?: boolean;
740
+ }
741
+
742
+ export { ATS1_HDR, ATS1_SCHEMA, AXIS_OPCODES, type ActorKeyRecord, ats1 as Ats1Codec, type Axis1DecodedFrame, type Axis1FrameToEncode, type AxisAlg, type AxisPacket as AxisBinaryPacket, type AxisCapsule, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCrudHandler, type AxisEffect, type AxisHandler, type AxisHandlerInit, type AxisObservedContext, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, type AxisPostSensor, type AxisPreSensor, type AxisRequestContext, type AxisResponse, type AxisSensor, type AxisSensorInit, type AxisSig, CAPABILITIES, type Capability, type CapsuleBatchBody, type CapsuleBatchResult, type CapsuleIssueBody, type CapsuleIssueResult, type CapsuleMode, type CapsuleRecord, type CapsuleRevokeBody, type CapsuleStatus, ContractViolationError, DEFAULT_CONTRACTS, DEFAULT_TIMEOUT, Decision, type ExecutionContract, ExecutionMeter, type ExecutionMetrics, FALLBACK_CONTRACT, HANDLER_METADATA_KEY, Handler, INTENT_REQUIREMENTS, INTENT_ROUTES_KEY, INTENT_SENSITIVITY_MAP, INTENT_TIMEOUTS, Intent, type IntentDefinition, type IntentExecBody, type IntentOptions, type IntentRoute, IntentRouter, IntentSensitivity, type IssuerKeyRecord, type KeyStatus, PROOF_CAPABILITIES, type ReceiptEffect, Schema2002_PasskeyLoginOptionsRes, Schema2011_PasskeyLoginVerifyReq, Schema2012_PasskeyLoginVerifyRes, Schema2021_PasskeyRegisterOptionsReq, type SensorDecision, SensorDecisions, type SensorInput, type SensorMinifiedDecision, type SensorPhaseMetadata, type TickWindow, axis1SigningBytes, b64urlDecode, b64urlDecodeString, b64urlEncode, b64urlEncodeString, buildAts1Hdr, buildPacket, buildReceiptHash, buildTLVs, bytes, canAccessResource, canonicalJson, canonicalJsonExcluding, classifyIntent, decodeAxis1Frame, encVarint, encodeAxis1Frame, hasScope, isAdminOpcode, isKnownOpcode, isTimestampValid, nonce16, normalizeSensorDecision, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, parseScope, resolveTimeout, sensitivityName, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, utf8, validateFrameShape, varintU };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { AxisFrame } from './core/index.js';
2
- export { AXIS_MAGIC, AXIS_VERSION, AxisBinaryFrame, AxisFrameZ, TLV as AxisTlvType, 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, PROOF_CAPSULE, PROOF_JWT, PROOF_LOOM, PROOF_MTLS, TLV, TLV_ACTOR_ID, TLV_AUD, 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 } from './core/index.js';
2
+ export { AXIS_MAGIC, AXIS_VERSION, AxisBinaryFrame, AxisFrameZ, TLV as AxisTlvType, 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, computeReceiptHash, computeSignaturePayload, decodeArray, decodeFrame, decodeObject, decodeTLVs, decodeTLVsList, decodeVarint, encodeFrame, encodeTLVs, encodeVarint, generateEd25519KeyPair, getSignTarget, sha256, signFrame, varintLength, verifyFrameSignature } from './core/index.js';
3
3
  import { OnModuleInit } from '@nestjs/common';
4
4
  import 'zod';
5
5
 
@@ -683,4 +683,60 @@ interface AxisCrudHandler extends AxisHandlerInit {
683
683
  remove(body: Uint8Array, headers?: Map<number, Uint8Array>): Promise<Uint8Array>;
684
684
  }
685
685
 
686
- export { ATS1_HDR, ATS1_SCHEMA, type ActorKeyRecord, ats1 as Ats1Codec, type Axis1DecodedFrame, type Axis1FrameToEncode, type AxisAlg, type AxisPacket as AxisBinaryPacket, type AxisCapsule, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCrudHandler, type AxisEffect, type AxisHandler, type AxisHandlerInit, type AxisObservedContext, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, type AxisPostSensor, type AxisPreSensor, type AxisRequestContext, type AxisResponse, type AxisSensor, type AxisSensorInit, type AxisSig, type CapsuleBatchBody, type CapsuleBatchResult, type CapsuleIssueBody, type CapsuleIssueResult, type CapsuleMode, type CapsuleRecord, type CapsuleRevokeBody, type CapsuleStatus, ContractViolationError, DEFAULT_CONTRACTS, Decision, type ExecutionContract, ExecutionMeter, type ExecutionMetrics, FALLBACK_CONTRACT, HANDLER_METADATA_KEY, Handler, INTENT_ROUTES_KEY, Intent, type IntentExecBody, type IntentOptions, type IntentRoute, IntentRouter, type IssuerKeyRecord, type KeyStatus, Schema2002_PasskeyLoginOptionsRes, Schema2011_PasskeyLoginVerifyReq, Schema2012_PasskeyLoginVerifyRes, Schema2021_PasskeyRegisterOptionsReq, type SensorDecision, SensorDecisions, type SensorInput, type SensorMinifiedDecision, type SensorPhaseMetadata, type TickWindow, axis1SigningBytes, b64urlDecode, b64urlDecodeString, b64urlEncode, b64urlEncodeString, buildAts1Hdr, buildPacket, buildTLVs, bytes, canonicalJson, canonicalJsonExcluding, decodeAxis1Frame, encVarint, encodeAxis1Frame, nonce16, normalizeSensorDecision, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, utf8, varintU };
686
+ declare function hasScope(scopes: string[], required: string): boolean;
687
+ declare function parseScope(scope: string): {
688
+ resource: string;
689
+ id: string;
690
+ } | null;
691
+ declare function canAccessResource(scopes: string[], resourceType: string, resourceId: string): boolean;
692
+
693
+ declare const CAPABILITIES: {
694
+ readonly read: "read";
695
+ readonly write: "write";
696
+ readonly execute: "execute";
697
+ readonly admin: "admin";
698
+ readonly sign: "sign";
699
+ readonly witness: "witness";
700
+ };
701
+ type Capability = keyof typeof CAPABILITIES;
702
+ declare const PROOF_CAPABILITIES: Record<number, Capability[]>;
703
+ declare const INTENT_REQUIREMENTS: Record<string, Capability[]>;
704
+
705
+ declare function validateFrameShape(frame: any): boolean;
706
+ declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
707
+
708
+ declare const AXIS_OPCODES: Set<string>;
709
+ declare function isKnownOpcode(op: string): boolean;
710
+ declare function isAdminOpcode(op: string): boolean;
711
+
712
+ type ReceiptEffect = 'ALLOW' | 'DENY' | 'ERROR';
713
+ declare function buildReceiptHash(prevHash: Buffer | null, pid: Buffer, actorId: string, intent: string, effect: ReceiptEffect, ts: bigint): Buffer;
714
+
715
+ declare enum IntentSensitivity {
716
+ LOW = 1,
717
+ MEDIUM = 2,
718
+ HIGH = 3,
719
+ CRITICAL = 4
720
+ }
721
+ declare const INTENT_SENSITIVITY_MAP: Record<string, IntentSensitivity>;
722
+ declare function classifyIntent(intent: string): IntentSensitivity;
723
+ declare function sensitivityName(level: IntentSensitivity): string;
724
+
725
+ declare const INTENT_TIMEOUTS: Record<string, number>;
726
+ declare const DEFAULT_TIMEOUT = 10000;
727
+ declare function resolveTimeout(intent: string): number;
728
+
729
+ interface IntentDefinition {
730
+ intent: string;
731
+ description: string;
732
+ sensitivity: 'LOW' | 'MEDIUM' | 'HIGH' | 'CRITICAL';
733
+ requiredProof: string[];
734
+ contract: {
735
+ maxDbWrites: number;
736
+ maxTimeMs: number;
737
+ };
738
+ examples?: string[];
739
+ deprecated?: boolean;
740
+ }
741
+
742
+ export { ATS1_HDR, ATS1_SCHEMA, AXIS_OPCODES, type ActorKeyRecord, ats1 as Ats1Codec, type Axis1DecodedFrame, type Axis1FrameToEncode, type AxisAlg, type AxisPacket as AxisBinaryPacket, type AxisCapsule, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCrudHandler, type AxisEffect, type AxisHandler, type AxisHandlerInit, type AxisObservedContext, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, type AxisPostSensor, type AxisPreSensor, type AxisRequestContext, type AxisResponse, type AxisSensor, type AxisSensorInit, type AxisSig, CAPABILITIES, type Capability, type CapsuleBatchBody, type CapsuleBatchResult, type CapsuleIssueBody, type CapsuleIssueResult, type CapsuleMode, type CapsuleRecord, type CapsuleRevokeBody, type CapsuleStatus, ContractViolationError, DEFAULT_CONTRACTS, DEFAULT_TIMEOUT, Decision, type ExecutionContract, ExecutionMeter, type ExecutionMetrics, FALLBACK_CONTRACT, HANDLER_METADATA_KEY, Handler, INTENT_REQUIREMENTS, INTENT_ROUTES_KEY, INTENT_SENSITIVITY_MAP, INTENT_TIMEOUTS, Intent, type IntentDefinition, type IntentExecBody, type IntentOptions, type IntentRoute, IntentRouter, IntentSensitivity, type IssuerKeyRecord, type KeyStatus, PROOF_CAPABILITIES, type ReceiptEffect, Schema2002_PasskeyLoginOptionsRes, Schema2011_PasskeyLoginVerifyReq, Schema2012_PasskeyLoginVerifyRes, Schema2021_PasskeyRegisterOptionsReq, type SensorDecision, SensorDecisions, type SensorInput, type SensorMinifiedDecision, type SensorPhaseMetadata, type TickWindow, axis1SigningBytes, b64urlDecode, b64urlDecodeString, b64urlEncode, b64urlEncodeString, buildAts1Hdr, buildPacket, buildReceiptHash, buildTLVs, bytes, canAccessResource, canonicalJson, canonicalJsonExcluding, classifyIntent, decodeAxis1Frame, encVarint, encodeAxis1Frame, hasScope, isAdminOpcode, isKnownOpcode, isTimestampValid, nonce16, normalizeSensorDecision, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, parseScope, resolveTimeout, sensitivityName, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, utf8, validateFrameShape, varintU };
package/dist/index.js CHANGED
@@ -40,12 +40,16 @@ __export(index_exports, {
40
40
  ATS1_HDR: () => ATS1_HDR,
41
41
  ATS1_SCHEMA: () => ATS1_SCHEMA,
42
42
  AXIS_MAGIC: () => AXIS_MAGIC,
43
+ AXIS_OPCODES: () => AXIS_OPCODES,
43
44
  AXIS_VERSION: () => AXIS_VERSION,
44
45
  Ats1Codec: () => ats1_exports,
45
46
  AxisFrameZ: () => AxisFrameZ,
46
47
  AxisPacketTags: () => T,
48
+ BodyProfile: () => BodyProfile,
49
+ CAPABILITIES: () => CAPABILITIES,
47
50
  ContractViolationError: () => ContractViolationError,
48
51
  DEFAULT_CONTRACTS: () => DEFAULT_CONTRACTS,
52
+ DEFAULT_TIMEOUT: () => DEFAULT_TIMEOUT,
49
53
  Decision: () => Decision,
50
54
  ERR_BAD_SIGNATURE: () => ERR_BAD_SIGNATURE,
51
55
  ERR_CONTRACT_VIOLATION: () => ERR_CONTRACT_VIOLATION,
@@ -58,17 +62,35 @@ __export(index_exports, {
58
62
  FLAG_HAS_WITNESS: () => FLAG_HAS_WITNESS,
59
63
  HANDLER_METADATA_KEY: () => HANDLER_METADATA_KEY,
60
64
  Handler: () => Handler,
65
+ INTENT_REQUIREMENTS: () => INTENT_REQUIREMENTS,
61
66
  INTENT_ROUTES_KEY: () => INTENT_ROUTES_KEY,
67
+ INTENT_SENSITIVITY_MAP: () => INTENT_SENSITIVITY_MAP,
68
+ INTENT_TIMEOUTS: () => INTENT_TIMEOUTS,
62
69
  Intent: () => Intent,
63
70
  IntentRouter: () => IntentRouter,
71
+ IntentSensitivity: () => IntentSensitivity,
64
72
  MAX_BODY_LEN: () => MAX_BODY_LEN,
65
73
  MAX_FRAME_LEN: () => MAX_FRAME_LEN,
66
74
  MAX_HDR_LEN: () => MAX_HDR_LEN,
67
75
  MAX_SIG_LEN: () => MAX_SIG_LEN,
76
+ NCERT_ALG: () => NCERT_ALG,
77
+ NCERT_EXP: () => NCERT_EXP,
78
+ NCERT_ISSUER_KID: () => NCERT_ISSUER_KID,
79
+ NCERT_KID: () => NCERT_KID,
80
+ NCERT_NBF: () => NCERT_NBF,
81
+ NCERT_NODE_ID: () => NCERT_NODE_ID,
82
+ NCERT_PAYLOAD: () => NCERT_PAYLOAD,
83
+ NCERT_PUB: () => NCERT_PUB,
84
+ NCERT_SCOPE: () => NCERT_SCOPE,
85
+ NCERT_SIG: () => NCERT_SIG,
86
+ PROOF_CAPABILITIES: () => PROOF_CAPABILITIES,
68
87
  PROOF_CAPSULE: () => PROOF_CAPSULE,
69
88
  PROOF_JWT: () => PROOF_JWT,
70
89
  PROOF_LOOM: () => PROOF_LOOM,
71
90
  PROOF_MTLS: () => PROOF_MTLS,
91
+ PROOF_NONE: () => PROOF_NONE,
92
+ PROOF_WITNESS: () => PROOF_WITNESS,
93
+ ProofType: () => ProofType,
72
94
  Schema2002_PasskeyLoginOptionsRes: () => Schema2002_PasskeyLoginOptionsRes,
73
95
  Schema2011_PasskeyLoginVerifyReq: () => Schema2011_PasskeyLoginVerifyReq,
74
96
  Schema2012_PasskeyLoginVerifyRes: () => Schema2012_PasskeyLoginVerifyRes,
@@ -76,6 +98,8 @@ __export(index_exports, {
76
98
  SensorDecisions: () => SensorDecisions,
77
99
  TLV_ACTOR_ID: () => TLV_ACTOR_ID,
78
100
  TLV_AUD: () => TLV_AUD,
101
+ TLV_BODY_ARR: () => TLV_BODY_ARR,
102
+ TLV_BODY_OBJ: () => TLV_BODY_OBJ,
79
103
  TLV_CAPSULE: () => TLV_CAPSULE,
80
104
  TLV_EFFECT: () => TLV_EFFECT,
81
105
  TLV_ERROR_CODE: () => TLV_ERROR_CODE,
@@ -110,10 +134,13 @@ __export(index_exports, {
110
134
  b64urlEncodeString: () => b64urlEncodeString,
111
135
  buildAts1Hdr: () => buildAts1Hdr,
112
136
  buildPacket: () => buildPacket,
137
+ buildReceiptHash: () => buildReceiptHash,
113
138
  buildTLVs: () => buildTLVs,
114
139
  bytes: () => bytes,
140
+ canAccessResource: () => canAccessResource,
115
141
  canonicalJson: () => canonicalJson,
116
142
  canonicalJsonExcluding: () => canonicalJsonExcluding,
143
+ classifyIntent: () => classifyIntent,
117
144
  computeReceiptHash: () => computeReceiptHash,
118
145
  computeSignaturePayload: () => computeSignaturePayload,
119
146
  decodeArray: () => decodeArray,
@@ -130,6 +157,10 @@ __export(index_exports, {
130
157
  encodeVarint: () => encodeVarint,
131
158
  generateEd25519KeyPair: () => generateEd25519KeyPair,
132
159
  getSignTarget: () => getSignTarget,
160
+ hasScope: () => hasScope,
161
+ isAdminOpcode: () => isAdminOpcode,
162
+ isKnownOpcode: () => isKnownOpcode,
163
+ isTimestampValid: () => isTimestampValid,
133
164
  nonce16: () => nonce16,
134
165
  normalizeSensorDecision: () => normalizeSensorDecision,
135
166
  packPasskeyLoginOptionsReq: () => packPasskeyLoginOptionsReq,
@@ -137,6 +168,9 @@ __export(index_exports, {
137
168
  packPasskeyLoginVerifyReq: () => packPasskeyLoginVerifyReq,
138
169
  packPasskeyLoginVerifyRes: () => packPasskeyLoginVerifyRes,
139
170
  packPasskeyRegisterOptionsReq: () => packPasskeyRegisterOptionsReq,
171
+ parseScope: () => parseScope,
172
+ resolveTimeout: () => resolveTimeout,
173
+ sensitivityName: () => sensitivityName,
140
174
  sha256: () => sha256,
141
175
  signFrame: () => signFrame,
142
176
  tlv: () => tlv,
@@ -145,6 +179,7 @@ __export(index_exports, {
145
179
  unpackPasskeyLoginVerifyReq: () => unpackPasskeyLoginVerifyReq,
146
180
  unpackPasskeyRegisterOptionsReq: () => unpackPasskeyRegisterOptionsReq,
147
181
  utf8: () => utf8,
182
+ validateFrameShape: () => validateFrameShape,
148
183
  varintLength: () => varintLength,
149
184
  varintU: () => varintU,
150
185
  verifyFrameSignature: () => verifyFrameSignature
@@ -378,10 +413,40 @@ var TLV_INDEX = 71;
378
413
  var TLV_OFFSET = 72;
379
414
  var TLV_SHA256_CHUNK = 73;
380
415
  var TLV_CAPSULE = 90;
416
+ var TLV_BODY_OBJ = 254;
417
+ var TLV_BODY_ARR = 255;
418
+ var NCERT_NODE_ID = 1;
419
+ var NCERT_KID = 2;
420
+ var NCERT_ALG = 3;
421
+ var NCERT_PUB = 4;
422
+ var NCERT_NBF = 5;
423
+ var NCERT_EXP = 6;
424
+ var NCERT_SCOPE = 7;
425
+ var NCERT_ISSUER_KID = 8;
426
+ var NCERT_PAYLOAD = 50;
427
+ var NCERT_SIG = 51;
428
+ var PROOF_NONE = 0;
381
429
  var PROOF_CAPSULE = 1;
382
430
  var PROOF_JWT = 2;
383
431
  var PROOF_MTLS = 3;
384
432
  var PROOF_LOOM = 4;
433
+ var PROOF_WITNESS = 5;
434
+ var ProofType = /* @__PURE__ */ ((ProofType2) => {
435
+ ProofType2[ProofType2["NONE"] = 0] = "NONE";
436
+ ProofType2[ProofType2["CAPSULE"] = 1] = "CAPSULE";
437
+ ProofType2[ProofType2["JWT"] = 2] = "JWT";
438
+ ProofType2[ProofType2["MTLS"] = 3] = "MTLS";
439
+ ProofType2[ProofType2["LOOM"] = 4] = "LOOM";
440
+ ProofType2[ProofType2["WITNESS"] = 5] = "WITNESS";
441
+ return ProofType2;
442
+ })(ProofType || {});
443
+ var BodyProfile = /* @__PURE__ */ ((BodyProfile2) => {
444
+ BodyProfile2[BodyProfile2["RAW"] = 0] = "RAW";
445
+ BodyProfile2[BodyProfile2["TLV_MAP"] = 1] = "TLV_MAP";
446
+ BodyProfile2[BodyProfile2["OBJ"] = 2] = "OBJ";
447
+ BodyProfile2[BodyProfile2["ARR"] = 3] = "ARR";
448
+ return BodyProfile2;
449
+ })(BodyProfile || {});
385
450
  var ERR_INVALID_PACKET = "INVALID_PACKET";
386
451
  var ERR_BAD_SIGNATURE = "BAD_SIGNATURE";
387
452
  var ERR_REPLAY_DETECTED = "REPLAY_DETECTED";
@@ -1985,17 +2050,244 @@ var SensorDecisions = {
1985
2050
  };
1986
2051
  }
1987
2052
  };
2053
+
2054
+ // src/security/scopes.ts
2055
+ function hasScope(scopes, required) {
2056
+ if (!Array.isArray(scopes) || scopes.length === 0) {
2057
+ return false;
2058
+ }
2059
+ if (scopes.includes(required)) {
2060
+ return true;
2061
+ }
2062
+ const [resource, id] = required.split(":");
2063
+ if (resource && id) {
2064
+ const wildcard = `${resource}:*`;
2065
+ if (scopes.includes(wildcard)) {
2066
+ return true;
2067
+ }
2068
+ }
2069
+ return false;
2070
+ }
2071
+ function parseScope(scope) {
2072
+ const parts = scope.split(":");
2073
+ if (parts.length !== 2) return null;
2074
+ return { resource: parts[0], id: parts[1] };
2075
+ }
2076
+ function canAccessResource(scopes, resourceType, resourceId) {
2077
+ const required = `${resourceType}:${resourceId}`;
2078
+ return hasScope(scopes, required);
2079
+ }
2080
+
2081
+ // src/security/capabilities.ts
2082
+ var CAPABILITIES = {
2083
+ read: "read",
2084
+ write: "write",
2085
+ execute: "execute",
2086
+ admin: "admin",
2087
+ sign: "sign",
2088
+ witness: "witness"
2089
+ };
2090
+ var PROOF_CAPABILITIES = {
2091
+ [PROOF_NONE]: [],
2092
+ [PROOF_CAPSULE]: ["read", "write", "execute"],
2093
+ [PROOF_JWT]: ["read"],
2094
+ [PROOF_MTLS]: ["read", "write", "admin"],
2095
+ [PROOF_LOOM]: ["read", "write", "execute"],
2096
+ [PROOF_WITNESS]: ["read", "write", "execute", "witness"]
2097
+ };
2098
+ var INTENT_REQUIREMENTS = {
2099
+ "public.*": [],
2100
+ "schema.*": [],
2101
+ "catalog.*": [],
2102
+ "health.*": [],
2103
+ "system.*": [],
2104
+ "file.upload": ["write"],
2105
+ "file.download": ["read"],
2106
+ "file.delete": ["write", "admin"],
2107
+ "passport.issue": ["write", "execute"],
2108
+ "passport.revoke": ["write", "witness"],
2109
+ "stream.publish": ["write"],
2110
+ "stream.subscribe": ["read"],
2111
+ "admin.*": ["admin"]
2112
+ };
2113
+
2114
+ // src/core/frame-validator.ts
2115
+ function validateFrameShape(frame) {
2116
+ if (!frame || typeof frame !== "object") {
2117
+ return false;
2118
+ }
2119
+ if (frame.v !== 1) {
2120
+ return false;
2121
+ }
2122
+ const requiredStrings = ["pid", "nonce", "actorId", "opcode"];
2123
+ for (const key of requiredStrings) {
2124
+ if (typeof frame[key] !== "string" || frame[key].length < 6) {
2125
+ return false;
2126
+ }
2127
+ }
2128
+ if (typeof frame.ts !== "number" || !Number.isFinite(frame.ts)) {
2129
+ return false;
2130
+ }
2131
+ if (frame.aud !== void 0 && (typeof frame.aud !== "string" || frame.aud.length === 0)) {
2132
+ return false;
2133
+ }
2134
+ if (!frame.sig || typeof frame.sig !== "object") {
2135
+ return false;
2136
+ }
2137
+ if (frame.sig.alg !== "EdDSA") {
2138
+ return false;
2139
+ }
2140
+ if (typeof frame.sig.kid !== "string" || frame.sig.kid.length < 8) {
2141
+ return false;
2142
+ }
2143
+ if (typeof frame.sig.value !== "string" || frame.sig.value.length < 32) {
2144
+ return false;
2145
+ }
2146
+ if (typeof frame.body !== "object" || frame.body === null) {
2147
+ return false;
2148
+ }
2149
+ return true;
2150
+ }
2151
+ function isTimestampValid(ts, skewSeconds = 120) {
2152
+ const now = Math.floor(Date.now() / 1e3);
2153
+ const diff = Math.abs(now - ts);
2154
+ return diff <= skewSeconds;
2155
+ }
2156
+
2157
+ // src/core/opcodes.ts
2158
+ var AXIS_OPCODES = /* @__PURE__ */ new Set([
2159
+ "CAPSULE.ISSUE",
2160
+ "CAPSULE.BATCH",
2161
+ "CAPSULE.REVOKE",
2162
+ "INTENT.EXEC",
2163
+ "ACTOR.KEY.ROTATE",
2164
+ "ACTOR.KEY.REVOKE",
2165
+ "ISSUER.KEY.ROTATE"
2166
+ ]);
2167
+ function isKnownOpcode(op) {
2168
+ return AXIS_OPCODES.has(op);
2169
+ }
2170
+ function isAdminOpcode(op) {
2171
+ return op.startsWith("ACTOR.KEY.") || op.startsWith("ISSUER.KEY.");
2172
+ }
2173
+
2174
+ // src/core/receipt.ts
2175
+ var import_crypto3 = require("crypto");
2176
+ function buildReceiptHash(prevHash, pid, actorId, intent, effect, ts) {
2177
+ const h = (0, import_crypto3.createHash)("sha256");
2178
+ if (prevHash) h.update(prevHash);
2179
+ h.update(pid);
2180
+ h.update(Buffer.from(actorId, "utf8"));
2181
+ h.update(Buffer.from(intent, "utf8"));
2182
+ h.update(Buffer.from(effect, "utf8"));
2183
+ h.update(Buffer.from(ts.toString(), "utf8"));
2184
+ return h.digest();
2185
+ }
2186
+
2187
+ // src/core/intent-sensitivity.ts
2188
+ var IntentSensitivity = /* @__PURE__ */ ((IntentSensitivity2) => {
2189
+ IntentSensitivity2[IntentSensitivity2["LOW"] = 1] = "LOW";
2190
+ IntentSensitivity2[IntentSensitivity2["MEDIUM"] = 2] = "MEDIUM";
2191
+ IntentSensitivity2[IntentSensitivity2["HIGH"] = 3] = "HIGH";
2192
+ IntentSensitivity2[IntentSensitivity2["CRITICAL"] = 4] = "CRITICAL";
2193
+ return IntentSensitivity2;
2194
+ })(IntentSensitivity || {});
2195
+ var INTENT_SENSITIVITY_MAP = {
2196
+ // System intents
2197
+ "system.ping": 1 /* LOW */,
2198
+ // Catalog intents
2199
+ "catalog.list": 1 /* LOW */,
2200
+ "catalog.search": 1 /* LOW */,
2201
+ "catalog.intent.describe": 1 /* LOW */,
2202
+ "catalog.intent.complete": 1 /* LOW */,
2203
+ // Stream intents
2204
+ "stream.publish": 2 /* MEDIUM */,
2205
+ "stream.read": 2 /* MEDIUM */,
2206
+ "stream.subscribe": 2 /* MEDIUM */,
2207
+ // File intents
2208
+ "file.init": 2 /* MEDIUM */,
2209
+ "file.chunk": 2 /* MEDIUM */,
2210
+ "file.finalize": 2 /* MEDIUM */,
2211
+ "file.status": 1 /* LOW */,
2212
+ // Passport intents
2213
+ "passport.issue": 3 /* HIGH */,
2214
+ "passport.verify": 2 /* MEDIUM */,
2215
+ "passport.revoke": 4 /* CRITICAL */,
2216
+ // Mail intents
2217
+ "mail.send": 3 /* HIGH */,
2218
+ // Admin intents
2219
+ "admin.create_capsule": 4 /* CRITICAL */,
2220
+ "admin.revoke_capsule": 4 /* CRITICAL */,
2221
+ "admin.issue_node_cert": 4 /* CRITICAL */
2222
+ };
2223
+ function classifyIntent(intent) {
2224
+ if (INTENT_SENSITIVITY_MAP[intent]) {
2225
+ return INTENT_SENSITIVITY_MAP[intent];
2226
+ }
2227
+ const realm = intent.split(".")[0];
2228
+ const wildcardKey = `${realm}.*`;
2229
+ if (INTENT_SENSITIVITY_MAP[wildcardKey]) {
2230
+ return INTENT_SENSITIVITY_MAP[wildcardKey];
2231
+ }
2232
+ return 2 /* MEDIUM */;
2233
+ }
2234
+ function sensitivityName(level) {
2235
+ switch (level) {
2236
+ case 1 /* LOW */:
2237
+ return "LOW";
2238
+ case 2 /* MEDIUM */:
2239
+ return "MEDIUM";
2240
+ case 3 /* HIGH */:
2241
+ return "HIGH";
2242
+ case 4 /* CRITICAL */:
2243
+ return "CRITICAL";
2244
+ }
2245
+ }
2246
+
2247
+ // src/core/timeouts.ts
2248
+ var INTENT_TIMEOUTS = {
2249
+ "public.*": 5e3,
2250
+ "schema.*": 5e3,
2251
+ "catalog.*": 5e3,
2252
+ "health.*": 2e3,
2253
+ "file.upload": 6e4,
2254
+ "file.download": 6e4,
2255
+ "file.chunk": 3e4,
2256
+ "file.finalize": 3e4,
2257
+ "stream.*": 3e4,
2258
+ "passport.*": 15e3,
2259
+ "admin.*": 3e4
2260
+ };
2261
+ var DEFAULT_TIMEOUT = 1e4;
2262
+ function resolveTimeout(intent) {
2263
+ if (INTENT_TIMEOUTS[intent]) {
2264
+ return INTENT_TIMEOUTS[intent];
2265
+ }
2266
+ for (const [pattern, timeout] of Object.entries(INTENT_TIMEOUTS)) {
2267
+ if (pattern.endsWith(".*")) {
2268
+ const prefix = pattern.slice(0, -1);
2269
+ if (intent.startsWith(prefix)) {
2270
+ return timeout;
2271
+ }
2272
+ }
2273
+ }
2274
+ return DEFAULT_TIMEOUT;
2275
+ }
1988
2276
  // Annotate the CommonJS export names for ESM import in node:
1989
2277
  0 && (module.exports = {
1990
2278
  ATS1_HDR,
1991
2279
  ATS1_SCHEMA,
1992
2280
  AXIS_MAGIC,
2281
+ AXIS_OPCODES,
1993
2282
  AXIS_VERSION,
1994
2283
  Ats1Codec,
1995
2284
  AxisFrameZ,
1996
2285
  AxisPacketTags,
2286
+ BodyProfile,
2287
+ CAPABILITIES,
1997
2288
  ContractViolationError,
1998
2289
  DEFAULT_CONTRACTS,
2290
+ DEFAULT_TIMEOUT,
1999
2291
  Decision,
2000
2292
  ERR_BAD_SIGNATURE,
2001
2293
  ERR_CONTRACT_VIOLATION,
@@ -2008,17 +2300,35 @@ var SensorDecisions = {
2008
2300
  FLAG_HAS_WITNESS,
2009
2301
  HANDLER_METADATA_KEY,
2010
2302
  Handler,
2303
+ INTENT_REQUIREMENTS,
2011
2304
  INTENT_ROUTES_KEY,
2305
+ INTENT_SENSITIVITY_MAP,
2306
+ INTENT_TIMEOUTS,
2012
2307
  Intent,
2013
2308
  IntentRouter,
2309
+ IntentSensitivity,
2014
2310
  MAX_BODY_LEN,
2015
2311
  MAX_FRAME_LEN,
2016
2312
  MAX_HDR_LEN,
2017
2313
  MAX_SIG_LEN,
2314
+ NCERT_ALG,
2315
+ NCERT_EXP,
2316
+ NCERT_ISSUER_KID,
2317
+ NCERT_KID,
2318
+ NCERT_NBF,
2319
+ NCERT_NODE_ID,
2320
+ NCERT_PAYLOAD,
2321
+ NCERT_PUB,
2322
+ NCERT_SCOPE,
2323
+ NCERT_SIG,
2324
+ PROOF_CAPABILITIES,
2018
2325
  PROOF_CAPSULE,
2019
2326
  PROOF_JWT,
2020
2327
  PROOF_LOOM,
2021
2328
  PROOF_MTLS,
2329
+ PROOF_NONE,
2330
+ PROOF_WITNESS,
2331
+ ProofType,
2022
2332
  Schema2002_PasskeyLoginOptionsRes,
2023
2333
  Schema2011_PasskeyLoginVerifyReq,
2024
2334
  Schema2012_PasskeyLoginVerifyRes,
@@ -2026,6 +2336,8 @@ var SensorDecisions = {
2026
2336
  SensorDecisions,
2027
2337
  TLV_ACTOR_ID,
2028
2338
  TLV_AUD,
2339
+ TLV_BODY_ARR,
2340
+ TLV_BODY_OBJ,
2029
2341
  TLV_CAPSULE,
2030
2342
  TLV_EFFECT,
2031
2343
  TLV_ERROR_CODE,
@@ -2060,10 +2372,13 @@ var SensorDecisions = {
2060
2372
  b64urlEncodeString,
2061
2373
  buildAts1Hdr,
2062
2374
  buildPacket,
2375
+ buildReceiptHash,
2063
2376
  buildTLVs,
2064
2377
  bytes,
2378
+ canAccessResource,
2065
2379
  canonicalJson,
2066
2380
  canonicalJsonExcluding,
2381
+ classifyIntent,
2067
2382
  computeReceiptHash,
2068
2383
  computeSignaturePayload,
2069
2384
  decodeArray,
@@ -2080,6 +2395,10 @@ var SensorDecisions = {
2080
2395
  encodeVarint,
2081
2396
  generateEd25519KeyPair,
2082
2397
  getSignTarget,
2398
+ hasScope,
2399
+ isAdminOpcode,
2400
+ isKnownOpcode,
2401
+ isTimestampValid,
2083
2402
  nonce16,
2084
2403
  normalizeSensorDecision,
2085
2404
  packPasskeyLoginOptionsReq,
@@ -2087,6 +2406,9 @@ var SensorDecisions = {
2087
2406
  packPasskeyLoginVerifyReq,
2088
2407
  packPasskeyLoginVerifyRes,
2089
2408
  packPasskeyRegisterOptionsReq,
2409
+ parseScope,
2410
+ resolveTimeout,
2411
+ sensitivityName,
2090
2412
  sha256,
2091
2413
  signFrame,
2092
2414
  tlv,
@@ -2095,6 +2417,7 @@ var SensorDecisions = {
2095
2417
  unpackPasskeyLoginVerifyReq,
2096
2418
  unpackPasskeyRegisterOptionsReq,
2097
2419
  utf8,
2420
+ validateFrameShape,
2098
2421
  varintLength,
2099
2422
  varintU,
2100
2423
  verifyFrameSignature