---
title: "setIdentity(_:)"
framework: networkextension
role: symbol
role_heading: Instance Method
path: "networkextension/nehotspoteapsettings/setidentity(_:)"
---

# setIdentity(_:)

Sets the client identity for EAP authentication.

## Declaration

```swift
func setIdentity(_ identity: SecIdentity) -> Bool
```

## Parameters

- `identity`: The EAP peer identity, a SecIdentityRef object that contains a SecKeyRef object and an associated SecCertificateRef object.

## Return Value

Return Value Returns false if the parameter is not an object of SecIdentityRef type or if the persistent reference is not found in the application’s keychain; otherwise returns true.

## Discussion

Discussion Your app must store SecIdentity in the keychain access group $(Team​Identifier​Prefix)com​.apple​.networkextensionsharing. The OS uses SecItemCopyMatching(_:_:) to obtain a persistent reference to this identity from the application’s keychain and uses it during EAP authentication.

## See Also

### Setting Keychain-based EAP Properties

- [setTrustedServerCertificates(_:)](networkextension/nehotspoteapsettings/settrustedservercertificates(_:).md)
