UNPKG

react-native-app-data-sharing

Version:

This React Native package facilitates seamless and secure data sharing between applications on the same device.

65 lines 3.21 kB
import { type DataOptionsType, type InitialProviderType } from './DataSharingTypes'; /** * Saves a key-value pair to the shared storage. * * @param key - The key to be saved * @param value - The value to be saved * @param options - An optional object containing configuration options * @returns A promise that resolves to an empty value if the data was saved successfully, * or rejects with an error if the data could not be saved. */ export declare const saveData: (key: string, value: string, options?: DataOptionsType) => Promise<boolean>; /** * Initializes the shared storage with the provided authorities. * * @param authorities - An object containing configuration options for the shared storage, * with keys for Android and iOS platforms. * @returns A promise that resolves to an empty value if the store was initialized successfully, * or rejects with an error if the store could not be initialized. */ export declare const initializeStore: (authorities: InitialProviderType) => Promise<boolean>; /** * Retrieves a value from the shared storage. * * @param key - The key of the data to be retrieved. * @param options - An optional object containing configuration options. * @returns A promise that resolves to the value stored under the key, * or rejects with an error if the value could not be retrieved. */ export declare const getData: (key: string, options?: DataOptionsType) => Promise<string>; /** * Retrieves all key-value pairs from the shared storage. * * @param options - An optional object containing configuration options. * @returns A promise that resolves to an object with keys as strings and values as strings, * or rejects with an error if the data could not be retrieved, or is undefined if no data is found. */ export declare const getAllSyncData: (options?: DataOptionsType) => Promise<Record<string, string> | undefined>; /** * Updates a key-value pair in the shared storage. * * @param key - The key of the data to be updated. * @param value - The new value for the key. * @param options - An optional object containing configuration options. * @returns A promise that resolves to an empty value if the data was updated successfully, * or rejects with an error if the data could not be updated. */ export declare const updateData: (key: string, value: string, options?: DataOptionsType) => Promise<boolean>; /** * Deletes a key-value pair from the shared storage. * * @param key - The key of the data to be deleted. * @param options - An optional object containing configuration options. * @returns A promise that resolves to an empty value if the data was deleted successfully, * or rejects with an error if the data could not be deleted. */ export declare const deleteData: (key: string, options?: DataOptionsType) => Promise<boolean>; /** * Clears all data from the shared storage. * * @param options - An optional object containing configuration options. * @returns A promise that resolves to an empty value if the data was cleared successfully, * or rejects with an error if the data could not be cleared. */ export declare const clearData: (options?: DataOptionsType) => Promise<boolean>; //# sourceMappingURL=DataSharing.d.ts.map