Add a Module API for accessing storage helper functions. (#34284)
* Add a Module API for accessing the Platform. * Drop overkill module test * drop unused sample file * fix import * Update module API * fix typo * fix typo again * and again * update api
This commit is contained in:
@@ -24,6 +24,7 @@ import { type WidgetLifecycleApi } from "./widget-lifecycle.ts";
|
||||
import { type WidgetApi } from "./widget.ts";
|
||||
import { type CustomisationsApi } from "./customisations.ts";
|
||||
import { type ComposerApi } from "./composer.ts";
|
||||
import { type StorageHelperApi } from "./storage-helper.ts";
|
||||
import { type SettingsApi } from "./settings.ts";
|
||||
|
||||
/**
|
||||
@@ -167,6 +168,11 @@ export interface Api
|
||||
*/
|
||||
readonly composer: ComposerApi;
|
||||
|
||||
/**
|
||||
* Allows modules to access storage helper functions.
|
||||
* @alpha Subject to change.
|
||||
*/
|
||||
readonly storageHelper: StorageHelperApi;
|
||||
/**
|
||||
* Allows modules to read application settings.
|
||||
* @alpha Subject to change.
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
Copyright 2026 Element Creations Ltd.
|
||||
|
||||
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||
Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
/**
|
||||
* API for accessing functions that help with storing things.
|
||||
* @alpha Subject to change.
|
||||
*/
|
||||
export interface StorageHelperApi {
|
||||
/**
|
||||
* Gets a previously stored pickle key, used for encrypting crypto data.
|
||||
* @param userId - the user ID for the user that the pickle key is for.
|
||||
* @param deviceId - the device ID that the pickle key is for.
|
||||
* @returns the previously stored pickle key, or null if no pickle key has been stored.
|
||||
*/
|
||||
getPickleKey(userId: string, deviceId: string): Promise<string | null>;
|
||||
}
|
||||
@@ -35,6 +35,7 @@ export type * from "./api/widget-lifecycle";
|
||||
export type * from "./api/widget";
|
||||
export type * from "./api/customisations";
|
||||
export { UIComponent } from "./api/customisations";
|
||||
export type * from "./api/storage-helper";
|
||||
export type * from "./api/settings";
|
||||
export * from "./api/watchable";
|
||||
export type * from "./utils";
|
||||
|
||||
Reference in New Issue
Block a user