docs/docsets/Alamofire.docset/Contents/Resources/Documents/Structs/AlamofireExtension.html
public struct AlamofireExtension<ExtendedType>
Type that acts as a generic extension point for all AlamofireExtended types.
`
type
`
Stores the type or meta-type of any extended type.
Swift
public private(set) var type: ExtendedType { get }
`
init(_:)
`
Create an instance from the provided value.
Swift
public init(_ type: ExtendedType)
| type |
Instance being extended.
|
ExtendedType: URLSessionConfiguration`
default
`
Alamofire’s default configuration. Same as URLSessionConfiguration.default but adds Alamofire default Accept-Language, Accept-Encoding, and User-Agent headers.
Swift
public static var `default`: URLSessionConfiguration { get }
`
ephemeral
`
.ephemeral configuration with Alamofire’s default Accept-Language, Accept-Encoding, and User-Agent headers.
Swift
public static var ephemeral: URLSessionConfiguration { get }
ExtendedType: Bundle`
certificates
`
Returns all valid cer, crt, and der certificates in the bundle.
Swift
public var certificates: [SecCertificate] { get }
`
publicKeys
`
Returns all public keys for the valid certificates in the bundle.
Swift
public var publicKeys: [SecKey] { get }
`
paths(forResourcesOfTypes:)
`
Returns all pathnames for the resources identified by the provided file extensions.
Swift
public func paths(forResourcesOfTypes types: [String]) -> [String]
| types |
The filename extensions locate.
|
All pathnames for the given filename extensions.
ExtendedType == SecTrust`
evaluate(afterApplying:)
`
Evaluates self after applying the SecPolicy value provided.
Throws
Any Error from applying the SecPolicy or from evaluation.
Swift
@available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)
public func evaluate(afterApplying policy: SecPolicy) throws
| policy |
The SecPolicy to apply to self before evaluation.
|
`
validate(policy:errorProducer:)
`
Attempts to validate self using the SecPolicy provided and transforming any error produced using the closure passed.
Throws
Any Error from applying the policy, or the result of errorProducer if validation fails.
Swift
@available(iOS, introduced: 10, deprecated: 12, renamed: "evaluate(afterApplying:﹚")
@available(macOS, introduced: 10.12, deprecated: 10.14, renamed: "evaluate(afterApplying:﹚")
@available(tvOS, introduced: 10, deprecated: 12, renamed: "evaluate(afterApplying:﹚")
@available(watchOS, introduced: 3, deprecated: 5, renamed: "evaluate(afterApplying:﹚")
public func validate(policy: SecPolicy, errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> any Error) throws
| policy |
The SecPolicy used to evaluate self.
|
| errorProducer |
The closure used transform the failed OSStatus and SecTrustResultType.
|
`
apply(policy:)
`
Applies a SecPolicy to self, throwing if it fails.
Throws
An AFError.serverTrustEvaluationFailed instance with a .policyApplicationFailed reason.
Swift
public func apply(policy: SecPolicy) throws -> SecTrust
| policy |
The SecPolicy.
|
self, with the policy applied.
`
evaluate()
`
Evaluate self, throwing an Error if evaluation fails.
Throws
AFError.serverTrustEvaluationFailed with reason .trustValidationFailed and associated error from the underlying evaluation.
Swift
@available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *)
public func evaluate() throws
`
validate(errorProducer:)
`
Validate self, passing any failure values through errorProducer.
Throws
The Error produced by the errorProducer closure.
Swift
@available(iOS, introduced: 10, deprecated: 12, renamed: "evaluate(﹚")
@available(macOS, introduced: 10.12, deprecated: 10.14, renamed: "evaluate(﹚")
@available(tvOS, introduced: 10, deprecated: 12, renamed: "evaluate(﹚")
@available(watchOS, introduced: 3, deprecated: 5, renamed: "evaluate(﹚")
public func validate(errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> any Error) throws
| errorProducer |
The closure used to transform the failed OSStatus and SecTrustResultType into an Error.
|
`
setAnchorCertificates(_:)
`
Sets a custom certificate chain on self, allowing full validation of a self-signed certificate and its chain.
Throws
Any error produced when applying the new certificate chain.
Swift
public func setAnchorCertificates(_ certificates: [SecCertificate]) throws
| certificates |
The SecCertificates to add to the chain.
|
`
publicKeys
`
The public keys contained in self.
Swift
public var publicKeys: [SecKey] { get }
`
certificates
`
The SecCertificates contained in self.
Swift
public var certificates: [SecCertificate] { get }
`
certificateData
`
The Data values for all certificates contained in self.
Swift
public var certificateData: [Data] { get }
`
performDefaultValidation(forHost:)
`
Validates self after applying SecPolicy.af.default. This evaluation does not validate the hostname.
Throws
An AFError.serverTrustEvaluationFailed instance with a .defaultEvaluationFailed reason.
Swift
public func performDefaultValidation(forHost host: String) throws
| host |
The hostname, used only in the error output if validation fails.
|
`
performValidation(forHost:)
`
Validates self after applying SecPolicy.af.hostname(host), which performs the default validation as well as hostname validation.
Throws
An AFError.serverTrustEvaluationFailed instance with a .defaultEvaluationFailed reason.
Swift
public func performValidation(forHost host: String) throws
| host |
The hostname to use in the validation.
|
ExtendedType == SecPolicy`
default
`
Creates a SecPolicy instance which will validate server certificates but not require a host name match.
Swift
public static let `default`: SecPolicy
`
hostname(_:)
`
Creates a SecPolicy instance which will validate server certificates and much match the provided hostname.
Swift
public static func hostname(_ hostname: String) -> SecPolicy
| hostname |
The hostname to validate against.
|
The SecPolicy.
`
revocation(options:)
`
Creates a SecPolicy which checks the revocation of certificates.
Throws
An AFError.serverTrustEvaluationFailed error with reason .revocationPolicyCreationFailed if the policy cannot be created.
Swift
public static func revocation(options: RevocationTrustEvaluator.Options) throws -> SecPolicy
| options |
The RevocationTrustEvaluator.Options for evaluation.
|
The SecPolicy.
ExtendedType == [SecCertificate]`
data
`
All Data values for the contained SecCertificates.
Swift
public var data: [Data] { get }
`
publicKeys
`
All public SecKey values for the contained SecCertificates.
Swift
public var publicKeys: [SecKey] { get }
ExtendedType == SecCertificate`
publicKey
`
The public key for self, if it can be extracted.
Note
On 2020 OSes and newer, only RSA and ECDSA keys are supported.
Swift
public var publicKey: SecKey? { get }
ExtendedType == OSStatus`
isSuccess
`
Returns whether self is errSecSuccess.
Swift
public var isSuccess: Bool { get }
ExtendedType == SecTrustResultType`
isSuccess
`
Returns whether self is .unspecified or .proceed.
Swift
public var isSuccess: Bool { get }