AlamofireExtension
public struct AlamofireExtension<ExtendedType>
Type that acts as a generic extension point for all AlamofireExtended types.
-
Stores the type or meta-type of any extended type.
Declaration
Swift
public private(set) var type: ExtendedType { get } -
Create an instance from the provided value.
Declaration
Swift
public init(_ type: ExtendedType)Parameters
typeInstance being extended.
-
Alamofire’s default configuration. Same as
URLSessionConfiguration.defaultbut adds Alamofire defaultAccept-Language,Accept-Encoding, andUser-Agentheaders.Declaration
Swift
public static var `default`: URLSessionConfiguration { get } -
.ephemeralconfiguration with Alamofire’s defaultAccept-Language,Accept-Encoding, andUser-Agentheaders.Declaration
Swift
public static var ephemeral: URLSessionConfiguration { get }
-
Returns all valid
cer,crt, anddercertificates in the bundle.Declaration
Swift
public var certificates: [SecCertificate] { get } -
Returns all public keys for the valid certificates in the bundle.
Declaration
Swift
public var publicKeys: [SecKey] { get } -
Returns all pathnames for the resources identified by the provided file extensions.
Declaration
Swift
public func paths(forResourcesOfTypes types: [String]) -> [String]Parameters
typesThe filename extensions locate.
Return Value
All pathnames for the given filename extensions.
-
Evaluates
selfafter applying theSecPolicyvalue provided.Throws
Any
Errorfrom applying theSecPolicyor from evaluation.Declaration
Swift
@available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) public func evaluate(afterApplying policy: SecPolicy) throwsParameters
policyThe
SecPolicyto apply toselfbefore evaluation. -
Attempts to validate
selfusing theSecPolicyprovided and transforming any error produced using the closure passed.Throws
AnyErrorfrom applying thepolicy, or the result oferrorProducerif validation fails.Declaration
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) throwsParameters
policyThe
SecPolicyused to evaluateself.errorProducerThe closure used transform the failed
OSStatusandSecTrustResultType. -
Applies a
SecPolicytoself, throwing if it fails.Throws
An
AFError.serverTrustEvaluationFailedinstance with a.policyApplicationFailedreason.Declaration
Swift
public func apply(policy: SecPolicy) throws -> SecTrustParameters
policyThe
SecPolicy.Return Value
self, with the policy applied. -
Evaluate
self, throwing anErrorif evaluation fails.Throws
AFError.serverTrustEvaluationFailedwith reason.trustValidationFailedand associated error from the underlying evaluation.Declaration
Swift
@available(iOS 12, macOS 10.14, tvOS 12, watchOS 5, *) public func evaluate() throws -
Validate
self, passing any failure values througherrorProducer.Throws
TheErrorproduced by theerrorProducerclosure.Declaration
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) throwsParameters
errorProducerThe closure used to transform the failed
OSStatusandSecTrustResultTypeinto anError. -
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.Declaration
Swift
public func setAnchorCertificates(_ certificates: [SecCertificate]) throwsParameters
certificatesThe
SecCertificates to add to the chain. -
The public keys contained in
self.Declaration
Swift
public var publicKeys: [SecKey] { get } -
The
SecCertificates contained inself.Declaration
Swift
public var certificates: [SecCertificate] { get } -
The
Datavalues for all certificates contained inself.Declaration
Swift
public var certificateData: [Data] { get } -
Validates
selfafter applyingSecPolicy.af.default. This evaluation does not validate the hostname.Throws
AnAFError.serverTrustEvaluationFailedinstance with a.defaultEvaluationFailedreason.Declaration
Swift
public func performDefaultValidation(forHost host: String) throwsParameters
hostThe hostname, used only in the error output if validation fails.
-
Validates
selfafter applyingSecPolicy.af.hostname(host), which performs the default validation as well as hostname validation.Throws
AnAFError.serverTrustEvaluationFailedinstance with a.defaultEvaluationFailedreason.Declaration
Swift
public func performValidation(forHost host: String) throwsParameters
hostThe hostname to use in the validation.
-
Creates a
SecPolicyinstance which will validate server certificates but not require a host name match.Declaration
Swift
public static let `default`: SecPolicy -
Creates a
SecPolicyinstance which will validate server certificates and much match the provided hostname.Declaration
Swift
public static func hostname(_ hostname: String) -> SecPolicyParameters
hostnameThe hostname to validate against.
Return Value
The
SecPolicy. -
Creates a
SecPolicywhich checks the revocation of certificates.Throws
An
AFError.serverTrustEvaluationFailederror with reason.revocationPolicyCreationFailedif the policy cannot be created.Declaration
Swift
public static func revocation(options: RevocationTrustEvaluator.Options) throws -> SecPolicyParameters
optionsThe
RevocationTrustEvaluator.Optionsfor evaluation.Return Value
The
SecPolicy.
-
All
Datavalues for the containedSecCertificates.Declaration
Swift
public var data: [Data] { get } -
All public
SecKeyvalues for the containedSecCertificates.Declaration
Swift
public var publicKeys: [SecKey] { get }
-
The public key for
self, if it can be extracted.Note
On 2020 OSes and newer, only RSA and ECDSA keys are supported.Declaration
Swift
public var publicKey: SecKey? { get }
-
Returns whether
selfiserrSecSuccess.Declaration
Swift
public var isSuccess: Bool { get }
-
Returns whether
selfis.unspecifiedor.proceed.Declaration
Swift
public var isSuccess: Bool { get }
View on GitHub
Install in Dash