@sebastianp265/safe-server-side-storage-client
Version:
Library for Confidential Server-Side Message Storage Using the Labyrinth Protocol
40 lines • 1.99 kB
TypeScript
import { ThisDeviceSerialized } from "./device/ThisDevice";
import { EpochStorageSerialized } from "./EpochStorage";
import { LabyrinthServerClient } from "./labyrinth-server-client";
export type LabyrinthSerialized = {
thisDevice: ThisDeviceSerialized;
epochStorage: EpochStorageSerialized;
};
export type CheckIfLabyrinthIsInitializedResponse = {
isInitialized: boolean;
};
export type CheckIfLabyrinthIsInitializedServerClient = {
checkIfLabyrinthIsInitialized: () => Promise<CheckIfLabyrinthIsInitializedResponse>;
};
export type NotifyAboutDeviceActivityServerClient = {
notifyAboutDeviceActivity: (deviceId: string) => Promise<void>;
};
export type CheckIfAnyDeviceExceedInactivityLimitResponseDTO = {
didAnyDeviceExceedInactivityLimit: boolean;
};
export type CheckIfAnyDeviceExceedInactivityLimitServerClient = {
checkIfAnyDeviceExceedInactivityLimit: () => Promise<CheckIfAnyDeviceExceedInactivityLimitResponseDTO>;
};
export declare class Labyrinth {
private readonly thisDevice;
private readonly epochStorage;
static checkIfLabyrinthIsInitialized(labyrinthServerClient: LabyrinthServerClient): Promise<CheckIfLabyrinthIsInitializedResponse>;
static initialize(userId: string, labyrinthServerClient: LabyrinthServerClient): Promise<{
labyrinthInstance: Labyrinth;
recoveryCode: string;
}>;
static fromRecoveryCode(userId: string, recoveryCode: string, labyrinthServerClient: LabyrinthServerClient): Promise<Labyrinth>;
static deserialize(labyrinthSerialized: LabyrinthSerialized, labyrinthServerClient: LabyrinthServerClient): Promise<Labyrinth>;
serialize(): LabyrinthSerialized;
private constructor();
encrypt(threadId: string, epochSequenceId: string, plaintext: Uint8Array): Uint8Array;
decrypt(threadId: string, epochSequenceId: string, ciphertext: Uint8Array): Uint8Array;
getNewestEpochSequenceId(): string;
getNewestEpochId(): string;
}
//# sourceMappingURL=Labyrinth.d.ts.map