blockintel-gate-sdk 0.3.5 → 0.3.6
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 +0 -24
- package/dist/index.cjs +162 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -17
- package/dist/index.d.ts +29 -17
- package/dist/index.js +161 -144
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -252,10 +252,6 @@ interface GateClientConfig {
|
|
|
252
252
|
onMetrics?: (metrics: Metrics) => void | Promise<void>;
|
|
253
253
|
signerId?: string;
|
|
254
254
|
heartbeatRefreshIntervalSeconds?: number;
|
|
255
|
-
/** API key for Control Plane heartbeat endpoint (x-gate-heartbeat-key). Required when not local. Fallback: GATE_HEARTBEAT_KEY env. */
|
|
256
|
-
heartbeatApiKey?: string;
|
|
257
|
-
/** When true or GATE_SDK_DEBUG=1, log sanitized request/response (no secrets, no body values). */
|
|
258
|
-
debug?: boolean;
|
|
259
255
|
/**
|
|
260
256
|
* Break-glass token (optional, for emergency override)
|
|
261
257
|
*
|
|
@@ -511,6 +507,32 @@ declare class GateClient {
|
|
|
511
507
|
*/
|
|
512
508
|
declare function createGateClient(config: GateClientConfig): GateClient;
|
|
513
509
|
|
|
510
|
+
/**
|
|
511
|
+
* Gate - Simplified API for Nexus-style injection
|
|
512
|
+
*
|
|
513
|
+
* Provides a drop-in compatible API for code injected by Nexus:
|
|
514
|
+
* import { Gate } from "blockintel-gate-sdk";
|
|
515
|
+
* const gate = new Gate({ apiKey: process.env.BLOCKINTEL_API_KEY });
|
|
516
|
+
* const tx = await gate.guard(ctx, async () => wallet.sendTransaction({ ... }));
|
|
517
|
+
*
|
|
518
|
+
* In passthrough mode (no baseUrl/tenantId, or Nexus sandbox): executes the callback.
|
|
519
|
+
* For full policy evaluation, use GateClient.evaluate() with tx params before sending.
|
|
520
|
+
*/
|
|
521
|
+
declare class Gate {
|
|
522
|
+
private readonly apiKey?;
|
|
523
|
+
constructor(opts?: {
|
|
524
|
+
apiKey?: string;
|
|
525
|
+
});
|
|
526
|
+
/**
|
|
527
|
+
* Guard a signing operation. In passthrough mode, executes the callback.
|
|
528
|
+
* For full Gate integration, use GateClient with evaluate() before sending.
|
|
529
|
+
*/
|
|
530
|
+
guard<T>(_ctx: {
|
|
531
|
+
requestId: string;
|
|
532
|
+
reason: string;
|
|
533
|
+
}, cb: () => Promise<T>): Promise<T>;
|
|
534
|
+
}
|
|
535
|
+
|
|
514
536
|
/**
|
|
515
537
|
* BlockIntel Gate SDK - Error Types
|
|
516
538
|
*/
|
|
@@ -649,8 +671,6 @@ interface HttpClientConfig {
|
|
|
649
671
|
baseUrl: string;
|
|
650
672
|
timeoutMs?: number;
|
|
651
673
|
userAgent?: string;
|
|
652
|
-
/** When true or GATE_SDK_DEBUG=1, log sanitized request/response (no secrets, no body values). */
|
|
653
|
-
debug?: boolean;
|
|
654
674
|
retryOptions?: {
|
|
655
675
|
maxAttempts?: number;
|
|
656
676
|
baseDelayMs?: number;
|
|
@@ -673,7 +693,6 @@ declare class HttpClient {
|
|
|
673
693
|
private readonly timeoutMs;
|
|
674
694
|
private readonly userAgent;
|
|
675
695
|
private readonly retryOptions;
|
|
676
|
-
private readonly debug;
|
|
677
696
|
constructor(config: HttpClientConfig);
|
|
678
697
|
/**
|
|
679
698
|
* Make an HTTP request with retry and timeout
|
|
@@ -712,7 +731,6 @@ declare class HeartbeatManager {
|
|
|
712
731
|
private readonly baseRefreshIntervalSeconds;
|
|
713
732
|
private readonly clientInstanceId;
|
|
714
733
|
private readonly sdkVersion;
|
|
715
|
-
private readonly apiKey;
|
|
716
734
|
private currentToken;
|
|
717
735
|
private refreshTimer;
|
|
718
736
|
private started;
|
|
@@ -726,16 +744,11 @@ declare class HeartbeatManager {
|
|
|
726
744
|
refreshIntervalSeconds?: number;
|
|
727
745
|
clientInstanceId?: string;
|
|
728
746
|
sdkVersion?: string;
|
|
729
|
-
/** API key for heartbeat endpoint auth (x-gate-heartbeat-key). Required unless local mode. */
|
|
730
|
-
apiKey?: string;
|
|
731
747
|
});
|
|
732
748
|
/**
|
|
733
|
-
* Start background heartbeat refresher
|
|
734
|
-
* Optionally wait for initial token (first evaluate() will otherwise wait up to 2s for token).
|
|
749
|
+
* Start background heartbeat refresher
|
|
735
750
|
*/
|
|
736
|
-
start(
|
|
737
|
-
waitForInitial?: boolean;
|
|
738
|
-
}): void;
|
|
751
|
+
start(): void;
|
|
739
752
|
/**
|
|
740
753
|
* Schedule next refresh with jitter and backoff
|
|
741
754
|
*/
|
|
@@ -763,7 +776,6 @@ declare class HeartbeatManager {
|
|
|
763
776
|
/**
|
|
764
777
|
* Acquire a new heartbeat token from Control Plane
|
|
765
778
|
* NEVER logs token value (security)
|
|
766
|
-
* Requires x-gate-heartbeat-key header (apiKey) for authentication.
|
|
767
779
|
*/
|
|
768
780
|
private acquireHeartbeat;
|
|
769
781
|
/**
|
|
@@ -772,4 +784,4 @@ declare class HeartbeatManager {
|
|
|
772
784
|
getClientInstanceId(): string;
|
|
773
785
|
}
|
|
774
786
|
|
|
775
|
-
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 };
|
|
787
|
+
export { BlockIntelAuthError, BlockIntelBlockedError, BlockIntelStepUpRequiredError, BlockIntelUnavailableError, type DefenseEvaluateRequestV2, type DefenseEvaluateResponseV2, Gate, 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
|
@@ -252,10 +252,6 @@ interface GateClientConfig {
|
|
|
252
252
|
onMetrics?: (metrics: Metrics) => void | Promise<void>;
|
|
253
253
|
signerId?: string;
|
|
254
254
|
heartbeatRefreshIntervalSeconds?: number;
|
|
255
|
-
/** API key for Control Plane heartbeat endpoint (x-gate-heartbeat-key). Required when not local. Fallback: GATE_HEARTBEAT_KEY env. */
|
|
256
|
-
heartbeatApiKey?: string;
|
|
257
|
-
/** When true or GATE_SDK_DEBUG=1, log sanitized request/response (no secrets, no body values). */
|
|
258
|
-
debug?: boolean;
|
|
259
255
|
/**
|
|
260
256
|
* Break-glass token (optional, for emergency override)
|
|
261
257
|
*
|
|
@@ -511,6 +507,32 @@ declare class GateClient {
|
|
|
511
507
|
*/
|
|
512
508
|
declare function createGateClient(config: GateClientConfig): GateClient;
|
|
513
509
|
|
|
510
|
+
/**
|
|
511
|
+
* Gate - Simplified API for Nexus-style injection
|
|
512
|
+
*
|
|
513
|
+
* Provides a drop-in compatible API for code injected by Nexus:
|
|
514
|
+
* import { Gate } from "blockintel-gate-sdk";
|
|
515
|
+
* const gate = new Gate({ apiKey: process.env.BLOCKINTEL_API_KEY });
|
|
516
|
+
* const tx = await gate.guard(ctx, async () => wallet.sendTransaction({ ... }));
|
|
517
|
+
*
|
|
518
|
+
* In passthrough mode (no baseUrl/tenantId, or Nexus sandbox): executes the callback.
|
|
519
|
+
* For full policy evaluation, use GateClient.evaluate() with tx params before sending.
|
|
520
|
+
*/
|
|
521
|
+
declare class Gate {
|
|
522
|
+
private readonly apiKey?;
|
|
523
|
+
constructor(opts?: {
|
|
524
|
+
apiKey?: string;
|
|
525
|
+
});
|
|
526
|
+
/**
|
|
527
|
+
* Guard a signing operation. In passthrough mode, executes the callback.
|
|
528
|
+
* For full Gate integration, use GateClient with evaluate() before sending.
|
|
529
|
+
*/
|
|
530
|
+
guard<T>(_ctx: {
|
|
531
|
+
requestId: string;
|
|
532
|
+
reason: string;
|
|
533
|
+
}, cb: () => Promise<T>): Promise<T>;
|
|
534
|
+
}
|
|
535
|
+
|
|
514
536
|
/**
|
|
515
537
|
* BlockIntel Gate SDK - Error Types
|
|
516
538
|
*/
|
|
@@ -649,8 +671,6 @@ interface HttpClientConfig {
|
|
|
649
671
|
baseUrl: string;
|
|
650
672
|
timeoutMs?: number;
|
|
651
673
|
userAgent?: string;
|
|
652
|
-
/** When true or GATE_SDK_DEBUG=1, log sanitized request/response (no secrets, no body values). */
|
|
653
|
-
debug?: boolean;
|
|
654
674
|
retryOptions?: {
|
|
655
675
|
maxAttempts?: number;
|
|
656
676
|
baseDelayMs?: number;
|
|
@@ -673,7 +693,6 @@ declare class HttpClient {
|
|
|
673
693
|
private readonly timeoutMs;
|
|
674
694
|
private readonly userAgent;
|
|
675
695
|
private readonly retryOptions;
|
|
676
|
-
private readonly debug;
|
|
677
696
|
constructor(config: HttpClientConfig);
|
|
678
697
|
/**
|
|
679
698
|
* Make an HTTP request with retry and timeout
|
|
@@ -712,7 +731,6 @@ declare class HeartbeatManager {
|
|
|
712
731
|
private readonly baseRefreshIntervalSeconds;
|
|
713
732
|
private readonly clientInstanceId;
|
|
714
733
|
private readonly sdkVersion;
|
|
715
|
-
private readonly apiKey;
|
|
716
734
|
private currentToken;
|
|
717
735
|
private refreshTimer;
|
|
718
736
|
private started;
|
|
@@ -726,16 +744,11 @@ declare class HeartbeatManager {
|
|
|
726
744
|
refreshIntervalSeconds?: number;
|
|
727
745
|
clientInstanceId?: string;
|
|
728
746
|
sdkVersion?: string;
|
|
729
|
-
/** API key for heartbeat endpoint auth (x-gate-heartbeat-key). Required unless local mode. */
|
|
730
|
-
apiKey?: string;
|
|
731
747
|
});
|
|
732
748
|
/**
|
|
733
|
-
* Start background heartbeat refresher
|
|
734
|
-
* Optionally wait for initial token (first evaluate() will otherwise wait up to 2s for token).
|
|
749
|
+
* Start background heartbeat refresher
|
|
735
750
|
*/
|
|
736
|
-
start(
|
|
737
|
-
waitForInitial?: boolean;
|
|
738
|
-
}): void;
|
|
751
|
+
start(): void;
|
|
739
752
|
/**
|
|
740
753
|
* Schedule next refresh with jitter and backoff
|
|
741
754
|
*/
|
|
@@ -763,7 +776,6 @@ declare class HeartbeatManager {
|
|
|
763
776
|
/**
|
|
764
777
|
* Acquire a new heartbeat token from Control Plane
|
|
765
778
|
* NEVER logs token value (security)
|
|
766
|
-
* Requires x-gate-heartbeat-key header (apiKey) for authentication.
|
|
767
779
|
*/
|
|
768
780
|
private acquireHeartbeat;
|
|
769
781
|
/**
|
|
@@ -772,4 +784,4 @@ declare class HeartbeatManager {
|
|
|
772
784
|
getClientInstanceId(): string;
|
|
773
785
|
}
|
|
774
786
|
|
|
775
|
-
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 };
|
|
787
|
+
export { BlockIntelAuthError, BlockIntelBlockedError, BlockIntelStepUpRequiredError, BlockIntelUnavailableError, type DefenseEvaluateRequestV2, type DefenseEvaluateResponseV2, Gate, 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 };
|