From 49f9548f33a051c53696d7890664d8c427bbdfa4 Mon Sep 17 00:00:00 2001 From: "Valentin D. Pinkman" Date: Mon, 25 Jun 2018 18:32:28 +0200 Subject: [PATCH] fix error throwing when exchanging apdus --- src/helpers/socket.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/helpers/socket.js b/src/helpers/socket.js index 35b30270..9c35ecba 100644 --- a/src/helpers/socket.js +++ b/src/helpers/socket.js @@ -74,7 +74,9 @@ export const createDeviceSocket = (transport: Transport<*>, url: string) => for (const apdu of data) { const r: Buffer = await transport.exchange(Buffer.from(apdu, 'hex')) lastStatus = r.slice(r.length - 2) + if (lastStatus.toString('hex') !== '9000') break } + if (!lastStatus) { throw new DeviceSocketNoBulkStatus() }