Sesame-iOS/Sesame/SymmetricKey+Extensions.swift

22 lines
395 B
Swift
Raw Normal View History

2022-01-29 18:59:42 +01:00
import Foundation
import CryptoKit
extension SymmetricKey {
var data: Data {
withUnsafeBytes { Data(Array($0)) }
}
var base64: String {
data.base64EncodedString()
}
var codeString: String {
" {" +
withUnsafeBytes {
return Data(Array($0))
}.map(String.init).joined(separator: ", ") +
"},"
}
}