pairing public

This commit is contained in:
Dmitry Bespalov 2019-09-04 16:45:02 +02:00
parent 3f8ce4fdda
commit 4f3b21efc6
2 changed files with 8 additions and 8 deletions

View File

@ -4,8 +4,8 @@ import CryptoSwift
public class KeycardCommandSet { public class KeycardCommandSet {
let cardChannel: CardChannel let cardChannel: CardChannel
let secureChannel: SecureChannel let secureChannel: SecureChannel
var info: ApplicationInfo? public var info: ApplicationInfo?
var pairing: Pairing? { get { secureChannel.pairing } set { secureChannel.pairing = newValue }} public var pairing: Pairing? { get { secureChannel.pairing } set { secureChannel.pairing = newValue }}
public init(cardChannel: CardChannel) { public init(cardChannel: CardChannel) {
self.cardChannel = cardChannel self.cardChannel = cardChannel

View File

@ -1,19 +1,19 @@
struct Pairing { public struct Pairing {
let pairingKey: [UInt8] public let pairingKey: [UInt8]
let pairingIndex: UInt8 public let pairingIndex: UInt8
var bytes: [UInt8] { public var bytes: [UInt8] {
get { get {
return [pairingIndex] + pairingKey return [pairingIndex] + pairingKey
} }
} }
init(pairingKey: [UInt8], pairingIndex: UInt8) { public init(pairingKey: [UInt8], pairingIndex: UInt8) {
self.pairingKey = pairingKey self.pairingKey = pairingKey
self.pairingIndex = pairingIndex self.pairingIndex = pairingIndex
} }
init(pairingData: [UInt8]) { public init(pairingData: [UInt8]) {
self.pairingIndex = pairingData[0] self.pairingIndex = pairingData[0]
self.pairingKey = Array(pairingData[1...]) self.pairingKey = Array(pairingData[1...])
} }