import type { DataServiceCacheUpdatedEvent, DataServiceGranularCacheUpdatedEvent, DataServiceInvalidateQueriesAction } from "@metamask/base-data-service"; import { BaseDataService } from "@metamask/base-data-service"; import type { CreateServicePolicyOptions } from "@metamask/controller-utils"; import type { Messenger } from "@metamask/messenger"; import type { AuthenticatedUserStorageServiceMethodActions } from "./authenticated-user-storage-method-action-types.mjs"; import type { Environment } from "./env.mjs"; import type { ClientType, DelegationResponse, DelegationSubmission, NotificationPreferences } from "./types.mjs"; /** * The name of the {@link AuthenticatedUserStorageService} service, used to * namespace the service's actions and events. */ export declare const serviceName = "AuthenticatedUserStorageService"; /** * Builds the versioned API base URL for a given environment. * * @param environment - The target environment. * @returns The base URL including the `/api/v1` path segment. */ export declare function getAuthenticatedStorageUrl(environment: Environment): string; /** * Invalidates cached queries for {@link AuthenticatedUserStorageService}. */ export type AuthenticatedUserStorageInvalidateQueriesAction = DataServiceInvalidateQueriesAction; /** * Actions that {@link AuthenticatedUserStorageService} exposes to other * consumers. */ export type AuthenticatedUserStorageActions = AuthenticatedUserStorageServiceMethodActions | AuthenticatedUserStorageInvalidateQueriesAction; /** * Retrieves a bearer token from the `AuthenticationController`, logging in the * user if necessary. */ type AuthenticationControllerGetBearerTokenAction = { type: 'AuthenticationController:getBearerToken'; handler: (entropySourceId?: string) => Promise; }; /** * Actions from other messengers that {@link AuthenticatedUserStorageService} * calls. */ type AllowedActions = AuthenticationControllerGetBearerTokenAction; /** * Published when {@link AuthenticatedUserStorageService}'s cache is updated. */ export type AuthenticatedUserStorageCacheUpdatedEvent = DataServiceCacheUpdatedEvent; /** * Published when a key within {@link AuthenticatedUserStorageService}'s cache * is updated. */ export type AuthenticatedUserStorageGranularCacheUpdatedEvent = DataServiceGranularCacheUpdatedEvent; /** * Events that {@link AuthenticatedUserStorageService} exposes to other * consumers. */ export type AuthenticatedUserStorageEvents = AuthenticatedUserStorageCacheUpdatedEvent | AuthenticatedUserStorageGranularCacheUpdatedEvent; /** * Events from other messengers that * {@link AuthenticatedUserStorageService} subscribes to. */ type AllowedEvents = never; /** * The messenger which is restricted to actions and events accessed by * {@link AuthenticatedUserStorageService}. */ export type AuthenticatedUserStorageMessenger = Messenger; /** * Data service wrapping authenticated user-storage API endpoints. * * Provides methods for managing delegations and notification preferences * for the authenticated user. */ export declare class AuthenticatedUserStorageService extends BaseDataService { #private; /** * Constructs a new AuthenticatedUserStorageService. * * @param args - The constructor arguments. * @param args.messenger - The messenger suited for this service. * @param args.environment - The target environment (dev, uat, prod). * @param args.policyOptions - Options to pass to `createServicePolicy`, which * is used to wrap each request. See {@link CreateServicePolicyOptions}. */ constructor({ messenger, environment, policyOptions, }: { messenger: AuthenticatedUserStorageMessenger; environment: Environment; policyOptions?: CreateServicePolicyOptions; }); /** * Returns all delegation records belonging to the authenticated user. * * @returns An array of delegation records, or an empty array if none exist. */ listDelegations(): Promise; /** * Stores a signed delegation record for the authenticated user. * * @param submission - The signed delegation and its metadata. * @param clientType - Optional client type header. */ createDelegation(submission: DelegationSubmission, clientType?: ClientType): Promise; /** * Revokes (deletes) a delegation record. * * @param delegationHash - The unique hash identifying the delegation. */ revokeDelegation(delegationHash: string): Promise; /** * Returns the notification preferences for the authenticated user. * * @returns The notification preferences object, or `null` if none have been * set (404). */ getNotificationPreferences(): Promise; /** * Creates or updates the notification preferences for the authenticated user. * * @param prefs - The full notification preferences object. * @param clientType - Optional client type header. */ putNotificationPreferences(prefs: NotificationPreferences, clientType?: ClientType): Promise; } export {}; //# sourceMappingURL=authenticated-user-storage.d.mts.map