2020-02-19 04:52:00 +00:00
|
|
|
public protocol Secret: Identifiable, Hashable {
|
2020-03-04 07:14:38 +00:00
|
|
|
|
|
|
|
var name: String { get }
|
2020-03-09 05:17:59 +00:00
|
|
|
var algorithm: Algorithm { get }
|
|
|
|
var keySize: Int { get }
|
2020-03-04 07:14:38 +00:00
|
|
|
var publicKey: Data { get }
|
|
|
|
|
2020-02-19 04:52:00 +00:00
|
|
|
}
|
2020-03-09 05:17:59 +00:00
|
|
|
|
2020-03-24 06:22:22 +00:00
|
|
|
public enum Algorithm: Hashable {
|
2020-03-10 05:06:51 +00:00
|
|
|
case ellipticCurve
|
2020-03-09 05:17:59 +00:00
|
|
|
public init(secAttr: NSNumber) {
|
|
|
|
let secAttrString = secAttr.stringValue as CFString
|
|
|
|
switch secAttrString {
|
|
|
|
case kSecAttrKeyTypeEC:
|
|
|
|
self = .ellipticCurve
|
|
|
|
default:
|
|
|
|
fatalError()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|