mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-05-18 05:05:36 +02:00
crypto: set length when converting uint8array to buffer
This commit is contained in:
committed by
Abdullah Atta
parent
5774daf3a9
commit
e6b9219d75
@@ -412,7 +412,7 @@ function toBuffer<TInput extends ToBufferInput>(
|
|||||||
input: TInput
|
input: TInput
|
||||||
): ToBufferResult<TInput> {
|
): ToBufferResult<TInput> {
|
||||||
if (input instanceof Uint8Array) {
|
if (input instanceof Uint8Array) {
|
||||||
return Buffer.from(input.buffer);
|
return Buffer.from(input.buffer, 0, input.byteLength);
|
||||||
} else if (typeof input === "undefined" || input === null) {
|
} else if (typeof input === "undefined" || input === null) {
|
||||||
return undefined as ToBufferResult<TInput>;
|
return undefined as ToBufferResult<TInput>;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user