import { CommonClientOptions } from '@azure/core-client'; import { CommunicationUserIdentifier } from '@azure/communication-common'; import { KeyCredential } from '@azure/core-auth'; import { OperationOptions } from '@azure/core-client'; import { TokenCredential } from '@azure/core-auth'; /** * The access token for a user. */ export declare interface CommunicationAccessToken { /** * The access token issued for the user. */ token: string; /** * The expiry time of the token. */ expiresOn: Date; } /** * Client class for interacting with Azure Communication Services User Token Management. */ export declare class CommunicationIdentityClient { /** * A reference to the auto-generated UserToken HTTP client. */ private readonly client; /** * Initializes a new instance of the CommunicationIdentity class. * @param connectionString - Connection string to connect to an Azure Communication Service resource. * Example: "endpoint=https://contoso.eastus.communications.azure.net/;accesskey=secret"; * @param options - Optional. Options to configure the HTTP pipeline. */ constructor(connectionString: string, options?: CommunicationIdentityClientOptions); /** * Initializes a new instance of the CommunicationIdentity class using an Azure KeyCredential. * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net). * @param credential - An object that is used to authenticate requests to the service. Use the AzureKeyCredential or `@azure/identity` to create a credential. * @param options - Optional. Options to configure the HTTP pipeline. */ constructor(endpoint: string, credential: KeyCredential, options?: CommunicationIdentityClientOptions); /** * Initializes a new instance of the CommunicationIdentity class using a TokenCredential. * @param endpoint - The endpoint of the service (ex: https://contoso.eastus.communications.azure.net) * @param credential - TokenCredential that is used to authenticate requests to the service. * @param options - Optional. Options to configure the HTTP pipeline. */ constructor(endpoint: string, credential: TokenCredential, options?: CommunicationIdentityClientOptions); /** * Creates a scoped user token. * * @param user - The user whose tokens are being issued. * @param scopes - Scopes to include in the token. * @param options - Additional options for the request. */ getToken(user: CommunicationUserIdentifier, scopes: TokenScope[], options?: GetTokenOptions): Promise; /** * Revokes all data and tokens created for a user. * * @param user - The user whose tokens are being revoked. * @param options - Additional options for the request. */ revokeTokens(user: CommunicationUserIdentifier, options?: OperationOptions): Promise; /** * Creates a single user. * * @param options - Additional options for the request. */ createUser(options?: OperationOptions): Promise; /** * Creates a single user and a token simultaneously. * * @param scopes - Scopes to include in the token. * @param options - Additional options for the request. */ createUserAndToken(scopes: TokenScope[], options?: CreateUserAndTokenOptions): Promise; /** * Triggers revocation event for user and deletes all its data. * * @param user - The user being deleted. * @param options - Additional options for the request. */ deleteUser(user: CommunicationUserIdentifier, options?: OperationOptions): Promise; /** * Exchanges an Azure AD access token of a Teams user for a new Communication Identity access token with a matching expiration time. * * @param options - Options used to exchange an Azure AD access token of a Teams user for a new Communication Identity access token. */ getTokenForTeamsUser(options: GetTokenForTeamsUserOptions): Promise; } /** * Client options used to configure the CommunicationIdentity API requests. */ export declare interface CommunicationIdentityClientOptions extends CommonClientOptions { } /** * The issued token and the user it was issued for. */ export declare interface CommunicationUserToken extends CommunicationAccessToken { /** * Represents the user the token was issued for */ user: CommunicationUserIdentifier; } /** * Options to create a single user and a token simultaneously. */ export declare interface CreateUserAndTokenOptions extends OperationOptions { /** Optional custom validity period of the token within [60,1440] minutes range. If not provided, the default value of 1440 minutes (24 hours) will be used. */ tokenExpiresInMinutes?: number; } /** * Options used to exchange an AAD access token of a Teams user for a new Communication Identity access token. */ export declare interface GetTokenForTeamsUserOptions extends OperationOptions { /** * Azure Active Directory access token of a Teams user. */ teamsUserAadToken: string; /** * Client ID of an Azure AD application to be verified against the appId claim in the Azure AD access token. */ clientId: string; /** * Object ID of an Azure AD user (Teams User) to be verified against the OID claim in the Azure AD access token. */ userObjectId: string; } /** * Options to create a scoped user token. */ export declare interface GetTokenOptions extends OperationOptions { /** Optional custom validity period of the token within [60,1440] minutes range. If not provided, the default value of 1440 minutes (24 hours) will be used. */ tokenExpiresInMinutes?: number; } /** * Represents the scope of the token. */ export declare type TokenScope = "chat" | "voip" | "chat.join" | "chat.join.limited" | "voip.join"; export { }