AdyenAuthentication SDK为敏感用例如银行、发行以及PSD2强客户认证提供可重用且易于使用的双因素认证。
SDK可通过CocoaPods、Carthage、Swift包管理器或手动安装方式获取。
- 在您的Podfile中添加
pod 'AdyenAuthentication'
。 - 运行
pod install
。
- 在您的
Cartfile
中添加github "adyen/adyen-authentication-ios"
。 - 运行
carthage update
。 - 参照Carthage Readme中描述的方法,将框架链接到您的目标。
将动态的XCFramework/Dynamic/AdyenAuthentication.xcframework
拖到您的总目标设置中的“框架、库和嵌入内容”部分。当被询问时,选择“如果有必要则复制项目”。
- 将静态的
XCFramework/Static/AdyenAuthentication.xcframework
拖到您的总目标设置中的“框架、库和嵌入内容”部分。 - 请确保静态的
AdyenAuthentication.xcframework
没有被嵌入。
- 按照Apple的将包依赖添加到您的应用指南添加Swift包依赖。
- 使用
https://github.com/Adyen/adyen-authentication-ios
作为仓库URL。 - 指定版本至少为
1.0.0
。
有两种配置选项。
- 使用设备检查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)
- 使用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文件。