add dump device after pairing confirmation and unpair revoke button
This commit is contained in:
parent
65bfe1cd21
commit
eedfac704d
@ -17,7 +17,7 @@
|
|||||||
</svg>
|
</svg>
|
||||||
|
|
||||||
<div class="menu-content" id="menu">
|
<div class="menu-content" id="menu">
|
||||||
<a href="#">Revoke</a>
|
<a href="#" onclick="unpair()">Revoke</a>
|
||||||
<a href="#">Export</a>
|
<a href="#">Export</a>
|
||||||
<a href="#">Import</a>
|
<a href="#">Import</a>
|
||||||
<a href="#">Disconnect</a>
|
<a href="#">Disconnect</a>
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
import Services from "/src/services/service.ts";
|
||||||
|
|
||||||
function toggleMenu() {
|
function toggleMenu() {
|
||||||
const menu = document.getElementById("menu");
|
const menu = document.getElementById("menu");
|
||||||
if (menu.style.display === "block") {
|
if (menu.style.display === "block") {
|
||||||
@ -370,3 +372,11 @@ document.addEventListener("click", () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
export async function unpair() {
|
||||||
|
const service = await Services.getInstance()
|
||||||
|
await service.unpairDevice()
|
||||||
|
}
|
||||||
|
|
||||||
|
window.unpair = unpair;
|
@ -100,9 +100,10 @@ export default class Routing {
|
|||||||
const commitmentOutpoint = `${emptyTxid}:${U32_MAX}`;
|
const commitmentOutpoint = `${emptyTxid}:${U32_MAX}`;
|
||||||
|
|
||||||
// We take the paired device(s) from the contract
|
// We take the paired device(s) from the contract
|
||||||
this.sdkClient.pair_device(commitmentOutpoint, this.paired_addresses)
|
await this.sdkClient.pair_device(commitmentOutpoint, this.paired_addresses)
|
||||||
this.paired_addresses = []
|
this.paired_addresses = []
|
||||||
|
const newDevice = await service.dumpDevice();
|
||||||
|
await service.saveDevice(newDevice);
|
||||||
service.injectProcessListPage();
|
service.injectProcessListPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,6 +106,13 @@ export default class Services {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async unpairDevice(): Promise<void> {
|
||||||
|
const service = await Services.getInstance()
|
||||||
|
await service.sdkClient.unpair_device()
|
||||||
|
const newDevice = await this.dumpDevice();
|
||||||
|
await this.saveDevice(newDevice);
|
||||||
|
}
|
||||||
|
|
||||||
private prepareProcessTx(myAddress: string, recipientAddress: string) {
|
private prepareProcessTx(myAddress: string, recipientAddress: string) {
|
||||||
const initial_session_privkey = new Uint8Array(32);
|
const initial_session_privkey = new Uint8Array(32);
|
||||||
const initial_session_pubkey = new Uint8Array(32);
|
const initial_session_pubkey = new Uint8Array(32);
|
||||||
@ -527,6 +534,7 @@ export default class Services {
|
|||||||
// await database.writeObject(indexedDb, database.getStoreList().AnkUser, user.user, null);
|
// await database.writeObject(indexedDb, database.getStoreList().AnkUser, user.user, null);
|
||||||
container.innerHTML = processPage;
|
container.innerHTML = processPage;
|
||||||
const newScript = document.createElement('script');
|
const newScript = document.createElement('script');
|
||||||
|
newScript.setAttribute('type', 'module')
|
||||||
newScript.textContent = processScript;
|
newScript.textContent = processScript;
|
||||||
document.head.appendChild(newScript).parentNode?.removeChild(newScript);
|
document.head.appendChild(newScript).parentNode?.removeChild(newScript);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user