Skip u8a -> string -> number[] for qrcode generation (#170)

* Skip u8a -> string -> number[] for qrcode generation

* Fix tests for Uint8Array conversion

* Bumps
This commit is contained in:
Jaco Greeff
2019-07-30 17:26:56 +02:00
committed by GitHub
parent 39a5147fb8
commit 6f5b3c9ccc
8 changed files with 58 additions and 38 deletions
+4 -4
View File
@@ -46,7 +46,7 @@ export function createSignPayload (address: string, payload: string | Uint8Array
);
}
export function createFrames (input: Uint8Array): string[] {
export function createFrames (input: Uint8Array): Uint8Array[] {
const frames = [];
let idx = 0;
@@ -56,13 +56,13 @@ export function createFrames (input: Uint8Array): string[] {
idx += FRAME_SIZE;
}
return frames.map((frame, index: number): string =>
decodeString(u8aConcat(
return frames.map((frame, index: number): Uint8Array =>
u8aConcat(
MULTIPART,
encodeNumber(frames.length),
encodeNumber(index),
frame
))
)
);
}