<!--
{
  "availability" : [
    "iOS: 26.4.0 -",
    "iPadOS: 26.4.0 -",
    "macCatalyst: 26.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "WiFiAware",
  "identifier" : "/documentation/WiFiAware/WASharedSecret/Context/init(_:)-74fai",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Wi-Fi Aware"
    ],
    "preciseIdentifier" : "s:9WiFiAware14WASharedSecretV7ContextVyAESg10Foundation4DataVcfc"
  },
  "title" : "init(_:)"
}
-->

# init(_:)

Creates a new custom context that provides unique data.

```
init?(_ data: Data)
```

## Parameters

`data`

The data to use as the underlying context, which must be greater than or equal to `3` bytes long.

## Return Value

A new `Context`, or `nil` if the provided string was too short.

## Discussion

Custom contexts may use any data. Set the same byte value on the local and remote devices in order to generate the same shared secret.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)