MCPcopy Create free account
hub / github.com/Effect-TS/effect / additionalData

Function additionalData

packages/effect/src/eventlog/EventLogEncryption.ts:88–99  ·  view source on GitHub ↗
(storeId: string, entryIds: ReadonlyArray<EntryId>)

Source from the content-addressed store, hash-verified

86
87// The store id is length-prefixed, followed by the 16-byte entry ids.
88const 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
101const equalBytes = (a: Uint8Array, b: Uint8Array): boolean => {
102 if (a.byteLength !== b.byteLength) return false

Callers 1

Calls 2

encodeMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected