27 lines
415 B
Swift
27 lines
415 B
Swift
import Foundation
|
|
import NIOCore
|
|
|
|
#if canImport(CryptoKit)
|
|
import CryptoKit
|
|
#else
|
|
import Crypto
|
|
#endif
|
|
|
|
struct ServerMessage {
|
|
|
|
static let authTokenSize = SHA256.byteCount
|
|
|
|
let authToken: Data
|
|
|
|
let message: Message
|
|
|
|
init(authToken: Data, message: Message) {
|
|
self.authToken = authToken
|
|
self.message = message
|
|
}
|
|
|
|
var encoded: Data {
|
|
authToken + message.encoded
|
|
}
|
|
}
|