AdyenAuthentication 3.0.0

AdyenAuthentication 3.0.0

mohamedeRobert维护。



  • Adyen

AdyenAuthentication iOS SDK

AdyenAuthentication SDK为敏感用例如银行、发行以及PSD2强客户认证提供可重用且易于使用的双因素认证。

安装

SDK可通过CocoaPodsCarthageSwift包管理器或手动安装方式获取。

CocoaPods

  1. 在您的Podfile中添加pod 'AdyenAuthentication'
  2. 运行pod install

Carthage

  1. 在您的Cartfile中添加github "adyen/adyen-authentication-ios"
  2. 运行carthage update
  3. 参照Carthage Readme中描述的方法,将框架链接到您的目标。

动态xcFramework

将动态的XCFramework/Dynamic/AdyenAuthentication.xcframework拖到您的总目标设置中的“框架、库和嵌入内容”部分。当被询问时,选择“如果有必要则复制项目”。

静态xcFramework

  1. 将静态的XCFramework/Static/AdyenAuthentication.xcframework拖到您的总目标设置中的“框架、库和嵌入内容”部分。
  2. 请确保静态的AdyenAuthentication.xcframework没有被嵌入。

Swift包管理器

  1. 按照Apple的将包依赖添加到您的应用指南添加Swift包依赖。
  2. 使用https://github.com/Adyen/adyen-authentication-ios作为仓库URL。
  3. 指定版本至少为1.0.0

使用方法

初始化

有两种配置选项。

  1. 使用设备检查API
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 =  AuthenticationService(configuration: configuration)
  1. 使用Apple Passkey
let configuration = AuthenticationService.PassKeyConfiguration(
                    relyingPartyIdentifier: "com.example.com",
                    displayName: "App name"
                )
self.authenticationService = AuthenticationService(configuration: configuration)

检查设备支持

let deviceSupport: String = try authenticationService.checkSupport()

如果当前设备不支持,此调用将引发错误,否则返回一个需要根据用例发送到后端API的不可见字符串有效负载。

检查设备是否已注册

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*/)

首次注册

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*/)

进行认证

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*/)

支持

如果您有功能请求,或者发现了bug或技术问题,请在此创建问题

对于其他问题,请联系我们的支持团队

另见

许可

此SDK可在Apache许可,版本2.0下使用。更多信息,请参阅LICENSE文件。