secretive/SecretKit/Secret.swift

22 lines
492 B
Swift
Raw Normal View History

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 }
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-24 06:22:22 +00:00
public enum Algorithm: Hashable {
2020-03-10 05:06:51 +00:00
case ellipticCurve
public init(secAttr: NSNumber) {
let secAttrString = secAttr.stringValue as CFString
switch secAttrString {
case kSecAttrKeyTypeEC:
self = .ellipticCurve
default:
fatalError()
}
}
}