WASharedSecret
A high-entropy shared secret unique to this network connection.
Declaration
struct WASharedSecretDiscussion
Use a WASharedSecret to pair and set up security for higher layer network protocols such as TLS, QUIC, or IPSec without requiring manual action or data entry by someone using these capabilities. The framework can use the shared secret to authenticate a password authenticated key agreement (PAKE) like SPAKE2, which it then uses to pair and derive long-term asymmetric keys for authentication and encryption of the upper-layer network protocol.
Both sides of a connection derive the same shared secret value if the same connection and input parameters are used:
Your app and a remote app can derive the same shared secret value by calling the deriveSharedSecret(for:method:context:) function on the same connection, with the same parameters.
Devices and accessories can derive the same value as your app by using the derivation specified in the Wi-Fi Aware 5.0 standard, and providing the same parameters your app uses.
The following example shows how to generate a shared secret:
let secret = await connection.wifiAware?.deriveSharedSecret(for: .tlsPSK, method: .kdfHash256)