---
title: invalidKey
framework: DeviceCheck
role: symbol
role_heading: Type Property
platforms: [iOS 11.0+, iPadOS 11.0+, Mac Catalyst 13.1+, macOS 10.15+, tvOS 11.0+, visionOS 1.0+, watchOS 9.0+]
path: devicecheck/dcerror-swift.struct/invalidkey
---

# invalidKey

An error caused by a failed attempt to use the App Attest key.

## Declaration

```swift
static var invalidKey: DCError.Code { get }
```

## Discussion

Discussion You receive this error if something goes wrong with generating, retrieving, or using an App Attest cryptographic key, when: You call attestKey(_:clientDataHash:completionHandler:) for a key that’s already been attested. You call generateAssertion(_:clientDataHash:completionHandler:) with an unattested key. The App Attest service rejects the key.

## See Also

### Errors

- [featureUnsupported](devicecheck/dcerror-swift.struct/featureunsupported.md)
- [invalidInput](devicecheck/dcerror-swift.struct/invalidinput.md)
- [serverUnavailable](devicecheck/dcerror-swift.struct/serverunavailable.md)
- [unknownSystemFailure](devicecheck/dcerror-swift.struct/unknownsystemfailure.md)
- [DCError.Code](devicecheck/dcerror-swift.struct/code.md)
