Updated on 2026-08-14
This commit is contained in:
parent
7e7e3254f3
commit
0c419c3441
9 changed files with 167 additions and 17 deletions
|
|
@ -51,7 +51,7 @@ class TlvTest {
|
|||
assertThat(tlvs)
|
||||
.isNotEmpty()
|
||||
|
||||
val pin = tlvs!!.find { it.tag == TlvTag.Pin }?.value
|
||||
val pin = tlvs!!.find { it.tag == TlvTag.Pin }?.value
|
||||
val pinExpected = "000000".calculateSha256()
|
||||
|
||||
assertThat(pin)
|
||||
|
|
@ -72,7 +72,7 @@ class TlvTest {
|
|||
assertThat(tlvs)
|
||||
.isNotEmpty()
|
||||
|
||||
val pin = tlvs!!.find { it.tag == TlvTag.Pin }?.value
|
||||
val pin = tlvs!!.find { it.tag == TlvTag.Pin }?.value
|
||||
val pinExpected = "000000".calculateSha256()
|
||||
assertThat(pin)
|
||||
.isEqualTo(pinExpected)
|
||||
|
|
@ -92,12 +92,20 @@ class TlvTest {
|
|||
fun `Bytes to TLVs, wrong values`() {
|
||||
val bytes = byteArrayOf(0)
|
||||
val tlvs = Tlv.deserialize(bytes)
|
||||
assertThat(tlvs)
|
||||
.isNull()
|
||||
assertThat(tlvs)
|
||||
.isNull()
|
||||
|
||||
val bytes1 = byteArrayOf(0, 0, 0, 0, 0, 0, 0)
|
||||
val tlvs1 = Tlv.deserialize(bytes1)
|
||||
assertThat(tlvs1)
|
||||
.isNull()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `parse Slix tag response`() {
|
||||
val response = "03ff010f91010b550474616e67656d2e636f6d140f11616e64726f69642e636f6d3a706b67636f6d2e74616e67656d2e77616c6c65745411c974616e67656d2e636f6d3a77616c6c657490000c618102ffff8a0102820407e40109830b54414e47454d2053444b008403584c4d86400e71c1f060387029688254320b90abeae471bcafbbe8ea3880903bdb8d1cc389d032b982e1ffd7ef49e66f1780123b763dd2f3a9a9494eb0fad4ae8cf306672c60207c967a51077c14fc49d867f23b8d0eaf60cad479a56587e894571b7fb33690176140345fbe53f5be0ec871e91c317cde2bd0396d47e4b945c138c153b0271f636a73cf531df1bc54ac4fcdbce42f81b40d58e0265d34e28121a4c50fdfe329a97f6000fe000000000000000000000000000000000000000000000000000000000000000000000000000000"
|
||||
val tlvs = Tlv.deserialize(response.hexToBytes(), true)
|
||||
assertThat(tlvs)
|
||||
.isNotEmpty()
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue