blockintel-gate-sdk 0.3.1 → 0.3.3

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.cts CHANGED
@@ -14,6 +14,8 @@ interface Metrics {
14
14
  timeoutsTotal: number;
15
15
  errorsTotal: number;
16
16
  circuitBreakerOpenTotal: number;
17
+ wouldBlockTotal: number;
18
+ failOpenTotal: number;
17
19
  latencyMs: number[];
18
20
  }
19
21
  type MetricsHook = (metrics: Metrics) => void | Promise<void>;
@@ -28,13 +30,15 @@ declare class MetricsCollector {
28
30
  private timeoutsTotal;
29
31
  private errorsTotal;
30
32
  private circuitBreakerOpenTotal;
33
+ private wouldBlockTotal;
34
+ private failOpenTotal;
31
35
  private latencyMs;
32
36
  private readonly maxSamples;
33
37
  private readonly hooks;
34
38
  /**
35
39
  * Record a request
36
40
  */
37
- recordRequest(decision: 'ALLOW' | 'BLOCK' | 'REQUIRE_STEP_UP', latencyMs: number): void;
41
+ recordRequest(decision: 'ALLOW' | 'BLOCK' | 'REQUIRE_STEP_UP' | 'WOULD_BLOCK' | 'FAIL_OPEN', latencyMs: number): void;
38
42
  /**
39
43
  * Record a timeout
40
44
  */
@@ -111,6 +115,13 @@ interface DefenseEvaluateRequestV2 {
111
115
  signingContext?: SigningContext;
112
116
  requestId?: string;
113
117
  timestampMs?: number;
118
+ /**
119
+ * Enable transaction simulation (optional, defaults to false)
120
+ *
121
+ * When true, Hot Path will simulate the transaction after static policy evaluation.
122
+ * Adds 300-800ms latency but provides additional security checks.
123
+ */
124
+ simulate?: boolean;
114
125
  }
115
126
  /**
116
127
  * Gate decision types
@@ -132,6 +143,18 @@ interface DefenseEvaluateResponseV2 {
132
143
  policyVersion?: string;
133
144
  correlationId?: string;
134
145
  stepUp?: StepUpMetadata;
146
+ /**
147
+ * Whether the decision was enforced (false in SHADOW mode)
148
+ */
149
+ enforced?: boolean;
150
+ /**
151
+ * Whether shadow mode would have blocked (true if mode=SHADOW and decision=BLOCK)
152
+ */
153
+ shadowWouldBlock?: boolean;
154
+ /**
155
+ * Gate mode used for this evaluation
156
+ */
157
+ mode?: GateMode;
135
158
  }
136
159
  /**
137
160
  * Step-up status types
@@ -162,9 +185,23 @@ interface StepUpFinalResult {
162
185
  correlationId?: string;
163
186
  }
164
187
  /**
165
- * Fail-safe mode for SDK
188
+ * Fail-safe mode for SDK (deprecated - use onConnectionFailure instead)
166
189
  */
167
190
  type FailSafeMode = 'ALLOW_ON_TIMEOUT' | 'BLOCK_ON_TIMEOUT' | 'BLOCK_ON_ANOMALY';
191
+ /**
192
+ * Gate Mode
193
+ *
194
+ * SHADOW: Evaluate and log, but always allow (monitor-only)
195
+ * ENFORCE: Evaluate and enforce decisions (block if policy violation)
196
+ */
197
+ type GateMode = 'SHADOW' | 'ENFORCE';
198
+ /**
199
+ * Connection Failure Strategy
200
+ *
201
+ * FAIL_OPEN: Allow transaction if hotpath is unreachable
202
+ * FAIL_CLOSED: Block transaction if hotpath is unreachable (security-first)
203
+ */
204
+ type ConnectionFailureStrategy = 'FAIL_OPEN' | 'FAIL_CLOSED';
168
205
  /**
169
206
  * Circuit breaker configuration
170
207
  */
