Skip to content

Commit

Permalink
add documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
BillCarsonFr committed Jul 7, 2023
1 parent 3fa7bc9 commit ae127be
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/crypto-api/keybackup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,20 @@ export interface KeyBackupInfo {
version?: string; // number contained within
}

/**
* Status of the active key backup.
*/
export interface KeyBackupStatus {
/** The backup version */
version: string;
/** True if the client is backing up keys to this backup */
enabled: boolean;
}

/**
* Detailed signature information of a backup.
* This can be used to display what devices/identities are trusting a backup.
*/
export type SigInfo = {
deviceId: string;
valid?: boolean | null; // true: valid, false: invalid, null: cannot attempt validation
Expand All @@ -57,21 +66,40 @@ export type SigInfo = {
deviceTrust?: DeviceTrustLevel;
};

/**
* Backup trust information.
* Client can upload and download from backup if `usable` is true.
*/
export type TrustInfo = {
usable: boolean; // is the backup trusted, true iff there is a sig that is valid & from a trusted device
sigs: SigInfo[];
// eslint-disable-next-line camelcase
trusted_locally?: boolean;
trusted_locally?: boolean; // true if the private key is known. Notice that this is not enough to use the backup.
};

/**
* Active key backup info, if any.
* Returned as a result of `checkAndStart()`.
*/
export interface IKeyBackupCheck {
backupInfo?: IKeyBackupInfo;
trustInfo: TrustInfo;
}

/**
* Server side keys backup management.
* Devices may upload encrypted copies of keys to the server.
* When a device tries to read a message that it does not have keys for, it may request the key from the server and decrypt it.
*/
export interface SecureKeyBackup {
/**
* Gets the status of the current active key backup if any.
*/
getKeyBackupStatus(): Promise<KeyBackupStatus | null>;

/**
* Stop the SecureKeyBackup manager from backing up keys and allow a clean shutdown.
*/
stop(): void;

/**
Expand Down

0 comments on commit ae127be

Please sign in to comment.