File tree Expand file tree Collapse file tree 2 files changed +7
-8
lines changed
Expand file tree Collapse file tree 2 files changed +7
-8
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ class ZitiIdentityTests: XCTestCase {
8686 XCTAssertEqual ( decoded. startDisabled, true )
8787 }
8888
89+ #if CZITI_TEST_INSECURE_KEYS
8990 func testKeyDefaultsToNil( ) throws {
9091 let id = ZitiIdentity ( id: " x " , ztAPIs: [ " https://ctrl:1280 " ] )
9192 XCTAssertNil ( id. key)
@@ -104,6 +105,7 @@ class ZitiIdentityTests: XCTestCase {
104105 let decoded = try JSONDecoder ( ) . decode ( ZitiIdentity . self, from: data)
105106 XCTAssertEqual ( decoded. key, pem)
106107 }
108+ #endif
107109
108110 func testDecodeOldZidWithoutKeyField( ) throws {
109111 // Existing .zid files in the wild never have a key field. Must still decode.
@@ -112,6 +114,5 @@ class ZitiIdentityTests: XCTestCase {
112114 """
113115 let decoded = try JSONDecoder ( ) . decode ( ZitiIdentity . self, from: json. data ( using: . utf8) !)
114116 XCTAssertEqual ( decoded. id, " legacy " )
115- XCTAssertNil ( decoded. key)
116117 }
117118}
Original file line number Diff line number Diff line change @@ -53,14 +53,12 @@ import Foundation
5353 /// Certificates (PEM)
5454 @objc public var certs : String ?
5555
56- /// Private key (PEM).
57- ///
58- /// Only populated by builds compiled with `CZITI_TEST_INSECURE_KEYS`. Release builds
59- /// keep the private key in the keychain and leave this field nil. If this field is
60- /// populated in a loaded identity, `Ziti.run()` (in an insecure-keys build) will use
61- /// it directly instead of reading from the keychain. This field is never populated
62- /// or read by release builds.
56+ #if CZITI_TEST_INSECURE_KEYS
57+ /// Private key (PEM). Only present in builds compiled with `CZITI_TEST_INSECURE_KEYS`.
58+ /// The enrollment flow writes the ephemeral key here so `Ziti.run()` can use it
59+ /// without touching the data protection keychain.
6360 @objc public var key : String ?
61+ #endif
6462
6563 /// CA pool verified as part of enrollment that can be used to establish trust with of the Ziti controller
6664 @objc public var ca : String ?
You can’t perform that action at this time.
0 commit comments