@@ -191,6 +228,20 @@ interface GateClientConfig {
191
228
  clockSkewMs?: number;
192
229
  retries?: number;
193
230
  failSafeMode?: FailSafeMode;
231
+ /**
232
+ * Gate mode (default: SHADOW for safety)
233
+ *
234
+ * SHADOW: Monitor-only - evaluate and log, but always allow
235
+ * ENFORCE: Enforce decisions - block if policy violation
236
+ */
237
+ mode?: GateMode;
238
+ /**
239
+ * Connection failure strategy (default: based on mode)
240
+ *
241
+ * FAIL_OPEN: Allow on connection failure (default in SHADOW mode)
242
+ * FAIL_CLOSED: Block on connection failure (default in ENFORCE mode)
243
+ */
244
+ onConnectionFailure?: ConnectionFailureStrategy;
194
245
  circuitBreaker?: CircuitBreakerConfig$1;
195
246
  enableStepUp?: boolean;
196
247
  stepUp?: {
@@ -199,6 +250,41 @@ interface GateClientConfig {
199
250
  treatRequireStepUpAsBlockWhenDisabled?: boolean;
200
251
  };
201
252
  onMetrics?: (metrics: Metrics) => void | Promise<void>;
253
+ signerId?: string;
254
+ heartbeatRefreshIntervalSeconds?: number;
255
+ /**
256
+ * Break-glass token (optional, for emergency override)
257
+ *
258
+ * JWT token issued by Control Plane for time-bound policy bypass.
259
+ * Only valid if explicitly activated via break-glass endpoint.
260
+ */
261
+ breakglassToken?: string;
262
+ /**
263
+ * Local development mode - disables auth, heartbeat, and break-glass
264
+ * Set to true when using gate-local emulator
265
+ */
266
+ local?: boolean;
267
+ /**
268
+ * Enforcement mode (default: SOFT)
269
+ *
270
+ * SOFT: Warns if IAM permission risk detected, but allows initialization
271
+ * HARD: Blocks initialization if IAM permission risk detected (unless override set)
272
+ */
273
+ enforcementMode?: 'SOFT' | 'HARD';
274
+ /**
275
+ * Allow initialization even if IAM permission risk detected
276
+ *
277
+ * Default: false in HARD mode, true in SOFT mode
278
+ *
279
+ * WARNING: Setting to true in HARD mode defeats the purpose of hard enforcement.
280
+ * Only use during migration periods.
281
+ */
282
+ allowInsecureKmsSignPermission?: boolean;
283
+ /**
284
+ * Optional: Specific KMS key IDs to check for permission risk
285
+ * If not provided, checks for any kms:Sign permission
286
+ */
287
+ kmsKeyIds?: string[];
202
288
  }
203
289
 
204
290
  /**
@@ -344,11 +430,23 @@ declare class GateClient {
344
430
  private readonly stepUpPoller?;
345
431
  private readonly circuitBreaker?;
346
432
  private readonly metrics;
433
+ private readonly heartbeatManager;
434
+ private readonly mode;
435
+ private readonly onConnectionFailure;
347
436
  constructor(config: GateClientConfig);
437
+ /**
438
+ * Perform async IAM permission risk check (non-blocking)
439
+ *
440
+ * Performs async IAM simulation check in background.
441
+ * Logs warnings but doesn't block (initialization already completed).
442
+ */
443
+ private performIamRiskCheckAsync;
348
444
  /**
349
445
  * Evaluate a transaction defense request
350
446
  *
351
447
  * Implements:
448
+ * - Shadow Mode (SHADOW: monitor-only, ENFORCE: enforce decisions)
449
+ * - Connection failure strategy (FAIL_OPEN vs FAIL_CLOSED)
352
450
  * - Circuit breaker protection
353
451
  * - Fail-safe modes (ALLOW_ON_TIMEOUT, BLOCK_ON_TIMEOUT, BLOCK_ON_ANOMALY)
354
452
  * - Metrics collection
@@ -428,7 +526,11 @@ declare enum GateErrorCode {
428
526
  STEP_UP_TIMEOUT = "STEP_UP_TIMEOUT",
429
527
  BLOCKED = "BLOCKED",
430
528
  SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
431
- AUTH_ERROR = "AUTH_ERROR"
529
+ AUTH_ERROR = "AUTH_ERROR",
530
+ HEARTBEAT_MISSING = "HEARTBEAT_MISSING",
531
+ HEARTBEAT_EXPIRED = "HEARTBEAT_EXPIRED",
532
+ HEARTBEAT_INVALID = "HEARTBEAT_INVALID",
533
+ HEARTBEAT_MISMATCH = "HEARTBEAT_MISMATCH"
432
534
  }
433
535
  /**
434
536
  * Base Gate error class
@@ -534,4 +636,126 @@ declare class ProvenanceProvider {
534
636
  static isEnabled(): boolean;
535
637
  }
536
638
 
537
- export { BlockIntelAuthError, BlockIntelBlockedError, BlockIntelStepUpRequiredError, BlockIntelUnavailableError, type DefenseEvaluateRequestV2, type DefenseEvaluateResponseV2, GateClient, type GateClientConfig, type GateDecision, GateError, GateErrorCode, type GateStepUpStatus, type Provenance, ProvenanceProvider, type SigningContext, type StepUpFinalResult, type StepUpMetadata, StepUpNotConfiguredError, type StepUpStatusResponse, type TransactionIntentV2, type WrapKmsClientOptions, type WrappedKmsClient, createGateClient, GateClient as default, wrapKmsClient };
639
+ /**
640
+ * BlockIntel Gate SDK - HTTP Client
641
+ *
642
+ * Fetch wrapper with timeout, retry, and error handling.
643
+ */
644
+ interface HttpClientConfig {
645
+ baseUrl: string;
646
+ timeoutMs?: number;
647
+ userAgent?: string;
648
+ retryOptions?: {
649
+ maxAttempts?: number;
650
+ baseDelayMs?: number;
651
+ maxDelayMs?: number;
652
+ factor?: number;
653
+ };
654
+ }
655
+ interface RequestOptions {
656
+ method: string;
657
+ path: string;
658
+ headers?: Record<string, string>;
659
+ body?: unknown;
660
+ requestId?: string;
661
+ }
662
+ /**
663
+ * HTTP client with retry and timeout support
664
+ */
665
+ declare class HttpClient {
666
+ private readonly baseUrl;
667
+ private readonly timeoutMs;
668
+ private readonly userAgent;
669
+ private readonly retryOptions;
670
+ constructor(config: HttpClientConfig);
671
+ /**
672
+ * Make an HTTP request with retry and timeout
673
+ */
674
+ request<T>(options: RequestOptions): Promise<T>;
675
+ /**
676
+ * Map HTTP status code to GateErrorCode
677
+ */
678
+ private statusToErrorCode;
679
+ }
680
+
681
+ /**
682
+ * Gate SDK - Heartbeat Manager
683
+ *
684
+ * Manages heartbeat token acquisition and validation.
685
+ * Heartbeat tokens prove Gate is alive and enforcing policy.
686
+ * Required for all signing operations.
687
+ *
688
+ * Features:
689
+ * - Automatic refresh with jitter
690
+ * - Exponential backoff on failures
691
+ * - Client instance metadata tracking
692
+ */
693
+
694
+ interface HeartbeatToken {
695
+ token: string;
696
+ expiresAt: number;
697
+ jti?: string;
698
+ policyHash?: string;
699
+ }
700
+ declare class HeartbeatManager {
701
+ private readonly httpClient;
702
+ private readonly tenantId;
703
+ private signerId;
704
+ private readonly environment;
705
+ private readonly baseRefreshIntervalSeconds;
706
+ private readonly clientInstanceId;
707
+ private readonly sdkVersion;
708
+ private currentToken;
709
+ private refreshTimer;
710
+ private started;
711
+ private consecutiveFailures;
712
+ private maxBackoffSeconds;
713
+ constructor(options: {
714
+ httpClient: HttpClient;
715
+ tenantId: string;
716
+ signerId: string;
717
+ environment?: string;
718
+ refreshIntervalSeconds?: number;
719
+ clientInstanceId?: string;
720
+ sdkVersion?: string;
721
+ });
722
+ /**
723
+ * Start background heartbeat refresher
724
+ */
725
+ start(): void;
726
+ /**
727
+ * Schedule next refresh with jitter and backoff
728
+ */
729
+ private scheduleNextRefresh;
730
+ /**
731
+ * Calculate exponential backoff (capped at maxBackoffSeconds)
732
+ */
733
+ private calculateBackoff;
734
+ /**
735
+ * Stop background heartbeat refresher
736
+ */
737
+ stop(): void;
738
+ /**
739
+ * Get current heartbeat token if valid
740
+ */
741
+ getToken(): string | null;
742
+ /**
743
+ * Check if current heartbeat token is valid
744
+ */
745
+ isValid(): boolean;
746
+ /**
747
+ * Update signer ID (called when signer is known)
748
+ */
749
+ updateSignerId(signerId: string): void;
750
+ /**
751
+ * Acquire a new heartbeat token from Control Plane
752
+ * NEVER logs token value (security)
753
+ */
754
+ private acquireHeartbeat;
755
+ /**
756
+ * Get client instance ID (for tracking)
757
+ */
758
+ getClientInstanceId(): string;
759
+ }
760
+
761
+ export { BlockIntelAuthError, BlockIntelBlockedError, BlockIntelStepUpRequiredError, BlockIntelUnavailableError, type DefenseEvaluateRequestV2, type DefenseEvaluateResponseV2, GateClient, type GateClientConfig, type GateDecision, GateError, GateErrorCode, type GateStepUpStatus, HeartbeatManager, type HeartbeatToken, type Provenance, ProvenanceProvider, type SigningContext, type StepUpFinalResult, type StepUpMetadata, StepUpNotConfiguredError, type StepUpStatusResponse, type TransactionIntentV2, type WrapKmsClientOptions, type WrappedKmsClient, createGateClient, GateClient as default, wrapKmsClient };
package/dist/index.d.ts CHANGED
@@ -14,6 +14,8 @@ interface Metrics {
14
14
  timeoutsTotal: number;
15
15
  errorsTotal: number;
16
16
  circuitBreakerOpenTotal: number;
17
+ wouldBlockTotal: number;
18
+ failOpenTotal: number;
17
19
  latencyMs: number[];
18
20
  }
19
21
  type MetricsHook = (metrics: Metrics) => void | Promise<void>;
@@ -28,13 +30,15 @@ declare class MetricsCollector {
28
30
  private timeoutsTotal;
29
31
  private errorsTotal;
30
32
  private circuitBreakerOpenTotal;
33
+ private wouldBlockTotal;
34
+ private failOpenTotal;
31
35
  private latencyMs;
32
36
  private readonly maxSamples;
33
37
  private readonly hooks;
34
38
  /**
35
39
  * Record a request
36
40
  */
37
- recordRequest(decision: 'ALLOW' | 'BLOCK' | 'REQUIRE_STEP_UP', latencyMs: number): void;
41
+ recordRequest(decision: 'ALLOW' | 'BLOCK' | 'REQUIRE_STEP_UP' | 'WOULD_BLOCK' | 'FAIL_OPEN', latencyMs: number): void;
38
42
  /**
39
43
  * Record a timeout
40
44
  */
@@ -111,6 +115,13 @@ interface DefenseEvaluateRequestV2 {
111
115
  signingContext?: SigningContext;
112
116
  requestId?: string;
113
117
  timestampMs?: number;
118
+ /**
119
+ * Enable transaction simulation (optional, defaults to false)
120
+ *
121
+ * When true, Hot Path will simulate the transaction after static policy evaluation.
122
+ * Adds 300-800ms latency but provides additional security checks.
123
+ */
124
+ simulate?: boolean;
114
125
  }
115
126
  /**
116
127
  * Gate decision types
@@ -132,6 +143,18 @@ interface DefenseEvaluateResponseV2 {
132
143
  policyVersion?: string;
133
144
  correlationId?: string;
134
145
  stepUp?: StepUpMetadata;
146
+ /**
147
+ * Whether the decision was enforced (false in SHADOW mode)
148
+ */
149
+ enforced?: boolean;
150
+ /**
151
+ * Whether shadow mode would have blocked (true if mode=SHADOW and decision=BLOCK)
152
+ */
153
+ shadowWouldBlock?: boolean;
154
+ /**
155
+ * Gate mode used for this evaluation
156
+ */
157
+ mode?: GateMode;
135
158
  }
136
159
  /**
137
160
  * Step-up status types
@@ -162,9 +185,23 @@ interface StepUpFinalResult {
162
185
  correlationId?: string;
163
186
  }
164
187
  /**
165
- * Fail-safe mode for SDK
188
+ * Fail-safe mode for SDK (deprecated - use onConnectionFailure instead)
166
189
  */
167
190
  type FailSafeMode = 'ALLOW_ON_TIMEOUT' | 'BLOCK_ON_TIMEOUT' | 'BLOCK_ON_ANOMALY';
191
+ /**
192
+ * Gate Mode
193
+ *
194
+ * SHADOW: Evaluate and log, but always allow (monitor-only)
195
+ * ENFORCE: Evaluate and enforce decisions (block if policy violation)
196
+ */
197
+ type GateMode = 'SHADOW' | 'ENFORCE';
198
+ /**
199
+ * Connection Failure Strategy
200
+ *
201
+ * FAIL_OPEN: Allow transaction if hotpath is unreachable
202
+ * FAIL_CLOSED: Block transaction if hotpath is unreachable (security-first)
203
+ */
204
+ type ConnectionFailureStrategy = 'FAIL_OPEN' | 'FAIL_CLOSED';
168
205
  /**
169
206
  * Circuit breaker configuration
170
207
  */
@@ -191,6 +228,20 @@ interface GateClientConfig {
191
228
  clockSkewMs?: number;
192
229
  retries?: number;
193
230
  failSafeMode?: FailSafeMode;
231
+ /**
232
+ * Gate mode (default: SHADOW for safety)
233
+ *
234
+ * SHADOW: Monitor-only - evaluate and log, but always allow
235
+ * ENFORCE: Enforce decisions - block if policy violation
236
+ */
237
+ mode?: GateMode;
238
+ /**
239
+ * Connection failure strategy (default: based on mode)
240
+ *
241
+ * FAIL_OPEN: Allow on connection failure (default in SHADOW mode)
242
+ * FAIL_CLOSED: Block on connection failure (default in ENFORCE mode)
243
+ */
244
+ onConnectionFailure?: ConnectionFailureStrategy;
194
245
  circuitBreaker?: CircuitBreakerConfig$1;
195
246
  enableStepUp?: boolean;
196
247
  stepUp?: {
@@ -199,6 +250,41 @@ interface GateClientConfig {
199
250
  treatRequireStepUpAsBlockWhenDisabled?: boolean;
200
251
  };
201
252
  onMetrics?: (metrics: Metrics) => void | Promise<void>;
253
+ signerId?: string;
254
+ heartbeatRefreshIntervalSeconds?: number;
255
+ /**
256
+ * Break-glass token (optional, for emergency override)
257
+ *
258
+ * JWT token issued by Control Plane for time-bound policy bypass.
259
+ * Only valid if explicitly activated via break-glass endpoint.
260
+ */
261
+ breakglassToken?: string;
262
+ /**
263
+ * Local development mode - disables auth, heartbeat, and break-glass
264
+ * Set to true when using gate-local emulator
265
+ */
266
+ local?: boolean;
267
+ /**
268
+ * Enforcement mode (default: SOFT)
269
+ *
270
+ * SOFT: Warns if IAM permission risk detected, but allows initialization
271
+ * HARD: Blocks initialization if IAM permission risk detected (unless override set)
272
+ */
273
+ enforcementMode?: 'SOFT' | 'HARD';
274
+ /**
275
+ * Allow initialization even if IAM permission risk detected
276
+ *
277
+ * Default: false in HARD mode, true in SOFT mode
278
+ *
279
+ * WARNING: Setting to true in HARD mode defeats the purpose of hard enforcement.
280
+ * Only use during migration periods.
281
+ */
282
+ allowInsecureKmsSignPermission?: boolean;
283
+ /**
284
+ * Optional: Specific KMS key IDs to check for permission risk
285
+ * If not provided, checks for any kms:Sign permission
286
+ */
287
+ kmsKeyIds?: string[];
202
288
  }
203
289
 
204
290
  /**
@@ -344,11 +430,23 @@ declare class GateClient {
344
430
  private readonly stepUpPoller?;
345
431
  private readonly circuitBreaker?;
346
432
  private readonly metrics;
433
+ private readonly heartbeatManager;
434
+ private readonly mode;
435
+ private readonly onConnectionFailure;
347
436
  constructor(config: GateClientConfig);
437
+ /**
438
+ * Perform async IAM permission risk check (non-blocking)
439
+ *
440
+ * Performs async IAM simulation check in background.
441
+ * Logs warnings but doesn't block (initialization already completed).
442
+ */
443
+ private performIamRiskCheckAsync;
348
444
  /**
349
445
  * Evaluate a transaction defense request
350
446
  *
351
447
  * Implements:
448
+ * - Shadow Mode (SHADOW: monitor-only, ENFORCE: enforce decisions)
449
+ * - Connection failure strategy (FAIL_OPEN vs FAIL_CLOSED)
352
450
  * - Circuit breaker protection
353
451
  * - Fail-safe modes (ALLOW_ON_TIMEOUT, BLOCK_ON_TIMEOUT, BLOCK_ON_ANOMALY)
354
452
  * - Metrics collection
@@ -428,7 +526,11 @@ declare enum GateErrorCode {
428
526
  STEP_UP_TIMEOUT = "STEP_UP_TIMEOUT",
429
527
  BLOCKED = "BLOCKED",
430
528
  SERVICE_UNAVAILABLE = "SERVICE_UNAVAILABLE",
431
- AUTH_ERROR = "AUTH_ERROR"
529
+ AUTH_ERROR = "AUTH_ERROR",
530
+ HEARTBEAT_MISSING = "HEARTBEAT_MISSING",
531
+ HEARTBEAT_EXPIRED = "HEARTBEAT_EXPIRED",
532
+ HEARTBEAT_INVALID = "HEARTBEAT_INVALID",
533
+ HEARTBEAT_MISMATCH = "HEARTBEAT_MISMATCH"
432
534
  }
433
535
  /**
434
536
  * Base Gate error class
@@ -534,4 +636,126 @@ declare class ProvenanceProvider {
534
636
  static isEnabled(): boolean;
535
637
  }
536
638
 
537
- export { BlockIntelAuthError, BlockIntelBlockedError, BlockIntelStepUpRequiredError, BlockIntelUnavailableError, type DefenseEvaluateRequestV2, type DefenseEvaluateResponseV2, GateClient, type GateClientConfig, type GateDecision, GateError, GateErrorCode, type GateStepUpStatus, type Provenance, ProvenanceProvider, type SigningContext, type StepUpFinalResult, type StepUpMetadata, StepUpNotConfiguredError, type StepUpStatusResponse, type TransactionIntentV2, type WrapKmsClientOptions, type WrappedKmsClient, createGateClient, GateClient as default, wrapKmsClient };
639
+ /**
640
+ * BlockIntel Gate SDK - HTTP Client
641
+ *
642
+ * Fetch wrapper with timeout, retry, and error handling.
643
+ */
644
+ interface HttpClientConfig {
645
+ baseUrl: string;
646
+ timeoutMs?: number;
647
+ userAgent?: string;
648
+ retryOptions?: {
649
+ maxAttempts?: number;
650
+ baseDelayMs?: number;
651
+ maxDelayMs?: number;
652
+ factor?: number;
653
+ };
654
+ }
655
+ interface RequestOptions {
656
+ method: string;
657
+ path: string;
658
+ headers?: Record<string, string>;
659
+ body?: unknown;
660
+ requestId?: string;
661
+ }
662
+ /**
663
+ * HTTP client with retry and timeout support
664
+ */
665
+ declare class HttpClient {
666
+ private readonly baseUrl;
667
+ private readonly timeoutMs;
668
+ private readonly userAgent;
669
+ private readonly retryOptions;
670
+ constructor(config: HttpClientConfig);
671
+ /**
672
+ * Make an HTTP request with retry and timeout
673
+ */
674
+ request<T>(options: RequestOptions): Promise<T>;
675
+ /**
676
+ * Map HTTP status code to GateErrorCode
677
+ */
678
+ private statusToErrorCode;
679
+ }
680
+
681
+ /**
682
+ * Gate SDK - Heartbeat Manager
683
+ *
684
+ * Manages heartbeat token acquisition and validation.
685
+ * Heartbeat tokens prove Gate is alive and enforcing policy.
686
+ * Required for all signing operations.
687
+ *
688
+ * Features:
689
+ * - Automatic refresh with jitter
690
+ * - Exponential backoff on failures
691
+ * - Client instance metadata tracking
692
+ */
693
+
694
+ interface HeartbeatToken {
695
+ token: string;
696
+ expiresAt: number;
697
+ jti?: string;
698
+ policyHash?: string;
699
+ }
700
+ declare class HeartbeatManager {
701
+ private readonly httpClient;
702
+ private readonly tenantId;
703
+ private signerId;
704
+ private readonly environment;
705
+ private readonly baseRefreshIntervalSeconds;
706
+ private readonly clientInstanceId;
707
+ private readonly sdkVersion;
708
+ private currentToken;
709
+ private refreshTimer;
710
+ private started;
711
+ private consecutiveFailures;
712
+ private maxBackoffSeconds;
713
+ constructor(options: {
714
+ httpClient: HttpClient;
715
+ tenantId: string;
716
+ signerId: string;
717
+ environment?: string;
718
+ refreshIntervalSeconds?: number;
719
+ clientInstanceId?: string;
720
+ sdkVersion?: string;
721
+ });
722
+ /**
723
+ * Start background heartbeat refresher
724
+ */
725
+ start(): void;
726
+ /**
727
+ * Schedule next refresh with jitter and backoff
728
+ */
729
+ private scheduleNextRefresh;
730
+ /**
731
+ * Calculate exponential backoff (capped at maxBackoffSeconds)
732
+ */
733
+ private calculateBackoff;
734
+ /**
735
+ * Stop background heartbeat refresher
736
+ */
737
+ stop(): void;
738
+ /**
739
+ * Get current heartbeat token if valid
740
+ */
741
+ getToken(): string | null;
742
+ /**
743
+ * Check if current heartbeat token is valid
744
+ */
745
+ isValid(): boolean;
746
+ /**
747
+ * Update signer ID (called when signer is known)
748
+ */
749
+ updateSignerId(signerId: string): void;
750
+ /**
751
+ * Acquire a new heartbeat token from Control Plane
752
+ * NEVER logs token value (security)
753
+ */
754
+ private acquireHeartbeat;
755
+ /**
756
+ * Get client instance ID (for tracking)
757
+ */
758
+ getClientInstanceId(): string;
759
+ }
760
+
761
+ export { BlockIntelAuthError, BlockIntelBlockedError, BlockIntelStepUpRequiredError, BlockIntelUnavailableError, type DefenseEvaluateRequestV2, type DefenseEvaluateResponseV2, GateClient, type GateClientConfig, type GateDecision, GateError, GateErrorCode, type GateStepUpStatus, HeartbeatManager, type HeartbeatToken, type Provenance, ProvenanceProvider, type SigningContext, type StepUpFinalResult, type StepUpMetadata, StepUpNotConfiguredError, type StepUpStatusResponse, type TransactionIntentV2, type WrapKmsClientOptions, type WrappedKmsClient, createGateClient, GateClient as default, wrapKmsClient };