Skip to content

Commit 49ebdfd

Browse files
committed
Disable Data Protection and add comments
Signed-off-by: Milton Moura <miltonmoura@gmail.com>
1 parent 851caf0 commit 49ebdfd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Mactrix/Models/AppKeychain.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ struct AppKeychain {
1616
[
1717
kSecClass: kSecClassGenericPassword,
1818
kSecAttrService: service,
19-
kSecUseDataProtectionKeychain: true,
19+
/// change to true for Data Protection keychain mode
20+
kSecUseDataProtectionKeychain: false,
2021
]
2122
}
2223

@@ -34,6 +35,9 @@ struct AppKeychain {
3435
throw KeychainError.unexpectedStatus(addStatus)
3536
}
3637
} else if updateStatus != errSecSuccess {
38+
/// with kSecUseDataProtectionKeychain set to true, this will throw with error -34018, which according to
39+
/// https://github.com/apple-oss-distributions/Security/blob/09becc8fb155462f0853f99cd09c26b10a38e2f4/sec/Security/SecBasePriv.h#L113
40+
/// is the error "Internal error when a required entitlement isn't present"
3741
throw KeychainError.unexpectedStatus(updateStatus)
3842
}
3943
}

0 commit comments

Comments
 (0)