---
title: "sharedSecretFromKeyAgreement(with:)"
framework: cryptokit
role: symbol
role_heading: Instance Method
path: "cryptokit/secureenclave/p256/keyagreement/privatekey/sharedsecretfromkeyagreement(with:)"
---

# sharedSecretFromKeyAgreement(with:)

Computes a shared secret with the provided public key from another party.

## Declaration

```swift
func sharedSecretFromKeyAgreement(with publicKeyShare: P256.KeyAgreement.PublicKey) throws -> SharedSecret
```

## Parameters

- `publicKeyShare`: The public key from another party to be combined with the private key from this user to create the shared secret.

## Return Value

Return Value The computed shared secret.

## See Also

### Creating a shared secret

- [SharedSecret](cryptokit/sharedsecret.md)
