INNER CODE UNIT · Swift
seal
jedisct1/swift-sodium · Sources/Sodium/Box.swift:223
func seal(message: Bytes, recipientPublicKey: Box.PublicKey) -> Bytes? {
guard recipientPublicKey.count == PublicKeyBytes else { return nil }
var anonymousCipherText = Bytes(count: SealBytes + message.count)
guard crypto_box_seal(
&anonymousCipherText,
message, UInt64(message.count),
recipientPublicKey
).exitCode == .SUCCESS else { return nil }
return anonymousCipherText
}
}
public extension Box {
/**
Decrypts a message with a sender's public key and the recipient's secret key.