Description
The project is currently experiencing TypeScript errors in src/utils/event.ts due to stricter type checking regarding Buffer and Uint8Array compatibility.
In modern TypeScript/Node.js type definitions, Buffer is not always directly assignable to parameters expecting Uint8Array<ArrayBuffer> because Buffer.buffer can be a SharedArrayBuffer, which is missing properties required by the standard ArrayBuffer interface (like resizable, transfer, etc.).
Observed Errors
The following errors were found in src/utils/event.ts:
- In
getEventHash (Line 108):
Argument of type 'Buffer' is not assignable to parameter of type 'Uint8Array<ArrayBufferLike>'.
- In
encryptKind4Event / getSharedSecret (Line 165):
Argument of type 'string | Buffer' is not assignable to parameter of type 'PrivKey'.
- In
encryptKind4Event / createCipheriv (Line 171):
Argument of type 'Buffer' is not assignable to parameter of type 'CipherKey'.
Proposed Fix
Convert Buffer instances to Uint8Array explicitly when passing them to functions that strictly expect Uint8Array<ArrayBuffer>.
For example, using new Uint8Array(myBuffer) instead of passing the buffer directly ensures that the type system treats the input as a standard Uint8Array.

Description
The project is currently experiencing TypeScript errors in
src/utils/event.tsdue to stricter type checking regardingBufferandUint8Arraycompatibility.In modern TypeScript/Node.js type definitions,
Bufferis not always directly assignable to parameters expectingUint8Array<ArrayBuffer>becauseBuffer.buffercan be aSharedArrayBuffer, which is missing properties required by the standardArrayBufferinterface (likeresizable,transfer, etc.).Observed Errors
The following errors were found in
src/utils/event.ts:getEventHash(Line 108):Argument of type 'Buffer' is not assignable to parameter of type 'Uint8Array<ArrayBufferLike>'.encryptKind4Event/getSharedSecret(Line 165):Argument of type 'string | Buffer' is not assignable to parameter of type 'PrivKey'.encryptKind4Event/createCipheriv(Line 171):Argument of type 'Buffer' is not assignable to parameter of type 'CipherKey'.Proposed Fix
Convert
Bufferinstances toUint8Arrayexplicitly when passing them to functions that strictly expectUint8Array<ArrayBuffer>.For example, using
new Uint8Array(myBuffer)instead of passing the buffer directly ensures that the type system treats the input as a standardUint8Array.