AlamofireExtension

public struct AlamofireExtension<ExtendedType>

Type that acts as a generic extension point for all AlamofireExtended types.

  • Returns all valid cer, crt, and der certificates in the bundle.

    Declaration

    Swift

    var certificates: [SecCertificate] { get }
  • Returns all public keys for the valid certificates in the bundle.

    Declaration

    Swift

    var publicKeys: [SecKey] { get }
  • Returns all pathnames for the resources identified by the provided file extensions.

    Declaration

    Swift

    func paths(forResourcesOfTypes types: [String]) -> [String]

    Parameters

    types

    The filename extensions locate.

    Return Value

    All pathnames for the given filename extensions.

  • Evaluates self after applying the SecPolicy value provided.

    Throws

    Any Error from applying the SecPolicy or from evaluation.

    Declaration

    Swift

    @available(iOS 12, OSX 10.14, tvOS 12, watchOS 5, *)
    func evaluate(afterApplying policy: SecPolicy) throws

    Parameters

    policy

    The SecPolicy to apply to self before evaluation.

  • 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.

    Declaration

    Swift

    @available(iOS, introduced: 10, deprecated: 12, renamed: "evaluate(afterApplying:﹚")
    @available(OSX, 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:﹚")
    func validate(policy: SecPolicy, errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws

    Parameters

    policy

    The SecPolicy used to evaluate self.

    errorProducer

    The closure used transform the failed OSStatus and SecTrustResultType.

  • Applies a SecPolicy to self, throwing if it fails.

    Throws

    An AFError.serverTrustEvaluationFailed instance with a .policyApplicationFailed reason.

    Declaration

    Swift

    func apply(policy: SecPolicy) throws -> SecTrust

    Parameters

    policy

    The SecPolicy.

    Return Value

    self, with the policy applied.

  • Evaluate self, throwing an Error if evaluation fails.

    Throws

    AFError.serverTrustEvaluationFailed with reason .trustValidationFailed and associated error from the underlying evaluation.

    Declaration

    Swift

    @available(iOS 12, OSX 10.14, tvOS 12, watchOS 5, *)
    func evaluate() throws
  • Validate self, passing any failure values through errorProducer.

    Throws

    The Error produced by the errorProducer closure.

    Declaration

    Swift

    @available(iOS, introduced: 10, deprecated: 12, renamed: "evaluate(﹚")
    @available(OSX, introduced: 10.12, deprecated: 10.14, renamed: "evaluate(﹚")
    @available(tvOS, introduced: 10, deprecated: 12, renamed: "evaluate(﹚")
    @available(watchOS, introduced: 3, deprecated: 5, renamed: "evaluate(﹚")
    func validate(errorProducer: (_ status: OSStatus, _ result: SecTrustResultType) -> Error) throws

    Parameters

    errorProducer

    The closure used to transform the failed OSStatus and SecTrustResultType into an Error.

  • 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

    func setAnchorCertificates(_ certificates: [SecCertificate]) throws

    Parameters

    certificates

    The SecCertificates to add to the chain.

  • The public keys contained in self.

    Declaration

    Swift

    var publicKeys: [SecKey] { get }
  • The SecCertificates contained i self.

    Declaration

    Swift

    var certificates: [SecCertificate] { get }
  • The Data values for all certificates contained in self.

    Declaration

    Swift

    var certificateData: [Data] { get }
  • Validates self after applying SecPolicy.af.default. This evaluation does not validate the hostname.

    Throws

    An AFError.serverTrustEvaluationFailed instance with a .defaultEvaluationFailed reason.

    Declaration

    Swift

    func performDefaultValidation(forHost host: String) throws

    Parameters

    host

    The hostname, used only in the error output if validation fails.

  • 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.

    Declaration

    Swift

    func performValidation(forHost host: String) throws

    Parameters

    host

    The hostname to use in the validation.

  • Creates a SecPolicy instance which will validate server certificates but not require a host name match.

    Declaration

    Swift

    static let `default`: SecPolicy
  • Creates a SecPolicy instance which will validate server certificates and much match the provided hostname.

    Declaration

    Swift

    static func hostname(_ hostname: String) -> SecPolicy

    Parameters

    hostname

    The hostname to validate against.

    Return Value

    The SecPolicy.

  • Creates a SecPolicy which checks the revocation of certificates.

    Throws

    An AFError.serverTrustEvaluationFailed error with reason .revocationPolicyCreationFailed if the policy cannot be created.

    Declaration

    Swift

    static func revocation(options: RevocationTrustEvaluator.Options) throws -> SecPolicy

    Parameters

    options

    The RevocationTrustEvaluator.Options for evaluation.

    Return Value

    The SecPolicy.

  • All Data values for the contained SecCertificates.

    Declaration

    Swift

    var data: [Data] { get }
  • All public SecKey values for the contained SecCertificates.

    Declaration

    Swift

    var publicKeys: [SecKey] { get }
  • The public key for self, if it can be extracted.

    Declaration

    Swift

    var publicKey: SecKey? { get }
  • Returns whether self is errSecSuccess.

    Declaration

    Swift

    var isSuccess: Bool { get }
  • Returns whether self is.unspecifiedor.proceed`.

    Declaration

    Swift

    var isSuccess: Bool { get }
  • Alamofire’s default configuration. Same as URLSessionConfiguration.default but adds Alamofire default Accept-Language, Accept-Encoding, and User-Agent headers.

    Declaration

    Swift

    public static var `default`: URLSessionConfiguration { get }