<!--
{
  "availability" : [
    "iOS: 15.4.0 -",
    "iPadOS: 15.4.0 -",
    "macCatalyst: 15.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "StoreKitTest",
  "identifier" : "/documentation/StoreKitTest/SKAdTestSession/validate(_:publicKey:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "StoreKit Test"
    ],
    "preciseIdentifier" : "c:objc(cs)SKAdTestSession(im)validateImpression:publicKey:error:"
  },
  "title" : "validate(_:publicKey:)"
}
-->

# validate(_:publicKey:)

Validates an impression for a view-through ad.

```
func validate(_ impression: SKAdImpression, publicKey: String) throws
```

## Parameters

`impression`

An <doc://com.apple.documentation/documentation/StoreKit/SKAdImpression> instance, representing your ad impression.

`publicKey`

The public key of the elliptic curve cryptographic key pair you used to generate the signature for the ad impression.

## Discussion

The cryptographic key pair you use for testing may be a different key pair than you use in production. For testing, use keys from the same key pair to sign the ad impression for testing and call [`validate(_:publicKey:)`](/documentation/StoreKitTest/SKAdTestSession/validate(_:publicKey:)).

For more information about signing ad impressions, see <doc://com.apple.documentation/documentation/StoreKit/signing-and-providing-ads>.

---

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)