Swiftpack.co - Adyen/adyen-authentication-ios as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by Adyen.
Adyen/adyen-authentication-ios 2.0.0
AdyenAuthentication SDK Provides reusable and easy to use two factor authentication for security sensitive use cases like banking, issuing and PSD2 strong customer authentication.
⭐️ 3
🕓 50 weeks ago
iOS macOS
.package(url: "https://github.com/Adyen/adyen-authentication-ios.git", from: "2.0.0")

AdyenAuthentication iOS SDK

AdyenAuthentication SDK Provides reusable and easy to use two factor authentication for security sensitive use cases like banking, issuing and PSD2 strong customer authentication.

Installation

The SDK is available via CocoaPods, Carthage, Swift Package Manager or via manual installation.

CocoaPods

  1. Add pod 'AdyenAuthentication' to your Podfile.
  2. Run pod install.

Carthage

  1. Add github "adyen/adyen-authentication-ios" to your Cartfile.
  2. Run carthage update.
  3. Link the framework with your target as described in Carthage Readme.

Dynamic xcFramework

Drag the dynamic XCFramework/Dynamic/AdyenAuthentication.xcframework to the Frameworks, Libraries, and Embedded Content section in your general target settings. Select "Copy items if needed" when asked.

Static xcFramework

  1. Drag the static XCFramework/Static/AdyenAuthentication.xcframework to the Frameworks, Libraries, and Embedded Content section in your general target settings.
  2. Make sure the static AdyenAuthentication.xcframework is not embedded.

Swift Package Manager

  1. Follow Apple's [Adding Package Dependencies to Your App](https://raw.github.com/Adyen/adyen-authentication-ios/main/ https://developer.apple.com/documentation/xcode/adding_package_dependencies_to_your_app ) guide on how to add a Swift Package dependency.
  2. Use https://github.com/Adyen/adyen-authentication-ios as the repository URL.
  3. Specify the version to be at least 1.0.0.

Usage

Initialization

let configuration = AuthenticationService.Configuration(localizedRegistrationReason: // Text explaining to the user why we need their biometrics while registration,
                                                        localizedAuthenticationReason: // Text explaining to the user why we need their biometrics while authentication.
                                                        appleTeamIdentifier: // The Apple registered development team identifier.)
self.authenticationService = try? AuthenticationService(configuration: configuration)

Check Device support

let deviceSupport: String = try authenticationService.checkSupport()

This call will throw an error in case the current device is not supported, otherwise returns an opaque string payload that needs to be sent to backend API depending on the use case.

Check whether Device is registered

authenticationService.isDeviceRegistered(withAuthenticationInput: input /*The opaque string sdk input*/) { [weak self] result in
    switch result {
    case let .success(isRegistered):
        /// output is a Boolean indicating whether the current device is registered,
        /// then you can call `authenticate` function below.
    case let .failure(error):
        /// Error raised,
        /// for example if the device is not protected by either pass code, face Id, or fingerprint, or if device is not registered,
        /// then you can call `register` function below.
    }
}

// OR you can also use the async version of this function:

let isDeviceRegistered = try await authenticationService.isDeviceRegistered(withAuthenticationInput: input /*The opaque string sdk input*/)

For first time registration:

authenticationService.register(withRegistrationInput: input /*The opaque string sdk input*/) { [weak self] result in
    switch result {
    case let .success(output):
        /// output is an opaque string that should be sent to Adyen backend API (depending on the use case) to be validated for registration to be finalized.
    case let .failure(error):
        /// Failure to register the device, for example if the device is not protected by either pass code, face Id, or fingerprint.
    }
}

// OR you can also use the async version of this function:

let sdkOutput = try await authenticationService.register(withRegistrationInput: input /*The opaque string sdk input*/)

For authentication:

authenticationService.authenticate(withAuthenticationInput: input /*The opaque string sdk input*/) { result in
    switch result {
    case let .success(output):
        /// output is an opaque string that should be sent to Adyen backend API (depending on the use case) to be validated for authentication to be finalized.
    case let .failure(error):
        /// Failure to authenticate, which usually means that the current account is not registered.
    }
}

// OR you can also use the async version of this function:

let sdkOutput = try await authenticationService.authenticate(withAuthenticationInput: input /*The opaque string sdk input*/)

Support

If you have a feature request, or spotted a bug or a technical problem, create an issue here.

For other questions, contact our support team.

See also

License

This SDK is available under the Apache License, Version 2.0. For more information, see the LICENSE file.

GitHub

link
Stars: 3
Last commit: 17 weeks ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Release Notes

2.0.0
50 weeks ago

New

- Public function to check for device registration without invoking the biometric.

authenticationService.isDeviceRegistered(withAuthenticationInput: input /*The opaque string sdk input*/) { [weak self] result in
    switch result {
    case let .success(isRegistered):
        /// output is a Boolean indicating whether the current device is registered,
        /// then you can call `authenticate` function below.
    case let .failure(error):
        /// Error raised,
        /// for example if the device is not protected by either pass code, face Id, or fingerprint, or if device is not registered,
        /// then you can call `register` function below.
    }
}

// OR you can also use the async version of this function:

let isDeviceRegistered = try await authenticationService.isDeviceRegistered(withAuthenticationInput: input /*The opaque string sdk input*/)

Removed

- Unnecessary functions that cluttered the public interface

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics