@ondewo/sip-client-angular 5.4.2 → 5.4.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/index.d.ts CHANGED
@@ -1,16 +1,11 @@
1
- import * as i0 from '@angular/core';
2
- import { InjectionToken } from '@angular/core';
3
- import { GrpcMessage, RecursivePartial, ToProtobufJSONOptions, GrpcMetadata, GrpcEvent, GrpcClientFactory } from '@ngx-grpc/common';
1
+ import { GrpcMessage, RecursivePartial, ToProtobufJSONOptions, GrpcMetadata, GrpcEvent, GrpcClientFactory, GrpcRequest } from '@ngx-grpc/common';
4
2
  import { ByteSource, BinaryReader, BinaryWriter } from 'google-protobuf';
5
3
  import * as googleProtobuf000 from '@ngx-grpc/well-known-types';
6
- import { GrpcHandler } from '@ngx-grpc/core';
4
+ import * as i0 from '@angular/core';
5
+ import { InjectionToken, OnDestroy, NgZone, EnvironmentProviders, Type } from '@angular/core';
6
+ import { GrpcHandler, GrpcInterceptor } from '@ngx-grpc/core';
7
7
  import { Observable } from 'rxjs';
8
-
9
- /**
10
- * Specific GrpcClientSettings for Sip.
11
- * Use it only if your default settings are not set or the service requires other settings.
12
- */
13
- declare const GRPC_SIP_CLIENT_SETTINGS: InjectionToken<any>;
8
+ import { HttpRequest, HttpHandlerFn, HttpEvent, HttpClient } from '@angular/common/http';
14
9
 
15
10
  /**
16
11
  * Message implementation for ondewo.sip.SipEndCallRequest
@@ -910,6 +905,12 @@ declare namespace SipPlayWavFilesRequest {
910
905
  }
911
906
  }
912
907
 
908
+ /**
909
+ * Specific GrpcClientSettings for Sip.
910
+ * Use it only if your default settings are not set or the service requires other settings.
911
+ */
912
+ declare const GRPC_SIP_CLIENT_SETTINGS: InjectionToken<any>;
913
+
913
914
  /**
914
915
  * Service client implementation for ondewo.sip.Sip
915
916
  */
@@ -1104,4 +1105,484 @@ declare class SipClient {
1104
1105
  static ɵprov: i0.ɵɵInjectableDeclaration<SipClient>;
1105
1106
  }
1106
1107
 
1107
- export { GRPC_SIP_CLIENT_SETTINGS, SipClient, SipEndCallRequest, SipPlayWavFilesRequest, SipRegisterAccountRequest, SipStartCallRequest, SipStartSessionRequest, SipStatus, SipStatusHistoryResponse, SipTransferCallRequest };
1108
+ /**
1109
+ * The set of shapes a {@link TokenProvider} is allowed to return for the current
1110
+ * access token.
1111
+ *
1112
+ * - `string` — a ready, synchronous token.
1113
+ * - `null` — there is no token right now (the user is unauthenticated). The
1114
+ * request must be sent unchanged, never with an empty `Bearer` header.
1115
+ * - `Promise<...>` / `Observable<...>` — an asynchronous source (e.g.
1116
+ * `keycloak.updateToken()` from `keycloak-js`, or `KeycloakService` from
1117
+ * `keycloak-angular`) that resolves to a token or `null`.
1118
+ */
1119
+ type TokenResult = string | null | Promise<string | null> | Observable<string | null>;
1120
+ /**
1121
+ * Contract the consuming application implements to feed the current Keycloak
1122
+ * access token into this library's auth interceptors.
1123
+ *
1124
+ * SECURITY: this client deliberately does NOT perform any OAuth/OIDC flow
1125
+ * itself — no Resource Owner Password Credentials grant, no client secret, no
1126
+ * token storage. Acquiring, refreshing and storing the token is the
1127
+ * responsibility of a dedicated, browser-safe library (`keycloak-js` /
1128
+ * `keycloak-angular`) in the host application. This client only reads the
1129
+ * current token and attaches it as a bearer credential to outgoing requests.
1130
+ *
1131
+ * Implementations should return the freshest token they have. Returning a
1132
+ * `Promise`/`Observable` lets the implementation refresh a soon-to-expire token
1133
+ * before the request is sent (e.g. `keycloak.updateToken(30)`).
1134
+ */
1135
+ interface TokenProvider {
1136
+ /**
1137
+ * Return the current access token, or `null` when the user is not
1138
+ * authenticated. May be synchronous or asynchronous.
1139
+ */
1140
+ getToken(): TokenResult;
1141
+ }
1142
+ /**
1143
+ * DI token under which the consuming application registers its
1144
+ * {@link TokenProvider} implementation.
1145
+ *
1146
+ * Example:
1147
+ *
1148
+ * ```ts
1149
+ * providers: [
1150
+ * { provide: TOKEN_PROVIDER, useExisting: KeycloakTokenProvider },
1151
+ * ]
1152
+ * ```
1153
+ */
1154
+ declare const TOKEN_PROVIDER: InjectionToken<TokenProvider>;
1155
+
1156
+ /**
1157
+ * The HTTP / gRPC header under which the bearer credential is attached.
1158
+ *
1159
+ * Canonical `Authorization` casing: gRPC-web metadata keys are case-insensitive
1160
+ * and the HTTP/2 transport lower-cases header names on the wire, but the ONDEWO
1161
+ * SDKs standardize on the capitalized `Authorization` key in source.
1162
+ */
1163
+ declare const AUTHORIZATION_HEADER: string;
1164
+ /** The credential scheme prefix prepended to the raw access token. */
1165
+ declare const BEARER_PREFIX: string;
1166
+ /**
1167
+ * Normalize the value returned by a `TokenProvider.getToken()` call — which may
1168
+ * be a `string`, `null`, a `Promise` or an `Observable` — into a single
1169
+ * `Observable<string | null>` that emits exactly once.
1170
+ *
1171
+ * A non-empty token is returned trimmed; `null`, `undefined`, an empty string
1172
+ * and a whitespace-only string are all collapsed to `null` so callers have a
1173
+ * single "no usable token" signal and never build an empty `Bearer` header.
1174
+ *
1175
+ * @param result the raw value returned by `TokenProvider.getToken()`.
1176
+ * @returns an observable emitting the usable token, or `null` when absent.
1177
+ */
1178
+ declare function resolveToken(result: TokenResult): Observable<string | null>;
1179
+ /**
1180
+ * Build the `Authorization` header value for a resolved token, or `null` when
1181
+ * the token is absent.
1182
+ *
1183
+ * @param token a usable token, or `null`.
1184
+ * @returns the `"Bearer <token>"` string, or `null` when there is no token.
1185
+ */
1186
+ declare function buildBearerValue(token: string | null): string | null;
1187
+ /**
1188
+ * Convenience wrapper: emit the ready-to-use `Authorization` header value, or
1189
+ * `null` when no token is available.
1190
+ *
1191
+ * @param result the raw value returned by `TokenProvider.getToken()`.
1192
+ * @returns an observable emitting the bearer header value, or `null`.
1193
+ */
1194
+ declare function resolveBearerValue(result: TokenResult): Observable<string | null>;
1195
+
1196
+ /**
1197
+ * Functional Angular `HttpInterceptor` that attaches the current Keycloak access
1198
+ * token as an `Authorization: Bearer <token>` header to outgoing HTTP requests.
1199
+ *
1200
+ * Behaviour:
1201
+ * - token present → a cloned request carrying the bearer header is forwarded.
1202
+ * - token absent / empty → the original request is forwarded untouched (no empty
1203
+ * `Bearer` header is ever sent).
1204
+ * - token source is async (Promise/Observable) → resolved before the request is
1205
+ * sent.
1206
+ * - an existing `Authorization` header on the request is left untouched, so a
1207
+ * caller that already set credentials explicitly wins.
1208
+ *
1209
+ * Register it in the application's HTTP pipeline:
1210
+ *
1211
+ * ```ts
1212
+ * provideHttpClient(withInterceptors([authHttpInterceptor]))
1213
+ * ```
1214
+ *
1215
+ * Errors raised by the `TokenProvider` propagate to the caller (the request is
1216
+ * not sent) so an authentication failure surfaces rather than silently issuing
1217
+ * an unauthenticated request.
1218
+ *
1219
+ * @param req the outgoing HTTP request.
1220
+ * @param next the next handler in the interceptor chain.
1221
+ * @returns the stream of HTTP events for the (possibly authorized) request.
1222
+ */
1223
+ declare function authHttpInterceptor(req: HttpRequest<unknown>, next: HttpHandlerFn): Observable<HttpEvent<unknown>>;
1224
+
1225
+ /**
1226
+ * `@ngx-grpc` interceptor that attaches the current Keycloak access token as an
1227
+ * `authorization: Bearer <token>` entry on the gRPC-web request metadata. This
1228
+ * is the gRPC-web counterpart of {@link authHttpInterceptor} and matches the
1229
+ * `@ngx-grpc` client style used by the generated `SipClient` service client
1230
+ * (`api/ondewo/sip/sip.pbsc.ts`) in this library.
1231
+ *
1232
+ * Behaviour mirrors the HTTP interceptor:
1233
+ * - token present → the bearer credential is set on `requestMetadata`.
1234
+ * - token absent / empty → the request metadata is left untouched (no empty
1235
+ * `Bearer` value is ever attached).
1236
+ * - token source is async (Promise/Observable) → resolved before the request is
1237
+ * handed to the next handler.
1238
+ * - an `authorization` entry already present on the request metadata is left
1239
+ * untouched, so an explicitly-set credential wins.
1240
+ *
1241
+ * Register it via the standard `@ngx-grpc` multi-provider:
1242
+ *
1243
+ * ```ts
1244
+ * providers: [
1245
+ * { provide: GRPC_INTERCEPTORS, useClass: AuthGrpcInterceptor, multi: true },
1246
+ * ]
1247
+ * ```
1248
+ */
1249
+ declare class AuthGrpcInterceptor implements GrpcInterceptor {
1250
+ private readonly tokenProvider;
1251
+ /**
1252
+ * @param tokenProvider the application-supplied {@link TokenProvider}, injected
1253
+ * under the {@link TOKEN_PROVIDER} DI token, that yields the current access
1254
+ * token.
1255
+ */
1256
+ constructor(tokenProvider: TokenProvider);
1257
+ /**
1258
+ * Attach the bearer credential (when available) to the request metadata, then
1259
+ * delegate to the next handler in the chain.
1260
+ *
1261
+ * @param request the intercepted gRPC request.
1262
+ * @param next the next handler to pass the request through.
1263
+ * @returns the stream of gRPC events for the (possibly authorized) request.
1264
+ */
1265
+ intercept<Q extends GrpcMessage, S extends GrpcMessage>(request: GrpcRequest<Q, S>, next: GrpcHandler): Observable<GrpcEvent<S>>;
1266
+ static ɵfac: i0.ɵɵFactoryDeclaration<AuthGrpcInterceptor, never>;
1267
+ static ɵprov: i0.ɵɵInjectableDeclaration<AuthGrpcInterceptor>;
1268
+ }
1269
+
1270
+ /**
1271
+ * Seconds of head-room subtracted from a token's `expires_in` so the background
1272
+ * refresh fires *before* the access token actually lapses (covers clock skew and
1273
+ * the round-trip to Keycloak). Mirrors the nodejs `REFRESH_SKEW_IN_S` and the
1274
+ * python `_EXPIRY_LEEWAY_S` references.
1275
+ */
1276
+ declare const REFRESH_SKEW_IN_S: number;
1277
+ /**
1278
+ * Lower bound (in seconds) on the scheduled refresh delay, so a tiny or zero
1279
+ * `expires_in` cannot spin a hot refresh loop.
1280
+ */
1281
+ declare const MIN_REFRESH_DELAY_IN_S: number;
1282
+ /**
1283
+ * Configuration the consuming application supplies to {@link KeycloakTokenProvider}.
1284
+ *
1285
+ * Provide either a long-lived offline / refresh token (`refreshToken`) — the
1286
+ * preferred headless-SDK shape, no password kept in memory — or a
1287
+ * `username` + `password` pair for a one-time Resource Owner Password Credentials
1288
+ * (ROPC) login with `scope=offline_access`. Exactly one of the two must be given.
1289
+ */
1290
+ interface KeycloakTokenProviderConfig {
1291
+ /**
1292
+ * Base Keycloak URL, e.g. `https://auth.example.com/auth` (a trailing slash and
1293
+ * a baked-in `/auth` path are both tolerated).
1294
+ */
1295
+ readonly keycloakUrl: string;
1296
+ /** Realm name, e.g. `ondewo-ccai-platform`. */
1297
+ readonly realm: string;
1298
+ /**
1299
+ * Public SDK client id, e.g. `ondewo-nlu-cai-sdk-public`. No `client_secret` is
1300
+ * ever sent (the SDK client is public).
1301
+ */
1302
+ readonly clientId: string;
1303
+ /**
1304
+ * A long-lived offline / refresh token used to mint access tokens directly
1305
+ * (`grant_type=refresh_token`). Mutually exclusive with `username`/`password`.
1306
+ */
1307
+ readonly refreshToken?: string;
1308
+ /**
1309
+ * Technical-user email/username for a one-time ROPC login. Requires `password`.
1310
+ * Mutually exclusive with `refreshToken`.
1311
+ */
1312
+ readonly username?: string;
1313
+ /** Technical-user password for the ROPC login. Requires `username`. */
1314
+ readonly password?: string;
1315
+ /**
1316
+ * Optional cap (in seconds since login) on how long the background refresh loop
1317
+ * runs. Once it elapses the loop stops and the access token is allowed to lapse
1318
+ * (re-login required). Omit to keep refreshing until the offline session itself
1319
+ * expires.
1320
+ */
1321
+ readonly tokenExpirationInS?: number;
1322
+ /**
1323
+ * Whether to verify the Keycloak server's TLS certificate on the
1324
+ * token-endpoint call. Defaults to `true` (secure).
1325
+ *
1326
+ * NO-OP IN THIS ANGULAR/BROWSER CLIENT. The token request is made with
1327
+ * Angular's `HttpClient` (an XHR/fetch call), and in a browser the TLS
1328
+ * handshake is owned by the user agent — there is no `https.Agent`, undici
1329
+ * dispatcher, or `rejectUnauthorized` hook that app code can reach, and
1330
+ * `HttpClient`'s request options expose no certificate-verification slot. The
1331
+ * value is therefore stored on the provider for cross-SDK config parity with
1332
+ * the Python/Node.js clients (where it does disable TLS verification) but has
1333
+ * no effect on the outgoing request here. For a self-signed local Envoy, the
1334
+ * certificate must be trusted at the browser/OS level instead.
1335
+ */
1336
+ readonly keycloakVerifySsl?: boolean;
1337
+ }
1338
+ /**
1339
+ * DI token under which {@link KeycloakTokenProvider} reads its
1340
+ * {@link KeycloakTokenProviderConfig}. The consuming application provides a value
1341
+ * for it (see {@link provideKeycloakTokenProvider}).
1342
+ */
1343
+ declare const KEYCLOAK_TOKEN_PROVIDER_CONFIG: InjectionToken<KeycloakTokenProviderConfig>;
1344
+ /** Error raised on a missing/invalid configuration or any token-endpoint failure. */
1345
+ declare class KeycloakAuthenticationError extends Error {
1346
+ /**
1347
+ * @param message a human-readable description of the configuration or token failure.
1348
+ */
1349
+ constructor(message: string);
1350
+ }
1351
+ /**
1352
+ * Concrete, ready-to-use {@link TokenProvider} that performs the Keycloak headless
1353
+ * offline-token flow itself, so consumers get background access-token refresh
1354
+ * without implementing {@link TokenProvider}.
1355
+ *
1356
+ * On the first {@link getToken} call it logs in once against the Keycloak token
1357
+ * endpoint — either with a supplied offline / refresh token
1358
+ * (`grant_type=refresh_token`) or with a `username` + `password` ROPC grant
1359
+ * (`grant_type=password`, `scope=offline_access`) — then keeps the access token
1360
+ * fresh via a background timer that refreshes shortly *before* expiry (clamped to
1361
+ * an optional bounded deadline, mirroring the nodejs `OfflineTokenProvider` and
1362
+ * python `KeycloakTokenProvider` references). {@link getToken} returns the current
1363
+ * valid access token; the library's interceptors attach it as
1364
+ * `Authorization: Bearer <token>`.
1365
+ *
1366
+ * Register it with {@link provideKeycloakTokenProvider}, then point the SDK auth at
1367
+ * it:
1368
+ *
1369
+ * ```ts
1370
+ * bootstrapApplication(AppComponent, {
1371
+ * providers: [
1372
+ * provideHttpClient(),
1373
+ * provideKeycloakTokenProvider({
1374
+ * keycloakUrl: "https://auth.example.com/auth",
1375
+ * realm: "ondewo-ccai-platform",
1376
+ * clientId: "ondewo-nlu-cai-sdk-public",
1377
+ * refreshToken: "<offline-token>",
1378
+ * }),
1379
+ * provideOndewoSipAuth(KeycloakTokenProvider),
1380
+ * provideHttpClient(withInterceptors([authHttpInterceptor])),
1381
+ * ],
1382
+ * });
1383
+ * ```
1384
+ */
1385
+ declare class KeycloakTokenProvider implements TokenProvider, OnDestroy {
1386
+ private readonly http;
1387
+ private readonly zone;
1388
+ /** Pre-computed OIDC token endpoint URL for the configured realm. */
1389
+ private readonly tokenEndpoint;
1390
+ /** Public SDK client id sent on every token request (no `client_secret`). */
1391
+ private readonly clientId;
1392
+ /** Optional cap (seconds) after which the refresh loop stops; `undefined` means unbounded. */
1393
+ private readonly tokenExpirationInS;
1394
+ /**
1395
+ * Whether TLS-certificate verification is requested for the token-endpoint
1396
+ * call. Defaults to `true`. Stored for cross-SDK config parity only — it is a
1397
+ * NO-OP in this browser client (the browser owns the TLS handshake), so the
1398
+ * outgoing {@link postTokenRequest} call is unaffected by its value. See
1399
+ * {@link KeycloakTokenProviderConfig.keycloakVerifySsl}.
1400
+ */
1401
+ private readonly verifySsl;
1402
+ /** The grant parameters for the one-time login, derived from the config. */
1403
+ private readonly loginRequest;
1404
+ /** The current access token, or `null` before the first login / after the bounded loop lapses. */
1405
+ private accessToken;
1406
+ /** The current refresh token, or `null` before any login completes. */
1407
+ private refreshToken;
1408
+ /** Handle of the armed refresh timer, or `null` when no refresh is scheduled. */
1409
+ private timer;
1410
+ /** Whether {@link ngOnDestroy} has run; suppresses any further (re-)scheduling. */
1411
+ private stopped;
1412
+ /** Absolute epoch-ms deadline for the bounded loop, or `null` when unbounded. */
1413
+ private deadlineInMs;
1414
+ /** The in-flight (or settled) one-time login promise; ensures login happens exactly once. */
1415
+ private loginPromise;
1416
+ /**
1417
+ * @param http the Angular {@link HttpClient} used for the token-endpoint calls.
1418
+ * @param zone the {@link NgZone}; the background timer is armed outside Angular so it
1419
+ * does not keep change detection / zone stability churning between refreshes.
1420
+ * @param config the {@link KeycloakTokenProviderConfig}, injected under
1421
+ * {@link KEYCLOAK_TOKEN_PROVIDER_CONFIG}.
1422
+ */
1423
+ constructor(http: HttpClient, zone: NgZone, config: KeycloakTokenProviderConfig | null);
1424
+ /**
1425
+ * Return the current access token, logging in on the first call.
1426
+ *
1427
+ * The first invocation returns a `Promise` that resolves once the one-time login
1428
+ * has completed and the background refresh is armed. Subsequent invocations
1429
+ * return the synchronously-held current access token (or `null` if the bounded
1430
+ * loop has lapsed), so interceptors pay no async cost on the hot path.
1431
+ *
1432
+ * @returns the current access token as a {@link TokenResult}.
1433
+ */
1434
+ getToken(): TokenResult;
1435
+ /**
1436
+ * The resolved TLS-verification setting from
1437
+ * {@link KeycloakTokenProviderConfig.keycloakVerifySsl} (defaults to `true`).
1438
+ *
1439
+ * Exposed for cross-SDK config parity and introspection only. It is a NO-OP in
1440
+ * this browser client — the browser owns the TLS handshake, so the value never
1441
+ * reaches {@link postTokenRequest} and does not change the outgoing request.
1442
+ *
1443
+ * @returns `true` when TLS verification is requested (the default), `false`
1444
+ * when the config explicitly opted out (still inert here).
1445
+ */
1446
+ get keycloakVerifySsl(): boolean;
1447
+ /** Stop the background refresh loop when the provider is torn down. Idempotent. */
1448
+ ngOnDestroy(): void;
1449
+ /**
1450
+ * Perform the one-time login (offline-token or ROPC) and arm the first refresh.
1451
+ *
1452
+ * @returns a promise that resolves once the first token is stored and the refresh is armed.
1453
+ * @throws {@link KeycloakAuthenticationError} if the token endpoint fails or returns no
1454
+ * `access_token` / `refresh_token`.
1455
+ */
1456
+ private bootstrap;
1457
+ /**
1458
+ * Exchange the refresh token for a fresh access token and re-arm the next refresh.
1459
+ *
1460
+ * Stops the loop (instead of refreshing) once the bounded deadline has elapsed,
1461
+ * letting the access token lapse. If the provider was torn down while this refresh's
1462
+ * request was in flight, {@link scheduleRefresh} declines to arm the next timer.
1463
+ *
1464
+ * @returns a promise that resolves once the token is refreshed and the next refresh is armed.
1465
+ * @throws {@link KeycloakAuthenticationError} if the refresh call fails or returns no `access_token`.
1466
+ */
1467
+ private refresh;
1468
+ /**
1469
+ * Arm a single timer for the next refresh, clamped to the bounded deadline.
1470
+ *
1471
+ * The delay is `expiresInRaw` minus {@link REFRESH_SKEW_IN_S}, floored at
1472
+ * {@link MIN_REFRESH_DELAY_IN_S}, then clamped to the time remaining before the
1473
+ * deadline. Stops silently once `tokenExpirationInS` has elapsed.
1474
+ *
1475
+ * @param expiresInRaw the `expires_in` (seconds) from the latest token response; a missing
1476
+ * or non-positive value falls back to {@link MIN_REFRESH_DELAY_IN_S}.
1477
+ */
1478
+ private scheduleRefresh;
1479
+ /**
1480
+ * POST a form-encoded body to the token endpoint and return the parsed JSON.
1481
+ *
1482
+ * @param params the form fields to URL-encode (grant type, client id, credentials).
1483
+ * @returns the parsed {@link KeycloakTokenResponse}.
1484
+ * @throws {@link KeycloakAuthenticationError} on a transport error.
1485
+ */
1486
+ private postTokenRequest;
1487
+ /**
1488
+ * Store the access token (and any rotated refresh token) from a token response.
1489
+ *
1490
+ * Keycloak may omit the refresh token on a same-token refresh; the previous one is
1491
+ * kept in that case so it is never blanked out.
1492
+ *
1493
+ * @param response the parsed token-endpoint response.
1494
+ * @throws {@link KeycloakAuthenticationError} if the response carries no `access_token`.
1495
+ */
1496
+ private storeTokens;
1497
+ /**
1498
+ * Validate the config and build the one-time login grant parameters in a single pass.
1499
+ *
1500
+ * Validating and building together lets the credential checks narrow the optional
1501
+ * `username` / `password` fields to `string` for the request shape, so no type
1502
+ * assertion or unreachable guard is needed.
1503
+ *
1504
+ * @param config the {@link KeycloakTokenProviderConfig} to validate.
1505
+ * @returns the form parameters for the offline-token (`grant_type=refresh_token`) or
1506
+ * ROPC (`grant_type=password`) login.
1507
+ * @throws {@link KeycloakAuthenticationError} on a missing base field or an invalid
1508
+ * credential combination (neither, or both, credential shapes supplied).
1509
+ */
1510
+ private validateAndBuildLoginRequest;
1511
+ /**
1512
+ * Build the OIDC token endpoint URL for a realm, tolerating a trailing slash.
1513
+ *
1514
+ * @param keycloakUrl the base Keycloak URL (trailing slashes are stripped).
1515
+ * @param realm the realm name; URL-encoded into the path.
1516
+ * @returns the fully-qualified `.../protocol/openid-connect/token` endpoint URL.
1517
+ */
1518
+ private static buildTokenEndpoint;
1519
+ /**
1520
+ * Render an arbitrary thrown value into a short message for error wrapping.
1521
+ *
1522
+ * @param caughtError the value thrown by the failing token call.
1523
+ * @returns the error's `message` when it is an `Error`, otherwise its string form.
1524
+ */
1525
+ private static describeError;
1526
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakTokenProvider, [null, null, { optional: true; }]>;
1527
+ static ɵprov: i0.ɵɵInjectableDeclaration<KeycloakTokenProvider>;
1528
+ }
1529
+
1530
+ /**
1531
+ * Wire a consuming application's {@link TokenProvider} implementation into this
1532
+ * library and register the `@ngx-grpc` {@link AuthGrpcInterceptor} that uses it.
1533
+ *
1534
+ * This covers the gRPC-web side. For HTTP requests, additionally register the
1535
+ * functional `authHttpInterceptor`:
1536
+ *
1537
+ * ```ts
1538
+ * provideHttpClient(withInterceptors([authHttpInterceptor]))
1539
+ * ```
1540
+ *
1541
+ * Usage in an application's `providers` (standalone bootstrap or `AppModule`):
1542
+ *
1543
+ * ```ts
1544
+ * import { provideOndewoSipAuth } from "@ondewo/sip-client-angular";
1545
+ *
1546
+ * bootstrapApplication(AppComponent, {
1547
+ * providers: [
1548
+ * provideOndewoSipAuth(KeycloakTokenProvider),
1549
+ * provideHttpClient(withInterceptors([authHttpInterceptor])),
1550
+ * ],
1551
+ * });
1552
+ * ```
1553
+ *
1554
+ * @param tokenProvider the application's `TokenProvider` class (e.g. one that
1555
+ * wraps `keycloak-js` / `keycloak-angular`).
1556
+ * @returns environment providers binding the token provider and the gRPC
1557
+ * interceptor.
1558
+ */
1559
+ declare function provideOndewoSipAuth(tokenProvider: Type<TokenProvider>): EnvironmentProviders;
1560
+ /**
1561
+ * Register the configuration the built-in `KeycloakTokenProvider` reads.
1562
+ *
1563
+ * Pair it with `provideOndewoSipAuth(KeycloakTokenProvider)` (and `provideHttpClient()`)
1564
+ * so consumers get background access-token refresh without implementing
1565
+ * {@link TokenProvider} themselves:
1566
+ *
1567
+ * ```ts
1568
+ * bootstrapApplication(AppComponent, {
1569
+ * providers: [
1570
+ * provideHttpClient(withInterceptors([authHttpInterceptor])),
1571
+ * provideKeycloakTokenProvider({
1572
+ * keycloakUrl: "https://auth.example.com/auth",
1573
+ * realm: "ondewo-ccai-platform",
1574
+ * clientId: "ondewo-nlu-cai-sdk-public",
1575
+ * refreshToken: "<offline-token>",
1576
+ * }),
1577
+ * provideOndewoSipAuth(KeycloakTokenProvider),
1578
+ * ],
1579
+ * });
1580
+ * ```
1581
+ *
1582
+ * @param config the {@link KeycloakTokenProviderConfig} the provider logs in with.
1583
+ * @returns environment providers binding the config under {@link KEYCLOAK_TOKEN_PROVIDER_CONFIG}.
1584
+ */
1585
+ declare function provideKeycloakTokenProvider(config: KeycloakTokenProviderConfig): EnvironmentProviders;
1586
+
1587
+ export { AUTHORIZATION_HEADER, AuthGrpcInterceptor, BEARER_PREFIX, GRPC_SIP_CLIENT_SETTINGS, KEYCLOAK_TOKEN_PROVIDER_CONFIG, KeycloakAuthenticationError, KeycloakTokenProvider, MIN_REFRESH_DELAY_IN_S, REFRESH_SKEW_IN_S, SipClient, SipEndCallRequest, SipPlayWavFilesRequest, SipRegisterAccountRequest, SipStartCallRequest, SipStartSessionRequest, SipStatus, SipStatusHistoryResponse, SipTransferCallRequest, TOKEN_PROVIDER, authHttpInterceptor, buildBearerValue, provideKeycloakTokenProvider, provideOndewoSipAuth, resolveBearerValue, resolveToken };
1588
+ export type { KeycloakTokenProviderConfig, TokenProvider, TokenResult };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ondewo/sip-client-angular",
3
- "version": "5.4.2",
3
+ "version": "5.4.3",
4
4
  "description": "ONDEWO Session Initiation Protocol (SIP) Client library for Angular",
5
5
  "author": "ONDEWO GmbH <office@ondewo.com>",
6
6
  "homepage": "https://ondewo.com",