---
title: "keyWillRotate(for:newKey:loginManager:completion:)"
framework: authenticationservices
role: symbol
role_heading: Instance Method
path: "authenticationservices/asauthorizationproviderextensionregistrationhandler/keywillrotate(for:newkey:loginmanager:completion:)"
---

# keyWillRotate(for:newKey:loginManager:completion:)

## Declaration

```swift
optional func keyWillRotate(for keyType: ASAuthorizationProviderExtensionKeyType, newKey: SecKey, loginManager: ASAuthorizationProviderExtensionLoginManager, completion: @escaping @Sendable (Bool) -> Void)
```

```swift
optional func keyWillRotate(for keyType: ASAuthorizationProviderExtensionKeyType, newKey: SecKey, loginManager: ASAuthorizationProviderExtensionLoginManager) async -> Bool
```

## Discussion

Discussion The specified keyType will rotate to a new key. The rotation is complete when the completion handler is called.  This is only called by the system for automatic key rotation.
