New
16extension
ASDeliveredVerificationCodesManager.VerificationError
NewiOSmacOSextension ASDeliveredVerificationCodesManager.VerificationError
Declaration
extension ASDeliveredVerificationCodesManager.VerificationError {
public static var failed: ASDeliveredVerificationCodesManager.VerificationError.Code { get }
public static var userPermissionDenied: ASDeliveredVerificationCodesManager.VerificationError.Code { get }
public static var appIsNotEnabledCredentialProvider: ASDeliveredVerificationCodesManager.VerificationError.Code { get }
}
extension
ASDeliveredVerificationCodesManager.VerificationError.Code
NewiOSmacOSextension ASDeliveredVerificationCodesManager.VerificationError.Code : RawRepresentable
Declaration
extension ASDeliveredVerificationCodesManager.VerificationError.Code : RawRepresentable {
}
struct
ASVerificationCode
NewiOSmacOSpublic struct ASVerificationCode : Sendable, Equatable, Identifiable, Codable
This is an instance of a verification code.
It represents a code at a specific point in time.
Declaration
public struct ASVerificationCode : Sendable, Equatable, Identifiable, Codable {
/// The stable identity of the entity associated with this instance.
public var id: UUID
/// The system’s best understanding of the code that can be used for verification purposes.
///
/// This code may be detected from heuristics or parsed from a well-known format.
public var code: String
/// Date when the message was received by the device.
public var timestamp: Date
/// The domain associated with the code, if one exists.
/// - SeeAlso: https://github.com/WICG/sms-one-time-codes
public var domain: String?
/// Embedded page or frame domains. For domain-bound codes, this array contains all the domains specified after the code field.
/// - SeeAlso: https://github.com/WICG/sms-one-time-codes
public var embeddedDomains: [String]
public init(code: String, timestamp: Date, domain: String? = nil, embeddedDomains: [String] = [], id: UUID = UUID())
/// Returns a Boolean value indicating whether two values are equal.
///
/// Equality is the inverse of inequality. For any values `a` and `b`,
/// `a == b` implies that `a != b` is `false`.
///
/// - Parameters:
/// - lhs: A value to compare.
/// - rhs: Another value to compare.
public static func == (a: ASVerificationCode, b: ASVerificationCode) -> Bool
/// A type representing the stable identity of the entity associated with
/// an instance.
@available(macOS 27.0, iOS 27.0, *)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
public typealias ID = UUID
/// Encodes this value into the given encoder.
///
/// If the value fails to encode anything, `encoder` will encode an empty
/// keyed container in its place.
///
/// This function throws an error if any values are invalid for the given
/// encoder's format.
///
/// - Parameter encoder: The encoder to write data to.
public func encode(to encoder: any Encoder) throws
/// Creates a new instance by decoding from the given decoder.
///
/// This initializer throws an error if reading from the decoder fails, or
/// if the data read is corrupted or otherwise invalid.
///
/// - Parameter decoder: The decoder to read data from.
public init(from decoder: any Decoder) throws
}
var
authorizationURL
NewmacOSopen var authorizationURL: URL
var
authorizationURLKeypath
NewmacOSopen var authorizationURLKeypath: String
struct
DeliveredVerificationCodesManager
NewiOSmacOSpublic struct DeliveredVerificationCodesManager
Declaration
@MainActor public struct DeliveredVerificationCodesManager {
public typealias VerificationError = ASDeliveredVerificationCodesManager.VerificationError
/// 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 and defaults to 10 minutes.
/// - Throws: `DeliveredVerificationCodesManager.VerificationError` if one-time codes can not be delivered.
/// - Note: Only enabled credential providers may call this method.
@MainActor public func oneTimeCodes(preferredDuration: TimeInterval = 600) async throws -> some AsyncSequence<ASVerificationCode, any Error>
/// 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.
@MainActor public func consumeOneTimeCode(_ oneTimeCode: ASVerificationCode) async throws
}
extension
DeliveredVerificationCodesManager
NewiOSmacOSextension DeliveredVerificationCodesManager : Sendable
Declaration
extension DeliveredVerificationCodesManager : Sendable {
}
var
fallbackFederationType
NewmacOSopen var fallbackFederationType: ASAuthorizationProviderExtensionLoginConfiguration.FederationType
case
ASAuthorizationProviderExtensionAuthenticationMethod.openID
NewmacOScase openID = 5
case
ASAuthorizationProviderExtensionLoginConfiguration.FederationType.dynamicOpenID
NewmacOScase dynamicOpenID = 4
case
ASAuthorizationProviderExtensionLoginConfiguration.FederationType.openID
NewmacOScase openID = 3
var
ASAuthorizationProviderExtensionSupportedGrantTypes.tokenExchange
NewmacOSpublic static var tokenExchange: ASAuthorizationProviderExtensionSupportedGrantTypes { get }
struct
ASDeliveredVerificationCodesManager.VerificationError
NewiOSmacOSpublic struct VerificationError : CustomNSError
Declaration
public struct VerificationError : CustomNSError {
public enum Code : Int, Hashable, Sendable {
case failed
/// This error signals that the user had denied the requested operation.
case userPermissionDenied
/// This error signals that the app is not actively enabled as a credential provider.
case appIsNotEnabledCredentialProvider
public static func ~= (pattern: ASDeliveredVerificationCodesManager.VerificationError.Code, value: any Error) -> Bool
/// Creates a new instance with the specified raw value.
///
/// If there is no value of the type that corresponds with the specified raw
/// value, this initializer returns `nil`. For example:
///
/// enum PaperSize: String {
/// case A4, A5, Letter, Legal
/// }
///
/// print(PaperSize(rawValue: "Legal"))
/// // Prints "Optional(PaperSize.Legal)"
///
/// print(PaperSize(rawValue: "Tabloid"))
/// // Prints "nil"
///
/// - Parameter rawValue: The raw value to use for the new instance.
public init?(rawValue: Int)
/// The raw type that can be used to represent all values of the conforming
/// type.
///
/// Every distinct value of the conforming type has a corresponding unique
/// value of the `RawValue` type, but there may be values of the `RawValue`
/// type that don't have a corresponding value of the conforming type.
@available(macOS 27.0, iOS 27.0, *)
@available(tvOS, unavailable)
@available(watchOS, unavailable)
public typealias RawValue = Int
/// The corresponding value of the raw type.
///
/// A new instance initialized with `rawValue` will be equivalent to this
/// instance. For example:
///
/// enum PaperSize: String {
/// case A4, A5, Letter, Legal
/// }
///
/// let selectedSize = PaperSize.Letter
/// print(selectedSize.rawValue)
/// // Prints "Letter"
///
/// print(selectedSize == PaperSize(rawValue: selectedSize.rawValue)!)
/// // Prints "true"
public var rawValue: Int { get }
}
/// The domain of the error.
public static var errorDomain: String { get }
/// The error code within the given domain.
public var errorCode: Int { get }
public let code: ASDeliveredVerificationCodesManager.VerificationError.Code
/// The user-info dictionary.
public let errorUserInfo: [String : Any]
public init(_ code: ASDeliveredVerificationCodesManager.VerificationError.Code, userInfo: [String : Any] = [:])
}
typealias
ASDeliveredVerificationCodesManager.VerificationError.Code.RawValue
NewiOSmacOSpublic typealias RawValue = Int
The raw type that can be used to represent all values of the conforming type.
Every distinct value of the conforming type has a corresponding unique value of the RawValue type, but there may be values of the RawValue type that don't have a corresponding value of the conforming type.
typealias
ASVerificationCode.ID
NewiOSmacOSpublic typealias ID = UUID
A type representing the stable identity of the entity associated with an instance.
var
EnvironmentValues.deliveredVerificationCodesManager
NewiOSmacOSpublic var deliveredVerificationCodesManager: DeliveredVerificationCodesManager { get }
This environment variable is for SwiftUI clients of the ASDeliveredVerificationCodesManager API. An example usage might look like:
struct DeliveredVerificationCodesManagerExample: View {
@Environment(\.deliveredVerificationCodesManager) private var deliveredVerificationCodesManager
var body: some View {
Button("Listen for Codes") {
Task {
do {
let codes = try deliveredVerificationCodesManager.oneTimeCodes()
for try await code in codes {
handle(code: code)
}
} catch DeliveredVerificationCodesManager.VerificationError.userPermissionDenied {
// Explaining why OTCs are needed or try without codes
} catch DeliveredVerificationCodesManager.VerificationError.appIsNotEnabledCredentialProvider {
// Show UI explaining how to turn on the app as a Password Manager
} catch {
// code to handle the save error
}
}
}
}
}
No APIs match your filter.