@nextera.one/axis-server-sdk 0.7.0 → 0.8.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/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
1
  import { AxisFrame } 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";
@@ -578,7 +577,8 @@ interface AxisSensor {
578
577
  supports?(input: SensorInput): boolean;
579
578
  run(input: SensorInput): Promise<SensorDecision>;
580
579
  }
581
- interface AxisSensorInit extends AxisSensor, OnModuleInit {
580
+ interface AxisSensorInit extends AxisSensor {
581
+ onModuleInit?(): void | Promise<void>;
582
582
  }
583
583
  interface AxisPreSensor extends AxisSensor {
584
584
  phase: 'PRE_DECODE';
@@ -672,7 +672,8 @@ interface AxisHandler {
672
672
  readonly description?: string;
673
673
  readonly execute?: (body: Uint8Array, headers?: Map<number, Uint8Array>) => Promise<Uint8Array | any>;
674
674
  }
675
- interface AxisHandlerInit extends AxisHandler, OnModuleInit {
675
+ interface AxisHandlerInit extends AxisHandler {
676
+ onModuleInit?(): void | Promise<void>;
676
677
  }
677
678
 
678
679
  interface AxisCrudHandler extends AxisHandlerInit {
@@ -702,9 +703,6 @@ type Capability = keyof typeof CAPABILITIES;
702
703
  declare const PROOF_CAPABILITIES: Record<number, Capability[]>;
703
704
  declare const INTENT_REQUIREMENTS: Record<string, Capability[]>;
704
705
 
705
- declare function validateFrameShape(frame: any): boolean;
706
- declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
707
-
708
706
  declare const AXIS_OPCODES: Set<string>;
709
707
  declare function isKnownOpcode(op: string): boolean;
710
708
  declare function isAdminOpcode(op: string): boolean;
@@ -739,4 +737,4 @@ interface IntentDefinition {
739
737
  deprecated?: boolean;
740
738
  }
741
739
 
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 };
740
+ 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, nonce16, normalizeSensorDecision, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, parseScope, resolveTimeout, sensitivityName, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, utf8, varintU };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,5 @@
1
1
  import { AxisFrame } 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";
@@ -578,7 +577,8 @@ interface AxisSensor {
578
577
  supports?(input: SensorInput): boolean;
579
578
  run(input: SensorInput): Promise<SensorDecision>;
580
579
  }
581
- interface AxisSensorInit extends AxisSensor, OnModuleInit {
580
+ interface AxisSensorInit extends AxisSensor {
581
+ onModuleInit?(): void | Promise<void>;
582
582
  }
583
583
  interface AxisPreSensor extends AxisSensor {
584
584
  phase: 'PRE_DECODE';
@@ -672,7 +672,8 @@ interface AxisHandler {
672
672
  readonly description?: string;
673
673
  readonly execute?: (body: Uint8Array, headers?: Map<number, Uint8Array>) => Promise<Uint8Array | any>;
674
674
  }
675
- interface AxisHandlerInit extends AxisHandler, OnModuleInit {
675
+ interface AxisHandlerInit extends AxisHandler {
676
+ onModuleInit?(): void | Promise<void>;
676
677
  }
677
678
 
678
679
  interface AxisCrudHandler extends AxisHandlerInit {
@@ -702,9 +703,6 @@ type Capability = keyof typeof CAPABILITIES;
702
703
  declare const PROOF_CAPABILITIES: Record<number, Capability[]>;
703
704
  declare const INTENT_REQUIREMENTS: Record<string, Capability[]>;
704
705
 
705
- declare function validateFrameShape(frame: any): boolean;
706
- declare function isTimestampValid(ts: number, skewSeconds?: number): boolean;
707
-
708
706
  declare const AXIS_OPCODES: Set<string>;
709
707
  declare function isKnownOpcode(op: string): boolean;
710
708
  declare function isAdminOpcode(op: string): boolean;
@@ -739,4 +737,4 @@ interface IntentDefinition {
739
737
  deprecated?: boolean;
740
738
  }
741
739
 
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 };
740
+ 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, nonce16, normalizeSensorDecision, packPasskeyLoginOptionsReq, packPasskeyLoginOptionsRes, packPasskeyLoginVerifyReq, packPasskeyLoginVerifyRes, packPasskeyRegisterOptionsReq, parseScope, resolveTimeout, sensitivityName, tlv, u64be, unpackPasskeyLoginOptionsReq, unpackPasskeyLoginVerifyReq, unpackPasskeyRegisterOptionsReq, utf8, varintU };
package/dist/index.js CHANGED
@@ -160,7 +160,6 @@ __export(index_exports, {
160
160
  hasScope: () => hasScope,
161
161
  isAdminOpcode: () => isAdminOpcode,
162
162
  isKnownOpcode: () => isKnownOpcode,
163
- isTimestampValid: () => isTimestampValid,
164
163
  nonce16: () => nonce16,
165
164
  normalizeSensorDecision: () => normalizeSensorDecision,
166
165
  packPasskeyLoginOptionsReq: () => packPasskeyLoginOptionsReq,
@@ -179,7 +178,6 @@ __export(index_exports, {
179
178
  unpackPasskeyLoginVerifyReq: () => unpackPasskeyLoginVerifyReq,
180
179
  unpackPasskeyRegisterOptionsReq: () => unpackPasskeyRegisterOptionsReq,
181
180
  utf8: () => utf8,
182
- validateFrameShape: () => validateFrameShape,
183
181
  varintLength: () => varintLength,
184
182
  varintU: () => varintU,
185
183
  verifyFrameSignature: () => verifyFrameSignature
@@ -2111,49 +2109,6 @@ var INTENT_REQUIREMENTS = {
2111
2109
  "admin.*": ["admin"]
2112
2110
  };
2113
2111
 
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
2112
  // src/core/opcodes.ts
2158
2113
  var AXIS_OPCODES = /* @__PURE__ */ new Set([
2159
2114
  "CAPSULE.ISSUE",
@@ -2398,7 +2353,6 @@ function resolveTimeout(intent) {
2398
2353
  hasScope,
2399
2354
  isAdminOpcode,
2400
2355
  isKnownOpcode,
2401
- isTimestampValid,
2402
2356
  nonce16,
2403
2357
  normalizeSensorDecision,
2404
2358
  packPasskeyLoginOptionsReq,
@@ -2417,7 +2371,6 @@ function resolveTimeout(intent) {
2417
2371
  unpackPasskeyLoginVerifyReq,
2418
2372
  unpackPasskeyRegisterOptionsReq,
2419
2373
  utf8,
2420
- validateFrameShape,
2421
2374
  varintLength,
2422
2375
  varintU,
2423
2376
  verifyFrameSignature