@nextera.one/axis-server-sdk 0.7.1 → 0.9.1

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/README.md CHANGED
@@ -32,7 +32,6 @@ import {
32
32
  TLV_AUD,
33
33
  TLV_REALM,
34
34
  AxisBinaryFrame,
35
- AxisFrameZ,
36
35
  encodeFrame,
37
36
  decodeFrame,
38
37
  getSignTarget,
@@ -46,6 +45,8 @@ Notes:
46
45
  - `TLV_AUD` is the canonical name for tag `8`.
47
46
  - `TLV_REALM` remains available as a compatibility alias.
48
47
  - `AxisBinaryFrame` is the explicit low-level binary frame type.
48
+ - The server `./core` surface is additive, but shared protocol constants and wire-format helpers are kept aligned with the client SDK.
49
+ - `AxisFrameZ` is available from the server package as a server-side validation helper, not as part of the shared minimum core contract.
49
50
 
50
51
  ## Decorator Example
51
52
 
package/dist/index.d.mts CHANGED
@@ -1,6 +1,5 @@
1
- import { AxisFrame } from './core/index.mjs';
1
+ import { AxisFrame as AxisFrame$1 } from './core/index.mjs';
2
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
- import { OnModuleInit } from '@nestjs/common';
4
3
  import 'zod';
5
4
 
6
5
  declare const HANDLER_METADATA_KEY = "axis:handler";
@@ -30,7 +29,7 @@ declare class IntentRouter {
30
29
  private handlers;
31
30
  register(intent: string, handler: any): void;
32
31
  registerHandler(instance: any): void;
33
- route(frame: AxisFrame): Promise<AxisEffect>;
32
+ route(frame: AxisFrame$1): Promise<AxisEffect>;
34
33
  private recordLatency;
35
34
  }
36
35
 
@@ -308,12 +307,12 @@ declare function b64urlDecodeString(str: string, encoding?: BufferEncoding): str
308
307
  declare function canonicalJson(value: any): string;
309
308
  declare function canonicalJsonExcluding(obj: Record<string, any>, exclude: string[]): string;
310
309
 
311
- type AxisAlg = 'EdDSA' | 'ES256' | 'RS256';
310
+ type AxisAlg$1 = 'EdDSA' | 'ES256' | 'RS256';
312
311
  type CapsuleStatus = 'ACTIVE' | 'CONSUMED' | 'REVOKED' | 'EXPIRED';
313
312
  type CapsuleMode = 'SINGLE_USE' | 'MULTI_USE';
314
313
  type KeyStatus = 'ACTIVE' | 'GRACE' | 'REVOKED' | 'RETIRED';
315
- interface AxisSig {
316
- alg: AxisAlg;
314
+ interface AxisSig$1 {
315
+ alg: AxisAlg$1;
317
316
  kid: string;
318
317
  value: string;
319
318
  }
@@ -325,7 +324,7 @@ interface AxisPacket$1<T = any> {
325
324
  actorId: string;
326
325
  opcode: string;
327
326
  body: T;
328
- sig: AxisSig;
327
+ sig: AxisSig$1;
329
328
  }
330
329
  interface AxisCapsuleConstraints {
331
330
  maxAmount?: number;
@@ -365,7 +364,7 @@ interface AxisCapsulePayload {
365
364
  }
366
365
  interface AxisCapsule {
367
366
  payload: AxisCapsulePayload;
368
- sig: AxisSig;
367
+ sig: AxisSig$1;
369
368
  }
370
369
  interface CapsuleIssueBody {
371
370
  intent: string;
@@ -397,7 +396,7 @@ interface CapsuleRevokeBody {
397
396
  capsuleId: string;
398
397
  reason: string;
399
398
  }
400
- interface AxisResponse<T = any> {
399
+ interface AxisResponse$1<T = any> {
401
400
  ok: boolean;
402
401
  pid: string;
403
402
  decisionId: string;
@@ -547,6 +546,26 @@ type AxisPacket = {
547
546
  };
548
547
  declare function buildPacket(hdr: Buffer, body: Buffer, sig: Buffer, flags?: number): AxisPacket;
549
548
 
549
+ type AxisAlg = Extract<AxisAlg$1, 'EdDSA'>;
550
+ type AxisSig = AxisSig$1 & {
551
+ alg: AxisAlg;
552
+ };
553
+ interface AxisFrame<T = any> {
554
+ v: 1;
555
+ pid: string;
556
+ nonce: string;
557
+ ts: number;
558
+ actorId: string;
559
+ aud?: string;
560
+ opcode: string;
561
+ headers: Map<number, Uint8Array>;
562
+ body: T;
563
+ sig: AxisSig;
564
+ }
565
+ type AxisResponse<T = any> = AxisResponse$1<T> & {
566
+ policyRefs?: string[];
567
+ riskScore?: number;
568
+ };
550
569
  interface AxisObservedContext {
551
570
  ip?: string;
552
571
  ua?: string;
@@ -578,7 +597,8 @@ interface AxisSensor {
578
597
  supports?(input: SensorInput): boolean;
579
598
  run(input: SensorInput): Promise<SensorDecision>;
580
599
  }
581
- interface AxisSensorInit extends AxisSensor, OnModuleInit {
600
+ interface AxisSensorInit extends AxisSensor {
601
+ onModuleInit?(): void | Promise<void>;
582
602
  }
583
603
  interface AxisPreSensor extends AxisSensor {
584
604
  phase: 'PRE_DECODE';
@@ -672,7 +692,8 @@ interface AxisHandler {
672
692
  readonly description?: string;
673
693
  readonly execute?: (body: Uint8Array, headers?: Map<number, Uint8Array>) => Promise<Uint8Array | any>;
674
694
  }
675
- interface AxisHandlerInit extends AxisHandler, OnModuleInit {
695
+ interface AxisHandlerInit extends AxisHandler {
696
+ onModuleInit?(): void | Promise<void>;
676
697
  }
677
698
 
678
699
  interface AxisCrudHandler extends AxisHandlerInit {
@@ -702,8 +723,26 @@ type Capability = keyof typeof CAPABILITIES;
702
723
  declare const PROOF_CAPABILITIES: Record<number, Capability[]>;
703
724
  declare const INTENT_REQUIREMENTS: Record<string, Capability[]>;
704
725
 
705
- declare function validateFrameShape(frame: any): boolean;
706
- declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
726
+ interface RiskSignal {
727
+ type: string;
728
+ severity: 'low' | 'medium' | 'high' | 'critical';
729
+ value: any;
730
+ message: string;
731
+ }
732
+ declare enum RiskDecision {
733
+ ALLOW = "ALLOW",
734
+ THROTTLE = "THROTTLE",
735
+ STEP_UP = "STEP_UP",
736
+ WITNESS = "WITNESS",
737
+ DENY = "DENY"
738
+ }
739
+ interface RiskEvaluation {
740
+ decision: RiskDecision;
741
+ reason?: string;
742
+ retryAfterMs?: number;
743
+ confidence: number;
744
+ signals: RiskSignal[];
745
+ }
707
746
 
708
747
  declare const AXIS_OPCODES: Set<string>;
709
748
  declare function isKnownOpcode(op: string): boolean;
@@ -739,4 +778,7 @@ interface IntentDefinition {
739
778
  deprecated?: boolean;
740
779
  }
741
780
 
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 };
781
+ declare function validateFrameShape(frame: any): boolean;
782
+ declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
783
+
784
+ export { ATS1_HDR, ATS1_SCHEMA, AXIS_OPCODES, type ActorKeyRecord, ats1 as Ats1Codec, type Axis1DecodedFrame, type Axis1FrameToEncode, type AxisAlg$1 as AxisAlg, type AxisPacket as AxisBinaryPacket, type AxisCapsule, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCrudHandler, type AxisEffect, type AxisHandler, type AxisHandlerInit, type AxisAlg as AxisJsonAlg, type AxisFrame as AxisJsonFrame, type AxisResponse as AxisJsonResponse, type AxisSig as AxisJsonSig, type AxisObservedContext, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, type AxisPostSensor, type AxisPreSensor, type AxisRequestContext, type AxisResponse$1 as AxisResponse, type AxisSensor, type AxisSensorInit, type AxisSig$1 as 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, RiskDecision, type RiskEvaluation, type RiskSignal, 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,6 +1,5 @@
1
- import { AxisFrame } from './core/index.js';
1
+ import { AxisFrame as AxisFrame$1 } from './core/index.js';
2
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
- import { OnModuleInit } from '@nestjs/common';
4
3
  import 'zod';
5
4
 
6
5
  declare const HANDLER_METADATA_KEY = "axis:handler";
@@ -30,7 +29,7 @@ declare class IntentRouter {
30
29
  private handlers;
31
30
  register(intent: string, handler: any): void;
32
31
  registerHandler(instance: any): void;
33
- route(frame: AxisFrame): Promise<AxisEffect>;
32
+ route(frame: AxisFrame$1): Promise<AxisEffect>;
34
33
  private recordLatency;
35
34
  }
36
35
 
@@ -308,12 +307,12 @@ declare function b64urlDecodeString(str: string, encoding?: BufferEncoding): str
308
307
  declare function canonicalJson(value: any): string;
309
308
  declare function canonicalJsonExcluding(obj: Record<string, any>, exclude: string[]): string;
310
309
 
311
- type AxisAlg = 'EdDSA' | 'ES256' | 'RS256';
310
+ type AxisAlg$1 = 'EdDSA' | 'ES256' | 'RS256';
312
311
  type CapsuleStatus = 'ACTIVE' | 'CONSUMED' | 'REVOKED' | 'EXPIRED';
313
312
  type CapsuleMode = 'SINGLE_USE' | 'MULTI_USE';
314
313
  type KeyStatus = 'ACTIVE' | 'GRACE' | 'REVOKED' | 'RETIRED';
315
- interface AxisSig {
316
- alg: AxisAlg;
314
+ interface AxisSig$1 {
315
+ alg: AxisAlg$1;
317
316
  kid: string;
318
317
  value: string;
319
318
  }
@@ -325,7 +324,7 @@ interface AxisPacket$1<T = any> {
325
324
  actorId: string;
326
325
  opcode: string;
327
326
  body: T;
328
- sig: AxisSig;
327
+ sig: AxisSig$1;
329
328
  }
330
329
  interface AxisCapsuleConstraints {
331
330
  maxAmount?: number;
@@ -365,7 +364,7 @@ interface AxisCapsulePayload {
365
364
  }
366
365
  interface AxisCapsule {
367
366
  payload: AxisCapsulePayload;
368
- sig: AxisSig;
367
+ sig: AxisSig$1;
369
368
  }
370
369
  interface CapsuleIssueBody {
371
370
  intent: string;
@@ -397,7 +396,7 @@ interface CapsuleRevokeBody {
397
396
  capsuleId: string;
398
397
  reason: string;
399
398
  }
400
- interface AxisResponse<T = any> {
399
+ interface AxisResponse$1<T = any> {
401
400
  ok: boolean;
402
401
  pid: string;
403
402
  decisionId: string;
@@ -547,6 +546,26 @@ type AxisPacket = {
547
546
  };
548
547
  declare function buildPacket(hdr: Buffer, body: Buffer, sig: Buffer, flags?: number): AxisPacket;
549
548
 
549
+ type AxisAlg = Extract<AxisAlg$1, 'EdDSA'>;
550
+ type AxisSig = AxisSig$1 & {
551
+ alg: AxisAlg;
552
+ };
553
+ interface AxisFrame<T = any> {
554
+ v: 1;
555
+ pid: string;
556
+ nonce: string;
557
+ ts: number;
558
+ actorId: string;
559
+ aud?: string;
560
+ opcode: string;
561
+ headers: Map<number, Uint8Array>;
562
+ body: T;
563
+ sig: AxisSig;
564
+ }
565
+ type AxisResponse<T = any> = AxisResponse$1<T> & {
566
+ policyRefs?: string[];
567
+ riskScore?: number;
568
+ };
550
569
  interface AxisObservedContext {
551
570
  ip?: string;
552
571
  ua?: string;
@@ -578,7 +597,8 @@ interface AxisSensor {
578
597
  supports?(input: SensorInput): boolean;
579
598
  run(input: SensorInput): Promise<SensorDecision>;
580
599
  }
581
- interface AxisSensorInit extends AxisSensor, OnModuleInit {
600
+ interface AxisSensorInit extends AxisSensor {
601
+ onModuleInit?(): void | Promise<void>;
582
602
  }
583
603
  interface AxisPreSensor extends AxisSensor {
584
604
  phase: 'PRE_DECODE';
@@ -672,7 +692,8 @@ interface AxisHandler {
672
692
  readonly description?: string;
673
693
  readonly execute?: (body: Uint8Array, headers?: Map<number, Uint8Array>) => Promise<Uint8Array | any>;
674
694
  }
675
- interface AxisHandlerInit extends AxisHandler, OnModuleInit {
695
+ interface AxisHandlerInit extends AxisHandler {
696
+ onModuleInit?(): void | Promise<void>;
676
697
  }
677
698
 
678
699
  interface AxisCrudHandler extends AxisHandlerInit {
@@ -702,8 +723,26 @@ type Capability = keyof typeof CAPABILITIES;
702
723
  declare const PROOF_CAPABILITIES: Record<number, Capability[]>;
703
724
  declare const INTENT_REQUIREMENTS: Record<string, Capability[]>;
704
725
 
705
- declare function validateFrameShape(frame: any): boolean;
706
- declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
726
+ interface RiskSignal {
727
+ type: string;
728
+ severity: 'low' | 'medium' | 'high' | 'critical';
729
+ value: any;
730
+ message: string;
731
+ }
732
+ declare enum RiskDecision {
733
+ ALLOW = "ALLOW",
734
+ THROTTLE = "THROTTLE",
735
+ STEP_UP = "STEP_UP",
736
+ WITNESS = "WITNESS",
737
+ DENY = "DENY"
738
+ }
739
+ interface RiskEvaluation {
740
+ decision: RiskDecision;
741
+ reason?: string;
742
+ retryAfterMs?: number;
743
+ confidence: number;
744
+ signals: RiskSignal[];
745
+ }
707
746
 
708
747
  declare const AXIS_OPCODES: Set<string>;
709
748
  declare function isKnownOpcode(op: string): boolean;
@@ -739,4 +778,7 @@ interface IntentDefinition {
739
778
  deprecated?: boolean;
740
779
  }
741
780
 
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 };
781
+ declare function validateFrameShape(frame: any): boolean;
782
+ declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
783
+
784
+ export { ATS1_HDR, ATS1_SCHEMA, AXIS_OPCODES, type ActorKeyRecord, ats1 as Ats1Codec, type Axis1DecodedFrame, type Axis1FrameToEncode, type AxisAlg$1 as AxisAlg, type AxisPacket as AxisBinaryPacket, type AxisCapsule, type AxisCapsuleConstraints, type AxisCapsulePayload, type AxisCrudHandler, type AxisEffect, type AxisHandler, type AxisHandlerInit, type AxisAlg as AxisJsonAlg, type AxisFrame as AxisJsonFrame, type AxisResponse as AxisJsonResponse, type AxisSig as AxisJsonSig, type AxisObservedContext, type AxisPacket$1 as AxisPacket, T as AxisPacketTags, type AxisPostSensor, type AxisPreSensor, type AxisRequestContext, type AxisResponse$1 as AxisResponse, type AxisSensor, type AxisSensorInit, type AxisSig$1 as 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, RiskDecision, type RiskEvaluation, type RiskSignal, 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
@@ -91,6 +91,7 @@ __export(index_exports, {
91
91
  PROOF_NONE: () => PROOF_NONE,
92
92
  PROOF_WITNESS: () => PROOF_WITNESS,
93
93
  ProofType: () => ProofType,
94
+ RiskDecision: () => RiskDecision,
94
95
  Schema2002_PasskeyLoginOptionsRes: () => Schema2002_PasskeyLoginOptionsRes,
95
96
  Schema2011_PasskeyLoginVerifyReq: () => Schema2011_PasskeyLoginVerifyReq,
96
97
  Schema2012_PasskeyLoginVerifyRes: () => Schema2012_PasskeyLoginVerifyRes,
@@ -2111,48 +2112,15 @@ var INTENT_REQUIREMENTS = {
2111
2112
  "admin.*": ["admin"]
2112
2113
  };
2113
2114
 
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
- }
2115
+ // src/risk/index.ts
2116
+ var RiskDecision = /* @__PURE__ */ ((RiskDecision2) => {
2117
+ RiskDecision2["ALLOW"] = "ALLOW";
2118
+ RiskDecision2["THROTTLE"] = "THROTTLE";
2119
+ RiskDecision2["STEP_UP"] = "STEP_UP";
2120
+ RiskDecision2["WITNESS"] = "WITNESS";
2121
+ RiskDecision2["DENY"] = "DENY";
2122
+ return RiskDecision2;
2123
+ })(RiskDecision || {});
2156
2124
 
2157
2125
  // src/core/opcodes.ts
2158
2126
  var AXIS_OPCODES = /* @__PURE__ */ new Set([
@@ -2273,6 +2241,49 @@ function resolveTimeout(intent) {
2273
2241
  }
2274
2242
  return DEFAULT_TIMEOUT;
2275
2243
  }
2244
+
2245
+ // src/core/frame-validator.ts
2246
+ function validateFrameShape(frame) {
2247
+ if (!frame || typeof frame !== "object") {
2248
+ return false;
2249
+ }
2250
+ if (frame.v !== 1) {
2251
+ return false;
2252
+ }
2253
+ const requiredStrings = ["pid", "nonce", "actorId", "opcode"];
2254
+ for (const key of requiredStrings) {
2255
+ if (typeof frame[key] !== "string" || frame[key].length < 6) {
2256
+ return false;
2257
+ }
2258
+ }
2259
+ if (typeof frame.ts !== "number" || !Number.isFinite(frame.ts)) {
2260
+ return false;
2261
+ }
2262
+ if (frame.aud !== void 0 && (typeof frame.aud !== "string" || frame.aud.length === 0)) {
2263
+ return false;
2264
+ }
2265
+ if (!frame.sig || typeof frame.sig !== "object") {
2266
+ return false;
2267
+ }
2268
+ if (frame.sig.alg !== "EdDSA") {
2269
+ return false;
2270
+ }
2271
+ if (typeof frame.sig.kid !== "string" || frame.sig.kid.length < 8) {
2272
+ return false;
2273
+ }
2274
+ if (typeof frame.sig.value !== "string" || frame.sig.value.length < 32) {
2275
+ return false;
2276
+ }
2277
+ if (typeof frame.body !== "object" || frame.body === null) {
2278
+ return false;
2279
+ }
2280
+ return true;
2281
+ }
2282
+ function isTimestampValid(ts, skewSeconds = 120) {
2283
+ const now = Math.floor(Date.now() / 1e3);
2284
+ const diff = Math.abs(now - ts);
2285
+ return diff <= skewSeconds;
2286
+ }
2276
2287
  // Annotate the CommonJS export names for ESM import in node:
2277
2288
  0 && (module.exports = {
2278
2289
  ATS1_HDR,
@@ -2329,6 +2340,7 @@ function resolveTimeout(intent) {
2329
2340
  PROOF_NONE,
2330
2341
  PROOF_WITNESS,
2331
2342
  ProofType,
2343
+ RiskDecision,
2332
2344
  Schema2002_PasskeyLoginOptionsRes,
2333
2345
  Schema2011_PasskeyLoginVerifyReq,
2334
2346
  Schema2012_PasskeyLoginVerifyRes,