Compare commits

...

2 Commits

6 changed files with 25 additions and 11 deletions

View File

@ -3,6 +3,9 @@ import * as tfrpc from '/tfrpc.js';
tfrpc.register(async function getIdentities() {
return ssb.getIdentities();
});
tfrpc.register(async function createID(id) {
return await ssb.createIdentity();
});
tfrpc.register(async function getPrivateKey(id) {
return bip39Words(await ssb.getPrivateKey(id));
});
@ -15,6 +18,9 @@ tfrpc.register(async function setTheme() {
console.warn("setTheme called - not implemented")
return null;
});
tfrpc.register(async function reload() {
await main();
});
async function main() {
// Get body.html
@ -25,9 +31,7 @@ async function main() {
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/static/tildefriends-latest.css"/>
<link rel="stylesheet" href="style.css"/>
<script src="script.js" type="module"></script>
<link rel="stylesheet" href="/static/tildefriends-v1.css"/>
<script src="tf-theme-picker.js" type="module"></script>
<script src="tf-password-form.js" type="module"></script>
<script src="tf-delete-account-btn.js" type="module"></script>

View File

@ -9,11 +9,11 @@
<div class="box flex-column">
<h2>Danger Zone</h2>
<h3>Change my password</h3>
<tf-password-form></tf-password-form>
<h3>Manage your identities</h3>
<tf-identity-manager></tf-identity-manager>
<h3>Change my password</h3>
<tf-password-form></tf-password-form>
<h3>Delete your account</h3>
<tf-delete-account-btn></tf-delete-account-btn>

View File

@ -22,7 +22,7 @@ class TfDeleteAccountButtonElement extends LitElement {
render() {
return html`
<link rel="stylesheet" href="/static/tildefriends-latest.css"/>
<link rel="stylesheet" href="/static/tildefriends-v1.css"/>
<span>This action is irreversible !</span>

View File

@ -18,13 +18,23 @@ class TfIdentityManagerElement extends LitElement {
this.ids = await tfrpc.rpc.getIdentities();
}
async createIdentity() {
try {
let id = await tfrpc.rpc.createID();
alert('Successfully created: ' + id);
await tfrpc.rpc.reload();
} catch (err) {
alert('Error creating identity: ' + err);
}
}
async exportIdentity(id) {
alert('Your private key is:\n' + (await tfrpc.rpc.getPrivateKey(id)));
}
render() {
return html`
<link rel="stylesheet" href="/static/tildefriends-latest.css"/>
<link rel="stylesheet" href="/static/tildefriends-v1.css"/>
<style>
.id-span {
font-family: monospace;
@ -33,7 +43,7 @@ class TfIdentityManagerElement extends LitElement {
</style>
<h4>Create a new identity</h4>
<button id="create-id" class="btn-green">[Not implemented] Create Identity</button>
<button id="create-id" class="green" @click=${this.createIdentity}>Create Identity</button>
<h4>Import an SSB Identity from 12 BIP39 English Words</h4>
<textarea id="add-id" style="width: 100%" rows="4"></textarea>

View File

@ -37,7 +37,7 @@ class TfPasswordFormElement extends LitElement {
render() {
return html`
<link rel="stylesheet" href="/static/tildefriends-latest.css"/>
<link rel="stylesheet" href="/static/tildefriends-v1.css"/>
<style>
.grid {

View File

@ -26,7 +26,7 @@ class TfThemePickerElement extends LitElement {
render() {
return html`
<link rel="stylesheet" href="/static/tildefriends-latest.css"/>
<link rel="stylesheet" href="/static/tildefriends-v1.css"/>
<label for="theme">[Not implemented] Choose your theme:</label>