seal(_:using:nonce:)
Secures the given plaintext message with encryption and an authentication tag.
- iOS
- 13+
- macOS
- 10.15+
- tvOS
- 13+
- watchOS
- 6+
static func seal<Plaintext>(_ message: Plaintext, using key: SymmetricKey, nonce: Nonce? = nil) throws -> SealedBox where Plaintext : DataProtocol
Parameters
- message
The plaintext data to seal.
- key
A cryptographic key used to seal the message.
- nonce
The nonce the sealing process requires. If you don’t provide a nonce, the method generates a random one by invoking
ChaChaPoly.Nonce
.
Returns
The sealed message.