AdyenAuthentication SDK 为安全性要求高的用例(如银行、发卡和 PSD2 强客户认证)提供可重用且易于使用的双重身份验证。
该 SDK 可通过 CocoaPods、Carthage、Swift Package Manager 或手动安装方式获取。
pod 'AdyenAuthentication'
添加到您的 Podfile
中。pod install
。github "adyen/adyen-authentication-ios"
添加到您的 Cartfile
中。carthage update
。将动态 XCFramework/Dynamic/AdyenAuthentication.xcframework
拖到您通用目标设置中的 Frameworks, Libraries, and Embedded Content
部分。 出现提示时,选择“需要时复制项目”。
XCFramework/Static/AdyenAuthentication.xcframework
拖到您通用目标设置中的 Frameworks, Libraries, and Embedded Content
部分。AdyenAuthentication.xcframework
未被嵌入。https://github.com/Adyen/adyen-authentication-ios
作为仓库 URL。1.0.0
。有两种配置选项。
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)
let configuration = AuthenticationService.PassKeyConfiguration(
relyingPartyIdentifier: "com.example.com",
displayName: "App name",
consecutiveApprovalCancellationsLimit: Int?
)
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*/)
如果您有功能请求,或发现错误或技术问题,请在此处创建 issue。
如有其他问题,请联系我们的支持团队。
此 SDK 在 Apache License, Version 2.0 下可用。 有关更多信息,请参见 LICENSE 文件。