4 static func convert(ckksKey: CKKSKeychainBackedKey) -> ViewKey {
6 switch ckksKey.keyclass {
7 case SecCKKSKeyClassTLK:
11 case SecCKKSKeyClassC:
18 $0.uuid = ckksKey.uuid
19 $0.parentkeyUuid = ckksKey.parentKeyUUID
21 $0.wrappedkeyBase64 = ckksKey.wrappedkey.base64WrappedKey()
22 $0.uploadOsVersion = SecCKKSHostOSVersion()
27 // TODO: We need to support key rolling as well...
29 static func convert(ckksKeySet: CKKSKeychainBackedKeySet) -> ViewKeys {
30 return ViewKeys.with {
31 $0.view = ckksKeySet.tlk.zoneID.zoneName
32 $0.newTlk = ViewKey.convert(ckksKey: ckksKeySet.tlk)
33 $0.newClassA = ViewKey.convert(ckksKey: ckksKeySet.classA)
34 $0.newClassC = ViewKey.convert(ckksKey: ckksKeySet.classC)
40 static func convert(ckksTLKShare: CKKSTLKShare) -> TLKShare {
41 return TLKShare.with {
42 $0.view = ckksTLKShare.zoneID.zoneName
43 $0.curve = Int64(ckksTLKShare.curve.rawValue)
44 $0.epoch = Int64(ckksTLKShare.epoch)
45 $0.keyUuid = ckksTLKShare.tlkUUID
46 $0.poisoned = Int64(ckksTLKShare.poisoned)
47 $0.receiver = ckksTLKShare.receiverPeerID
48 $0.receiverPublicEncryptionKey = ckksTLKShare.receiverPublicEncryptionKeySPKI.base64EncodedString()
49 $0.sender = ckksTLKShare.senderPeerID
50 $0.signature = ckksTLKShare.signature?.base64EncodedString() ?? ""
51 $0.version = Int64(ckksTLKShare.version.rawValue)
52 $0.wrappedkey = ckksTLKShare.wrappedTLK?.base64EncodedString() ?? ""