@MainActor func oneTimeCodes(preferredDuration: TimeInterval) async throws -> some AsyncSequence<ASVerificationCode, any Error>
Stream one-time codes received by the system.
When requested, the user may decide whether your app may receive one-time codes.
This stream will automatically disconnect after a period of time.
- Parameters:
- preferredDuration: How long the stream should ideally remain connected. This duration is not guaranteed.
- Throws: `DeliveredVerificationCodesManager.VerificationError` if one-time codes can not be delivered.
- Note: Only enabled credential providers may call this method.
Mark a one-time code as "consumed" by the current process.
A code should only be marked as consumed if it was submitted to a service for the purposes of authentication.
Consuming a code will mark a code's containing message as read in the Messages and Mail apps.
Depending on the user's preference, this may also delete the code's containing message.
- Parameters:
- oneTimeCode: The code to mark as consumed.
- Throws: `DeliveredVerificationCodesManager.VerificationError` if the system failed to accept the update.
- Note: Only consume codes that you submit to a service. You should make a best effort to ensure it is accepted before calling this.