find channel by name or secret

This commit is contained in:
liamcottle 2025-04-08 14:48:29 +12:00
parent 2ec624c318
commit 8059fea1b4
2 changed files with 36 additions and 2 deletions

View file

@ -1692,6 +1692,31 @@ class Connection extends EventEmitter {
});
}
async findChannelByName(name) {
// get channels
const channels = await this.getChannels();
// find first channel matching name exactly
return channels.find((channel) => {
console.log(channel);
return channel.name === name;
});
}
async findChannelBySecret(secret) {
// get channels
const channels = await this.getChannels();
// find first channel matching secret
return channels.find((channel) => {
return BufferUtils.areBuffersEqual(secret, channel.secret);
});
}
tracePath(path) {
return new Promise(async (resolve, reject) => {
try {