mirror of https://github.com/waku-org/js-noise.git
feat: Add `getNametagPosition` & `getNametagAtPosition` method to `MessageNametagBuffer`
This commit is contained in:
parent
1a0b044451
commit
4d6d4ca5bd
|
@ -84,6 +84,11 @@ export class MessageNametagBuffer {
|
|||
return true;
|
||||
}
|
||||
|
||||
getNametagPosition(messageNametag: MessageNametag): number {
|
||||
const index = this.buffer.findIndex((x) => uint8ArrayEquals(x, messageNametag));
|
||||
return index;
|
||||
}
|
||||
|
||||
private rotateLeft(k: number): void {
|
||||
if (k < 0 || this.buffer.length == 0) {
|
||||
return;
|
||||
|
@ -124,6 +129,10 @@ export class MessageNametagBuffer {
|
|||
console.debug("The message nametags buffer has no secret set");
|
||||
}
|
||||
}
|
||||
|
||||
getNametagAtPosition(position: number): MessageNametag {
|
||||
return this.buffer[position];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue