Skip to content

Commit

Permalink
Upgrade for v0.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkx committed Apr 19, 2021
1 parent be59380 commit 0f7decf
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions PatientScannerDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ extension ViewController {
}

func observationHandler(payloadS: String?) {
let payloadS: String? = "HC1NCFOXNEG2NBJ5*H:QO-.O /MD064 PJ26UV0 XHLQ9HXKZNEQCSJ591MVBATW$4 S8$96NF6OR5UVBJUB4PJU47326/Z7PCL394Z/MWP4 N66ED6JC:JEG.CZJC0:C6JK:JM$JLAINN6BLHM035L8CCECS.CYMCPOJ5OI9YI:8DRFC%PD*ZLJ9CWVBREJFZM4A7Z/M*+Q.28+VQXCRAHAF27I9QQ60E2KYIJPOJI7J/VJ0 JYSJEZIK7B*IJS7BCLIOCISEBTKBRHSWKJ4:2POJ.GILYJ7GPSVBY4CJZIOMI$MI1VC3TCYR6HCRF46Q96W/6-DP+%PPMC1KJG%HJ*81.7 84-W6I RO5PH6UDUH+/F9PJCQFRVV 8UDJ5QEV2Y8%635OHH0E2:E5VUJZ4 VT3+6ZU598O:E0/ 0VP2IBO6ANG%6UD5RSRO4B6$ES40H/CQ1"
let payloadS: String? = "HC1:NCFOXNEG2NBJ5*H:QO-.O /MD064 PJ26UV0 XHLQ9HXKZNEQCSJ591MVBATW$4 S8$96NF6OR5UVBJUB4PJU47326/Z7PCL394Z/MWP4 N66ED6JC:JEG.CZJC0:C6JK:JM$JLAINN6BLHM035L8CCECS.CYMCPOJ5OI9YI:8DRFC%PD*ZLJ9CWVBREJFZM4A7Z/M*+Q.28+VQXCRAHAF27I9QQ60E2KYIJPOJI7J/VJ0 JYSJEZIK7B*IJS7BCLIOCISEBTKBRHSWKJ4:2POJ.GILYJ7GPSVBY4CJZIOMI$MI1VC3TCYR6HCRF46Q96W/6-DP+%PPMC1KJG%HJ*81.7 84-W6I RO5PH6UDUH+/F9PJCQFRVV 8UDJ5QEV2Y8%635OHH0E2:E5VUJZ4 VT3+6ZU598O:E0/ 0VP2IBO6ANG%6UD5RSRO4B6$ES40H/CQ1"
guard
let payloadString = payloadS,
let compressed = try? String(payloadString.dropFirst(3)).fromBase45()
let compressed = try? String(payloadString.dropFirst(4)).fromBase45()
else { return }

let data = decompress(compressed)
Expand Down
8 changes: 6 additions & 2 deletions PatientScannerDemoTests/EHNTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import XCTest

class EHNTests: XCTestCase {
func testCoseEcdsa() throws {
var barcode = "HC1NCFY70R30FFWTWGSLKC 4O992$V M63TMF2V*D9LPC.3EHPCGEC27B72VF/347O4-M6Y9M6FOYG4ILDEI8GR3ZI$15MABL:E9CVBGEEWRMLE C39S0/ANZ52T82Z-73D63P1U 1$PKC 72H2XX09WDH889V5"
var barcode = "HC1:NCFY70R30FFWTWGSLKC 4O992$V M63TMF2V*D9LPC.3EHPCGEC27B72VF/347O4-M6Y9M6FOYG4ILDEI8GR3ZI$15MABL:E9CVBGEEWRMLE C39S0/ANZ52T82Z-73D63P1U 1$PKC 72H2XX09WDH889V5"

let trustJson = """
[
Expand All @@ -32,9 +32,13 @@ class EHNTests: XCTestCase {
]
"""

// Remove HC1 header if any
// Remove HC1 header if any (v0.0.3 'HC1', v0.0.4 'HC1:'
//
if (barcode.hasPrefix("HC1")) {
barcode = String(barcode.suffix(barcode.count-3))
if (barcode.hasPrefix("1")) {
barcode = String(barcode.suffix(barcode.count-1))
}
}

guard
Expand Down

0 comments on commit 0f7decf

Please sign in to comment.