expose self-signing in settings UI

This commit is contained in:
Bruno Windels 2023-02-14 16:26:02 +01:00
parent 088fcdc77b
commit c7a2b4dc2e
2 changed files with 23 additions and 2 deletions

View File

@ -92,6 +92,18 @@ export class KeyBackupViewModel extends ViewModel {
return this._session.crossSigning?.isMasterKeyTrusted ?? false;
}
get canSignOwnDevice() {
return !!this._session.crossSigning;
}
async signOwnDevice() {
if (this._session.crossSigning) {
await this.logger.run("KeyBackupViewModel.signOwnDevice", async log => {
await this._session.crossSigning.signOwnDevice(log);
});
}
}
get backupWriteStatus() {
const keyBackup = this._session.keyBackup.get();
if (!keyBackup) {

View File

@ -15,9 +15,10 @@ limitations under the License.
*/
import {TemplateView} from "../../general/TemplateView";
import {disableTargetCallback} from "../../general/utils";
export class KeyBackupSettingsView extends TemplateView {
render(t) {
render(t, vm) {
return t.div([
t.map(vm => vm.status, (status, t, vm) => {
switch (status) {
@ -56,7 +57,15 @@ export class KeyBackupSettingsView extends TemplateView {
}),
t.if(vm => vm.isMasterKeyTrusted, t => {
return t.p("Cross-signing master key found and trusted.")
})
}),
t.if(vm => vm.canSignOwnDevice, t => {
return t.button({
onClick: disableTargetCallback(async evt => {
await vm.signOwnDevice();
})
}, "Sign own device");
}),
]);
}
}