Minor identity interface improvements.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4735 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
Cory McWilliams 2024-01-06 18:40:57 +00:00
parent 4e5f9c86a8
commit ebc4533b10
2 changed files with 15 additions and 4 deletions

View File

@ -1,5 +1,5 @@
{ {
"type": "tildefriends-app", "type": "tildefriends-app",
"emoji": "🪪", "emoji": "🪪",
"previous": "&1RskhkBW1UheJRrw7xcTjS8ELDMnBXNAuKqW5BiT72c=.sha256" "previous": "&BOmGofChv5mvgZq61xy5mSS0fshtttcG68uL1ILu+qo=.sha256"
} }

View File

@ -14,13 +14,21 @@ async function main() {
import * as tfrpc from '/static/tfrpc.js'; import * as tfrpc from '/static/tfrpc.js';
async function export_id(event) { async function export_id(event) {
let id = event.srcElement.innerHTML; let id = event.srcElement.innerHTML;
document.body.insertBefore(document.createTextNode(await tfrpc.rpc.get_private_key(id)), event.srcElement.parentNode.nextSibling); let element = document.createElement('textarea');
event.srcElement.disabled = true; element.value = await tfrpc.rpc.get_private_key(id);
element.style = 'width: 100%; read-only: true';
element.readOnly = true;
document.body.insertBefore(element, event.srcElement.parentNode.nextSibling);
event.srcElement.onclick = event => hide_id(event, element);
} }
async function add_id(event) { async function add_id(event) {
let id = document.getElementById('add_id').value; let id = document.getElementById('add_id').value;
await tfrpc.rpc.add_id(id); await tfrpc.rpc.add_id(id);
} }
function hide_id(event, element) {
element.parentNode.removeChild(element);
event.srcElement.onclick = export_id;
}
window.addEventListener('load', function() { window.addEventListener('load', function() {
for (let button of document.getElementsByTagName('button')) { for (let button of document.getElementsByTagName('button')) {
if (button.id == "add") { if (button.id == "add") {
@ -31,7 +39,10 @@ async function main() {
} }
}); });
</script> </script>
<input type="text" id="add_id"></input><button id="add">Add ID</button>`+ <h1>SSB Identity Management</h1>
<h2>Import an SSB Identity from 12 BIP39 English Words</h2>
<textarea id="add_id" style="width: 100%" rows="4"></textarea><button id="add">Add ID</button>
<h2>Export Identities</h2>`+
ids.map(id => `<div><button>${id}</button></div>`).join('\n')+ ids.map(id => `<div><button>${id}</button></div>`).join('\n')+
`</body>`); `</body>`);
} }