ui to test channels

This commit is contained in:
liamcottle 2025-03-11 20:23:25 +13:00
parent 209992d307
commit 78e990aeac
2 changed files with 26 additions and 0 deletions

View file

@ -113,6 +113,12 @@
<button @click="getChannels" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
GetChannels
</button>
<button @click="setChannel" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
SetChannel
</button>
<button @click="deleteChannel" class="border border-gray-500 px-2 bg-gray-100 hover:bg-gray-200 rounded">
DeleteChannel
</button>
</div>
</div>
@ -537,6 +543,20 @@
alert("Failed to get channels!");
}
},
async setChannel() {
try {
await this.connection.setChannel(1, "Test Channel", BufferUtils.base64ToBytes("RQKLcABJ8tLX+7yerzS9Rw=="));
} catch(e) {
alert("Failed to set channel!");
}
},
async deleteChannel() {
try {
await this.connection.deleteChannel(1);
} catch(e) {
alert("Failed to delete channel!");
}
},
async login(contact) {
// ask user for password

View file

@ -6,6 +6,12 @@ class BufferUtils {
}).join('');
}
static base64ToBytes(base64) {
return Uint8Array.from(atob(base64), (c) => {
return c.charCodeAt(0);
});
}
static areBuffersEqual(byteArray1, byteArray2) {
// ensure length is the same