<!--
{
  "availability" : [
    "iOS: 10.0.0 -",
    "iPadOS: 10.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.12.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoTokenKit",
  "identifier" : "/documentation/CryptoTokenKit/TKTokenSessionDelegate/tokenSession(_:performKeyExchange:keyObjectID:algorithm:parameters:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CryptoTokenKit"
    ],
    "preciseIdentifier" : "c:objc(pl)TKTokenSessionDelegate(im)tokenSession:performKeyExchangeWithPublicKey:usingKey:algorithm:parameters:error:"
  },
  "title" : "tokenSession(_:performKeyExchange:keyObjectID:algorithm:parameters:)"
}
-->

# tokenSession(_:performKeyExchange:keyObjectID:algorithm:parameters:)

Tells the delegate to perform a key exchange using the specified key and algorithm.

```
optional func tokenSession(_ session: TKTokenSession, performKeyExchange otherPartyPublicKeyData: Data, keyObjectID objectID: TKToken.ObjectID, algorithm: TKTokenKeyAlgorithm, parameters: TKTokenKeyExchangeParameters) throws -> Data
```

## Parameters

`session`

The token session.

`otherPartyPublicKeyData`

The public key of the other party.

`objectID`

The identifier of the private key object.

`algorithm`

The algorithm to be used for key exchange.

`parameters`

Additional parameters used by `algorithm` to perform the key exchange.

## Return Value

The result of the key exchange, or `nil` if an error occurred.

---

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)