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

View File

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

View File

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

View File

@ -18,13 +18,23 @@ class TfIdentityManagerElement extends LitElement {
this.ids = await tfrpc.rpc.getIdentities(); 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) { async exportIdentity(id) {
alert('Your private key is:\n' + (await tfrpc.rpc.getPrivateKey(id))); alert('Your private key is:\n' + (await tfrpc.rpc.getPrivateKey(id)));
} }
render() { render() {
return html` return html`
<link rel="stylesheet" href="/static/tildefriends-latest.css"/> <link rel="stylesheet" href="/static/tildefriends-v1.css"/>
<style> <style>
.id-span { .id-span {
font-family: monospace; font-family: monospace;
@ -33,7 +43,7 @@ class TfIdentityManagerElement extends LitElement {
</style> </style>
<h4>Create a new identity</h4> <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> <h4>Import an SSB Identity from 12 BIP39 English Words</h4>
<textarea id="add-id" style="width: 100%" rows="4"></textarea> <textarea id="add-id" style="width: 100%" rows="4"></textarea>

View File

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

View File

@ -26,7 +26,7 @@ class TfThemePickerElement extends LitElement {
render() { render() {
return html` 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> <label for="theme">[Not implemented] Choose your theme:</label>