@oneidentity/safeguard 8.0.1 → 8.0.2

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.
@@ -1,185 +0,0 @@
1
- import { HubConnection } from "@microsoft/signalr";
2
-
3
- //#region src/events/types.d.ts
4
- /**
5
- * Event listener connection states.
6
- */
7
- type EventListenerState = 'starting' | 'connected' | 'disconnected' | 'reconnecting' | 'stopped';
8
- /**
9
- * Handler for Safeguard events (NotifyEventAsync messages from SignalR).
10
- */
11
- type EventHandler = (event: SafeguardEvent) => void;
12
- /**
13
- * Handler for state change notifications.
14
- */
15
- type StateChangeHandler = (state: EventListenerState) => void;
16
- /**
17
- * A Safeguard event as delivered by SignalR.
18
- */
19
- interface SafeguardEvent {
20
- EventName: string;
21
- [key: string]: unknown;
22
- }
23
- /**
24
- * Options for persistent event listeners.
25
- */
26
- interface PersistentListenerOptions {
27
- /** Delay between reconnection attempts in milliseconds. Default: 5000. */
28
- retryIntervalMs?: number;
29
- /** Maximum number of reconnect attempts before giving up. Default: unlimited. */
30
- maxRetries?: number;
31
- }
32
- //# sourceMappingURL=types.d.ts.map
33
- //#endregion
34
- //#region src/events/listener.d.ts
35
- /**
36
- * One-shot event listener wrapping a SignalR HubConnection.
37
- * For persistent auto-reconnect behavior, use PersistentSafeguardEventListener.
38
- */
39
- declare class SafeguardEventListener {
40
- #private;
41
- constructor(connection: HubConnection);
42
- /** Current connection state. */
43
- get state(): EventListenerState;
44
- /**
45
- * Register an event handler for Safeguard notifications.
46
- */
47
- on(_method: 'NotifyEventAsync', handler: EventHandler): this;
48
- /**
49
- * Start the SignalR connection.
50
- */
51
- start(): Promise<void>;
52
- /**
53
- * Stop the SignalR connection.
54
- */
55
- stop(): Promise<void>;
56
- }
57
- //# sourceMappingURL=listener.d.ts.map
58
- //#endregion
59
- //#region src/http/types.d.ts
60
- /**
61
- * Platform-agnostic HTTP client interface for the Safeguard SDK.
62
- */
63
- interface HttpRequestOptions {
64
- url: string;
65
- method: string;
66
- headers?: Record<string, string>;
67
- body?: string | Buffer | null;
68
- signal?: AbortSignal;
69
- timeout?: number;
70
- }
71
- interface HttpResponse {
72
- status: number;
73
- headers: Record<string, string>;
74
- body: string;
75
- }
76
- /**
77
- * Abstract HTTP client interface.
78
- * Implementations: NodeHttpClient (undici), BrowserHttpClient (fetch).
79
- */
80
- interface HttpClient {
81
- request(options: HttpRequestOptions): Promise<HttpResponse>;
82
- dispose?(): void;
83
- }
84
- //# sourceMappingURL=types.d.ts.map
85
- //#endregion
86
- //#region src/storage/types.d.ts
87
- /**
88
- * Interface for token/state storage backends.
89
- */
90
- interface StorageProvider {
91
- get(key: string): string | null;
92
- set(key: string, value: string): void;
93
- remove(key: string): void;
94
- clear(): void;
95
- }
96
- /** Well-known storage keys used by the SDK. */
97
- //#endregion
98
- //#region src/secret.d.ts
99
- /**
100
- * A wrapper that prevents accidental logging of sensitive values.
101
- *
102
- * - `toString()` returns "[REDACTED]"
103
- * - `toJSON()` returns "[REDACTED]"
104
- * - `console.log(secretValue)` prints "[REDACTED]"
105
- * - `.expose()` returns the raw value when intentionally needed
106
- */
107
- declare class SecretValue {
108
- #private;
109
- constructor(value: string);
110
- /** Returns the raw secret. Use only when you intentionally need the plaintext. */
111
- expose(): string;
112
- toString(): string;
113
- toJSON(): string;
114
- get [Symbol.toStringTag](): string;
115
- }
116
- //# sourceMappingURL=secret.d.ts.map
117
- //#endregion
118
- //#region src/auth/types.d.ts
119
- /**
120
- * Token set returned by authentication.
121
- */
122
- interface TokenSet {
123
- /** The Safeguard user access token (wrapped to prevent accidental logging). */
124
- accessToken: SecretValue;
125
- /** Token lifetime in seconds from when it was issued. */
126
- expiresIn?: number;
127
- /** Timestamp (ms since epoch) when the token was acquired. */
128
- acquiredAt: number;
129
- }
130
- /**
131
- * Auth strategy interface. All authentication methods implement this.
132
- */
133
- interface Auth {
134
- /**
135
- * Authenticate against the Safeguard RSTS and return a token set.
136
- * @param host - Appliance hostname
137
- * @param httpClient - HTTP client to use for requests
138
- * @param storage - Storage provider for persisting tokens/state
139
- */
140
- authenticate(host: string, httpClient: HttpClient, storage: StorageProvider): Promise<TokenSet>;
141
- /**
142
- * Refresh the token if possible. Returns new token set or null if refresh not supported.
143
- */
144
- refreshToken?(host: string, httpClient: HttpClient, storage: StorageProvider): Promise<TokenSet | null>;
145
- /** Human-readable description of this auth strategy (for logging). */
146
- readonly description: string;
147
- }
148
- //# sourceMappingURL=types.d.ts.map
149
- //#endregion
150
- //#region src/events/persistent.d.ts
151
- /**
152
- * Persistent event listener with automatic reconnection and token refresh.
153
- *
154
- * Wraps SignalR's built-in `withAutomaticReconnect()` AND adds:
155
- * - Token refresh on reconnect (re-authenticates if needed)
156
- * - State change event notifications
157
- * - Manual `stop()` that prevents further auto-reconnect
158
- */
159
- declare class PersistentSafeguardEventListener {
160
- #private;
161
- constructor(connection: HubConnection, auth: Auth, host: string, httpClient: HttpClient, storage: StorageProvider, options?: PersistentListenerOptions, tokenSet?: TokenSet);
162
- /** Current connection state. */
163
- get state(): EventListenerState;
164
- /**
165
- * Register an event handler for Safeguard notifications.
166
- */
167
- on(_method: 'NotifyEventAsync', handler: EventHandler): this;
168
- /**
169
- * Register a state change handler.
170
- */
171
- onStateChange(handler: StateChangeHandler): this;
172
- /**
173
- * Start the persistent connection.
174
- */
175
- start(): Promise<void>;
176
- /**
177
- * Stop the connection. Prevents auto-reconnect.
178
- */
179
- stop(): Promise<void>;
180
- }
181
- //# sourceMappingURL=persistent.d.ts.map
182
-
183
- //#endregion
184
- export { type EventHandler, type EventListenerState, type PersistentListenerOptions, PersistentSafeguardEventListener, type SafeguardEvent, SafeguardEventListener, type StateChangeHandler };
185
- //# sourceMappingURL=events-zHsrmRBj.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"events-zHsrmRBj.d.cts","names":[],"sources":["../src/events/types.ts","../src/events/listener.ts","../src/http/types.ts","../src/storage/types.ts","../src/secret.ts","../src/auth/types.ts","../src/events/persistent.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