init(_:)
Creates a custom protocol name using the provided unique string.
Declaration
init?(_ string: String)Parameters
- string:
The string to use as the underlying protocol name, which must be equal to or greater than three characters long. The framework converts the string to UTF-8 prior to hashing in the derivation.
Return Value
A new WASharedSecret.ProtocolName, or nil if the provided string is too short.
Discussion
Custom protocols need to specify a string that identifies the protocol that uses the shared secret. The string must be representable as UTF-8, and normalize to the same value when represented as bytes. A best practice is to use ASCII-compatible values to avoid normalization issues. Set the same value on the local and remote devices in order to generate the same shared secret.