(storeId: string, entryIds: ReadonlyArray<EntryId>)
| 86 | |
| 87 | // The store id is length-prefixed, followed by the 16-byte entry ids. |
| 88 | const additionalData = (storeId: string, entryIds: ReadonlyArray<EntryId>): Uint8Array => { |
| 89 | const store = textEncoder.encode(storeId) |
| 90 | const data = new Uint8Array(4 + store.byteLength + entryIds.length * 16) |
| 91 | new DataView(data.buffer).setUint32(0, store.byteLength) |
| 92 | data.set(store, 4) |
| 93 | let offset = 4 + store.byteLength |
| 94 | for (const id of entryIds) { |
| 95 | data.set(id, offset) |
| 96 | offset += 16 |
| 97 | } |
| 98 | return data |
| 99 | } |
| 100 | |
| 101 | const equalBytes = (a: Uint8Array, b: Uint8Array): boolean => { |
| 102 | if (a.byteLength !== b.byteLength) return false |
no test coverage detected