@nextera.one/axis-server-sdk 2.2.6 → 2.2.7

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.
@@ -104,7 +104,7 @@ interface AxisRequestContext {
104
104
  }
105
105
 
106
106
  interface SensorPhaseMetadata {
107
- phase: 'PRE_DECODE' | 'POST_DECODE';
107
+ phase: "PRE_DECODE" | "POST_DECODE";
108
108
  dependencies?: string[];
109
109
  asyncOk?: boolean;
110
110
  cryptoOk?: boolean;
@@ -113,18 +113,18 @@ interface SensorPhaseMetadata {
113
113
  interface AxisSensor {
114
114
  readonly name: string;
115
115
  readonly order?: number;
116
- phase?: SensorPhaseMetadata | 'PRE_DECODE' | 'POST_DECODE';
117
- supports?(input: SensorInput): boolean;
116
+ phase?: SensorPhaseMetadata | "PRE_DECODE" | "POST_DECODE";
117
+ supports?(input: SensorInput): Promise<SensorDecision>;
118
118
  run(input: SensorInput): Promise<SensorDecision>;
119
119
  }
120
120
  interface AxisSensorInit extends AxisSensor {
121
121
  onModuleInit?(): void | Promise<void>;
122
122
  }
123
123
  interface AxisPreSensor extends AxisSensor {
124
- phase: 'PRE_DECODE';
124
+ phase: "PRE_DECODE";
125
125
  }
126
126
  interface AxisPostSensor extends AxisSensor {
127
- phase: 'POST_DECODE';
127
+ phase: "POST_DECODE";
128
128
  }
129
129
  interface SensorInput {
130
130
  rawBytes?: Buffer | Uint8Array;
@@ -168,20 +168,20 @@ type SensorDecision = {
168
168
  constraintsPatch?: Record<string, any>;
169
169
  };
170
170
  } | {
171
- action: 'ALLOW';
171
+ action: "ALLOW";
172
172
  meta?: any;
173
173
  } | {
174
- action: 'DENY';
174
+ action: "DENY";
175
175
  code: string;
176
176
  reason?: string;
177
177
  retryAfterMs?: number;
178
178
  meta?: any;
179
179
  } | {
180
- action: 'THROTTLE';
180
+ action: "THROTTLE";
181
181
  retryAfterMs: number;
182
182
  meta?: any;
183
183
  } | {
184
- action: 'FLAG';
184
+ action: "FLAG";
185
185
  scoreDelta: number;
186
186
  reasons: string[];
187
187
  meta?: any;
@@ -104,7 +104,7 @@ interface AxisRequestContext {
104
104
  }
105
105
 
106
106
  interface SensorPhaseMetadata {
107
- phase: 'PRE_DECODE' | 'POST_DECODE';
107
+ phase: "PRE_DECODE" | "POST_DECODE";
108
108
  dependencies?: string[];
109
109
  asyncOk?: boolean;
110
110
  cryptoOk?: boolean;
@@ -113,18 +113,18 @@ interface SensorPhaseMetadata {
113
113
  interface AxisSensor {
114
114
  readonly name: string;
115
115
  readonly order?: number;
116
- phase?: SensorPhaseMetadata | 'PRE_DECODE' | 'POST_DECODE';
117
- supports?(input: SensorInput): boolean;
116
+ phase?: SensorPhaseMetadata | "PRE_DECODE" | "POST_DECODE";
117
+ supports?(input: SensorInput): Promise<SensorDecision>;
118
118
  run(input: SensorInput): Promise<SensorDecision>;
119
119
  }
120
120
  interface AxisSensorInit extends AxisSensor {
121
121
  onModuleInit?(): void | Promise<void>;
122
122
  }
123
123
  interface AxisPreSensor extends AxisSensor {
124
- phase: 'PRE_DECODE';
124
+ phase: "PRE_DECODE";
125
125
  }
126
126
  interface AxisPostSensor extends AxisSensor {
127
- phase: 'POST_DECODE';
127
+ phase: "POST_DECODE";
128
128
  }
129
129
  interface SensorInput {
130
130
  rawBytes?: Buffer | Uint8Array;
@@ -168,20 +168,20 @@ type SensorDecision = {
168
168
  constraintsPatch?: Record<string, any>;
169
169
  };
170
170
  } | {
171
- action: 'ALLOW';
171
+ action: "ALLOW";
172
172
  meta?: any;
173
173
  } | {
174
- action: 'DENY';
174
+ action: "DENY";
175
175
  code: string;
176
176
  reason?: string;
177
177
  retryAfterMs?: number;
178
178
  meta?: any;
179
179
  } | {
180
- action: 'THROTTLE';
180
+ action: "THROTTLE";
181
181
  retryAfterMs: number;
182
182
  meta?: any;
183
183
  } | {
184
- action: 'FLAG';
184
+ action: "FLAG";
185
185
  scoreDelta: number;
186
186
  reasons: string[];
187
187
  meta?: any;
@@ -1,6 +1,6 @@
1
- import { C as CceCapsuleClaims, a as CceExecutionContext, b as CceRequestEnvelope } from '../cce-pipeline-B-zUBHo3.mjs';
2
- export { c as CCE_AES_KEY_BYTES, d as CCE_DERIVATION, e as CCE_ERROR, f as CCE_IV_BYTES, g as CCE_NONCE_BYTES, h as CCE_PROTOCOL_VERSION, i as CCE_TAG_BYTES, j as CceAlgorithm, k as CceAlgorithmDescriptor, l as CceAxisSigner, m as CceClientKeyEncryptor, n as CceConstraints, o as CceEncryptedKey, p as CceEncryptedPayload, q as CceError, r as CceErrorCode, s as CceHandler, t as CceHandlerContext, u as CceHandlerResult, v as CceKdfAlgorithm, w as CceKemAlgorithm, x as CcePipelineConfig, y as CcePipelineResult, z as CcePolicyContext, A as CcePolicyDecision, B as CcePolicyEvaluator, D as CceResponseEnvelope, E as CceResponseOptions, F as CceResponseStatus, G as CceSignature, H as CceVerificationState, I as CceWitnessRecord, J as CceWitnessStore, K as InMemoryCceWitnessStore, L as buildCceErrorResponse, M as buildCceResponse, N as buildWitnessRecord, O as executeCcePipeline, P as extractVerificationState } from '../cce-pipeline-B-zUBHo3.mjs';
3
- import { A as AxisSensor, S as SensorInput, a as SensorDecision } from '../axis-sensor-GBEI3Fab.mjs';
1
+ import { C as CceCapsuleClaims, a as CceExecutionContext, b as CceRequestEnvelope } from '../cce-pipeline-CBt56guN.mjs';
2
+ export { c as CCE_AES_KEY_BYTES, d as CCE_DERIVATION, e as CCE_ERROR, f as CCE_IV_BYTES, g as CCE_NONCE_BYTES, h as CCE_PROTOCOL_VERSION, i as CCE_TAG_BYTES, j as CceAlgorithm, k as CceAlgorithmDescriptor, l as CceAxisSigner, m as CceClientKeyEncryptor, n as CceConstraints, o as CceEncryptedKey, p as CceEncryptedPayload, q as CceError, r as CceErrorCode, s as CceHandler, t as CceHandlerContext, u as CceHandlerResult, v as CceKdfAlgorithm, w as CceKemAlgorithm, x as CcePipelineConfig, y as CcePipelineResult, z as CcePolicyContext, A as CcePolicyDecision, B as CcePolicyEvaluator, D as CceResponseEnvelope, E as CceResponseOptions, F as CceResponseStatus, G as CceSignature, H as CceVerificationState, I as CceWitnessRecord, J as CceWitnessStore, K as InMemoryCceWitnessStore, L as buildCceErrorResponse, M as buildCceResponse, N as buildWitnessRecord, O as executeCcePipeline, P as extractVerificationState } from '../cce-pipeline-CBt56guN.mjs';
3
+ import { A as AxisSensor, S as SensorInput, a as SensorDecision } from '../axis-sensor-DMW4rfRg.mjs';
4
4
 
5
5
  interface CceDerivationInput {
6
6
  axisLocalSecret: string;
@@ -40,7 +40,7 @@ declare class CcePayloadDecryptionSensor implements AxisSensor {
40
40
  readonly order = 145;
41
41
  readonly phase: "POST_DECODE";
42
42
  constructor(keyProvider: CceAxisKeyProvider, aesProvider: CceAesGcmProvider, maxPayloadBytes?: number, payloadValidator?: CcePayloadValidator | undefined);
43
- supports(input: SensorInput): boolean;
43
+ supports(input: SensorInput): Promise<SensorDecision>;
44
44
  run(input: SensorInput): Promise<SensorDecision>;
45
45
  }
46
46
 
@@ -62,7 +62,7 @@ declare class CceEnvelopeValidationSensor implements AxisSensor {
62
62
  readonly name = "cce.envelope.validation";
63
63
  readonly order = 5;
64
64
  readonly phase: "PRE_DECODE";
65
- supports(input: SensorInput): boolean;
65
+ supports(input: SensorInput): Promise<SensorDecision>;
66
66
  run(input: SensorInput): Promise<SensorDecision>;
67
67
  }
68
68
 
@@ -82,7 +82,7 @@ declare class CceClientSignatureSensor implements AxisSensor {
82
82
  readonly order = 45;
83
83
  readonly phase: "POST_DECODE";
84
84
  constructor(keyResolver: CceClientKeyResolver, signatureVerifier: CceSignatureVerifier);
85
- supports(input: SensorInput): boolean;
85
+ supports(input: SensorInput): Promise<SensorDecision>;
86
86
  run(input: SensorInput): Promise<SensorDecision>;
87
87
  }
88
88
 
@@ -105,7 +105,7 @@ declare class CceCapsuleVerificationSensor implements AxisSensor {
105
105
  readonly order = 50;
106
106
  readonly phase: "POST_DECODE";
107
107
  constructor(issuerKeyResolver: CceIssuerKeyResolver, capsuleVerifier: CceCapsuleSignatureVerifier);
108
- supports(input: SensorInput): boolean;
108
+ supports(input: SensorInput): Promise<SensorDecision>;
109
109
  run(input: SensorInput): Promise<SensorDecision>;
110
110
  }
111
111
 
@@ -115,7 +115,7 @@ declare class CceTpsWindowSensor implements AxisSensor {
115
115
  readonly order = 92;
116
116
  readonly phase: "POST_DECODE";
117
117
  constructor(skewMs?: number);
118
- supports(input: SensorInput): boolean;
118
+ supports(input: SensorInput): Promise<SensorDecision>;
119
119
  run(input: SensorInput): Promise<SensorDecision>;
120
120
  }
121
121
 
@@ -125,7 +125,7 @@ declare class CceAudienceIntentBindingSensor implements AxisSensor {
125
125
  readonly order = 95;
126
126
  readonly phase: "POST_DECODE";
127
127
  constructor(axisAudience: string);
128
- supports(input: SensorInput): boolean;
128
+ supports(input: SensorInput): Promise<SensorDecision>;
129
129
  run(input: SensorInput): Promise<SensorDecision>;
130
130
  }
131
131
 
@@ -155,7 +155,7 @@ declare class CceReplayProtectionSensor implements AxisSensor {
155
155
  constructor(replayStore: CceReplayStore, options?: {
156
156
  nonceTtlMs?: number;
157
157
  });
158
- supports(input: SensorInput): boolean;
158
+ supports(input: SensorInput): Promise<SensorDecision>;
159
159
  run(input: SensorInput): Promise<SensorDecision>;
160
160
  }
161
161
 
@@ -1,6 +1,6 @@
1
- import { C as CceCapsuleClaims, a as CceExecutionContext, b as CceRequestEnvelope } from '../cce-pipeline-DbGBSsCG.js';
2
- export { c as CCE_AES_KEY_BYTES, d as CCE_DERIVATION, e as CCE_ERROR, f as CCE_IV_BYTES, g as CCE_NONCE_BYTES, h as CCE_PROTOCOL_VERSION, i as CCE_TAG_BYTES, j as CceAlgorithm, k as CceAlgorithmDescriptor, l as CceAxisSigner, m as CceClientKeyEncryptor, n as CceConstraints, o as CceEncryptedKey, p as CceEncryptedPayload, q as CceError, r as CceErrorCode, s as CceHandler, t as CceHandlerContext, u as CceHandlerResult, v as CceKdfAlgorithm, w as CceKemAlgorithm, x as CcePipelineConfig, y as CcePipelineResult, z as CcePolicyContext, A as CcePolicyDecision, B as CcePolicyEvaluator, D as CceResponseEnvelope, E as CceResponseOptions, F as CceResponseStatus, G as CceSignature, H as CceVerificationState, I as CceWitnessRecord, J as CceWitnessStore, K as InMemoryCceWitnessStore, L as buildCceErrorResponse, M as buildCceResponse, N as buildWitnessRecord, O as executeCcePipeline, P as extractVerificationState } from '../cce-pipeline-DbGBSsCG.js';
3
- import { A as AxisSensor, S as SensorInput, a as SensorDecision } from '../axis-sensor-GBEI3Fab.js';
1
+ import { C as CceCapsuleClaims, a as CceExecutionContext, b as CceRequestEnvelope } from '../cce-pipeline-BJ-F1isr.js';
2
+ export { c as CCE_AES_KEY_BYTES, d as CCE_DERIVATION, e as CCE_ERROR, f as CCE_IV_BYTES, g as CCE_NONCE_BYTES, h as CCE_PROTOCOL_VERSION, i as CCE_TAG_BYTES, j as CceAlgorithm, k as CceAlgorithmDescriptor, l as CceAxisSigner, m as CceClientKeyEncryptor, n as CceConstraints, o as CceEncryptedKey, p as CceEncryptedPayload, q as CceError, r as CceErrorCode, s as CceHandler, t as CceHandlerContext, u as CceHandlerResult, v as CceKdfAlgorithm, w as CceKemAlgorithm, x as CcePipelineConfig, y as CcePipelineResult, z as CcePolicyContext, A as CcePolicyDecision, B as CcePolicyEvaluator, D as CceResponseEnvelope, E as CceResponseOptions, F as CceResponseStatus, G as CceSignature, H as CceVerificationState, I as CceWitnessRecord, J as CceWitnessStore, K as InMemoryCceWitnessStore, L as buildCceErrorResponse, M as buildCceResponse, N as buildWitnessRecord, O as executeCcePipeline, P as extractVerificationState } from '../cce-pipeline-BJ-F1isr.js';
3
+ import { A as AxisSensor, S as SensorInput, a as SensorDecision } from '../axis-sensor-DMW4rfRg.js';
4
4
 
5
5
  interface CceDerivationInput {
6
6
  axisLocalSecret: string;
@@ -40,7 +40,7 @@ declare class CcePayloadDecryptionSensor implements AxisSensor {
40
40
  readonly order = 145;
41
41
  readonly phase: "POST_DECODE";
42
42
  constructor(keyProvider: CceAxisKeyProvider, aesProvider: CceAesGcmProvider, maxPayloadBytes?: number, payloadValidator?: CcePayloadValidator | undefined);
43
- supports(input: SensorInput): boolean;
43
+ supports(input: SensorInput): Promise<SensorDecision>;
44
44
  run(input: SensorInput): Promise<SensorDecision>;
45
45
  }
46
46
 
@@ -62,7 +62,7 @@ declare class CceEnvelopeValidationSensor implements AxisSensor {
62
62
  readonly name = "cce.envelope.validation";
63
63
  readonly order = 5;
64
64
  readonly phase: "PRE_DECODE";
65
- supports(input: SensorInput): boolean;
65
+ supports(input: SensorInput): Promise<SensorDecision>;
66
66
  run(input: SensorInput): Promise<SensorDecision>;
67
67
  }
68
68
 
@@ -82,7 +82,7 @@ declare class CceClientSignatureSensor implements AxisSensor {
82
82
  readonly order = 45;
83
83
  readonly phase: "POST_DECODE";
84
84
  constructor(keyResolver: CceClientKeyResolver, signatureVerifier: CceSignatureVerifier);
85
- supports(input: SensorInput): boolean;
85
+ supports(input: SensorInput): Promise<SensorDecision>;
86
86
  run(input: SensorInput): Promise<SensorDecision>;
87
87
  }
88
88
 
@@ -105,7 +105,7 @@ declare class CceCapsuleVerificationSensor implements AxisSensor {
105
105
  readonly order = 50;
106
106
  readonly phase: "POST_DECODE";
107
107
  constructor(issuerKeyResolver: CceIssuerKeyResolver, capsuleVerifier: CceCapsuleSignatureVerifier);
108
- supports(input: SensorInput): boolean;
108
+ supports(input: SensorInput): Promise<SensorDecision>;
109
109
  run(input: SensorInput): Promise<SensorDecision>;
110
110
  }
111
111
 
@@ -115,7 +115,7 @@ declare class CceTpsWindowSensor implements AxisSensor {
115
115
  readonly order = 92;
116
116
  readonly phase: "POST_DECODE";
117
117
  constructor(skewMs?: number);
118
- supports(input: SensorInput): boolean;
118
+ supports(input: SensorInput): Promise<SensorDecision>;
119
119
  run(input: SensorInput): Promise<SensorDecision>;
120
120
  }
121
121
 
@@ -125,7 +125,7 @@ declare class CceAudienceIntentBindingSensor implements AxisSensor {
125
125
  readonly order = 95;
126
126
  readonly phase: "POST_DECODE";
127
127
  constructor(axisAudience: string);
128
- supports(input: SensorInput): boolean;
128
+ supports(input: SensorInput): Promise<SensorDecision>;
129
129
  run(input: SensorInput): Promise<SensorDecision>;
130
130
  }
131
131
 
@@ -155,7 +155,7 @@ declare class CceReplayProtectionSensor implements AxisSensor {
155
155
  constructor(replayStore: CceReplayStore, options?: {
156
156
  nonceTtlMs?: number;
157
157
  });
158
- supports(input: SensorInput): boolean;
158
+ supports(input: SensorInput): Promise<SensorDecision>;
159
159
  run(input: SensorInput): Promise<SensorDecision>;
160
160
  }
161
161
 
package/dist/cce/index.js CHANGED
@@ -86,6 +86,7 @@ var CCE_ERROR = {
86
86
  CAPSULE_NOT_YET_VALID: "CCE_CAPSULE_NOT_YET_VALID",
87
87
  CAPSULE_REVOKED: "CCE_CAPSULE_REVOKED",
88
88
  CAPSULE_CONSUMED: "CCE_CAPSULE_CONSUMED",
89
+ CAPSULE_NOT_VERIFIED: "CCE_CAPSULE_NOT_VERIFIED",
89
90
  // Binding errors
90
91
  AUDIENCE_MISMATCH: "CCE_AUDIENCE_MISMATCH",
91
92
  INTENT_MISMATCH: "CCE_INTENT_MISMATCH",
@@ -790,8 +791,12 @@ var CceEnvelopeValidationSensor = class {
790
791
  this.order = 5;
791
792
  this.phase = "PRE_DECODE";
792
793
  }
793
- supports(input) {
794
- return input.metadata?.cce === true || input.metadata?.contentType === "application/axis-cce";
794
+ async supports(input) {
795
+ return input.metadata?.cce === true || input.metadata?.contentType === "application/axis-cce" ? { action: "ALLOW" } : {
796
+ action: "DENY",
797
+ code: "SENSOR_NOT_APPLICABLE",
798
+ reason: "Not a CCE envelope"
799
+ };
795
800
  }
796
801
  async run(input) {
797
802
  const envelope = input.metadata?.cceEnvelope;
@@ -878,8 +883,12 @@ var CceClientSignatureSensor = class {
878
883
  this.order = 45;
879
884
  this.phase = "POST_DECODE";
880
885
  }
881
- supports(input) {
882
- return input.metadata?.cceEnvelopeValid === true;
886
+ async supports(input) {
887
+ return input.metadata?.cceEnvelopeValid === true ? { action: "ALLOW" } : {
888
+ action: "DENY",
889
+ code: "SENSOR_NOT_APPLICABLE",
890
+ reason: "CCE envelope not validated"
891
+ };
883
892
  }
884
893
  async run(input) {
885
894
  const envelope = input.metadata?.cceEnvelope;
@@ -955,8 +964,12 @@ var CceCapsuleVerificationSensor = class {
955
964
  this.order = 50;
956
965
  this.phase = "POST_DECODE";
957
966
  }
958
- supports(input) {
959
- return input.metadata?.cceEnvelopeValid === true;
967
+ async supports(input) {
968
+ return input.metadata?.cceEnvelopeValid === true ? { action: "ALLOW" } : {
969
+ action: "DENY",
970
+ code: CCE_ERROR.CAPSULE_NOT_VERIFIED,
971
+ reason: "CCE capsule not verified"
972
+ };
960
973
  }
961
974
  async run(input) {
962
975
  const capsule = input.metadata?.cceEnvelope?.capsule;
@@ -1069,8 +1082,12 @@ var CceTpsWindowSensor = class {
1069
1082
  this.order = 92;
1070
1083
  this.phase = "POST_DECODE";
1071
1084
  }
1072
- supports(input) {
1073
- return input.metadata?.cceCapsuleVerified === true;
1085
+ async supports(input) {
1086
+ return input.metadata?.cceCapsuleVerified === true ? { action: "ALLOW" } : {
1087
+ action: "DENY",
1088
+ code: "SENSOR_NOT_APPLICABLE",
1089
+ reason: "CCE capsule not verified"
1090
+ };
1074
1091
  }
1075
1092
  async run(input) {
1076
1093
  const capsule = input.metadata?.cceCapsule;
@@ -1122,8 +1139,12 @@ var CceAudienceIntentBindingSensor = class {
1122
1139
  this.order = 95;
1123
1140
  this.phase = "POST_DECODE";
1124
1141
  }
1125
- supports(input) {
1126
- return input.metadata?.cceCapsuleVerified === true;
1142
+ async supports(input) {
1143
+ return input.metadata?.cceCapsuleVerified === true ? { action: "ALLOW" } : {
1144
+ action: "DENY",
1145
+ code: CCE_ERROR.CAPSULE_NOT_VERIFIED,
1146
+ reason: "CCE capsule not verified"
1147
+ };
1127
1148
  }
1128
1149
  async run(input) {
1129
1150
  const capsule = input.metadata?.cceCapsule;
@@ -1219,8 +1240,12 @@ var CceReplayProtectionSensor = class {
1219
1240
  this.phase = "POST_DECODE";
1220
1241
  this.nonceTtlMs = options?.nonceTtlMs ?? 5 * 60 * 1e3;
1221
1242
  }
1222
- supports(input) {
1223
- return input.metadata?.cceCapsuleVerified === true;
1243
+ async supports(input) {
1244
+ return input.metadata?.cceCapsuleVerified === true ? { action: "ALLOW" } : {
1245
+ action: "DENY",
1246
+ code: "SENSOR_NOT_APPLICABLE",
1247
+ reason: "CCE capsule not verified"
1248
+ };
1224
1249
  }
1225
1250
  async run(input) {
1226
1251
  const capsule = input.metadata?.cceCapsule;
@@ -1299,8 +1324,12 @@ var CcePayloadDecryptionSensor = class {
1299
1324
  this.order = 145;
1300
1325
  this.phase = "POST_DECODE";
1301
1326
  }
1302
- supports(input) {
1303
- return input.metadata?.cceEnvelopeValid === true && input.metadata?.cceClientSigVerified === true && input.metadata?.cceCapsuleVerified === true && input.metadata?.cceReplayClean === true;
1327
+ async supports(input) {
1328
+ return input.metadata?.cceEnvelopeValid === true && input.metadata?.cceClientSigVerified === true && input.metadata?.cceCapsuleVerified === true && input.metadata?.cceReplayClean === true ? { action: "ALLOW" } : {
1329
+ action: "DENY",
1330
+ code: "SENSOR_NOT_APPLICABLE",
1331
+ reason: "CCE preconditions not met"
1332
+ };
1304
1333
  }
1305
1334
  async run(input) {
1306
1335
  const envelope = input.metadata?.cceEnvelope;