22 lines
395 B
Swift
22 lines
395 B
Swift
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: ", ") +
|
|
"},"
|
|
}
|
|
}
|