AdyenAuthentication SDK Provides reusable and easy to use two factor authentication for security sensitive use cases like banking, issuing and PSD2 strong customer authentication.
The SDK is available via CocoaPods, Carthage, Swift Package Manager or via manual installation.
pod 'AdyenAuthentication'
to your Podfile
.pod install
.github "adyen/adyen-authentication-ios"
to your Cartfile
.carthage update
.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.
XCFramework/Static/AdyenAuthentication.xcframework
to the Frameworks, Libraries, and Embedded Content
section in your general target settings.AdyenAuthentication.xcframework
is not embedded.https://github.com/Adyen/adyen-authentication-ios
as the repository 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.
appleTeamIdendtifier: // The Apple registered development team identifier.)
self.authenticationService = try? AuthenticationService(configuration: configuration)
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.
let input = RegistrationInput(serverChallenge: /// Server Challenge)
authenticationService.register(withInput: input) { [weak self] result in
switch result {
case let .success(output):
/// output is a `RegistrationOutput`, the `RegistrationOutput.attestationObject` should be sent to a FIDO compliant backend to be validated.
case let .failure(error):
/// Error raised, for example if the device is not protected by either pass code, face Id, or fingerprint.
}
}
// or
let input: String = /// `RegistrationInput` as Base64 URL String
authenticationService.register(withBase64URLString: input) { [weak self] result in
switch result {
case let .success(output):
/// output is a Base64 URL String should be sent to a FIDO compliant backend to be validated.
case let .failure(error):
/// Error raised, for example if the device is not protected by either pass code, face Id, or fingerprint.
}
}
You can also use the async version of this function:
do {
let input = RegistrationInput(serverChallenge: /// Server Challenge)
async let output = try await authenticationService.register(with: input)
/// output is a `RegistrationOutput`, the `RegistrationOutput.attestationObject` should be sent to a FIDO compliant backend to be validated.
} catch {
/// Error raised, for example if the device is not protected by either pass code, face Id, or fingerprint.
}
// or
do {
let input: String = /// `RegistrationInput` as Base64 URL String
async let output = try await authenticationService.register(withBase64URLString: input)
/// output is a Base64 URL String should be sent to a FIDO compliant backend to be validated.
} catch {
/// Error raised, for example if the device is not protected by either pass code, face Id, or fingerprint.
}
let input = AuthenticationInput(candidateCredentialIdentifiers: /// credentials list obtained from a FIDO compliant backend tied to the current account/device,
serverChallenge: /// Server challenge in the form of opaque binary data)
authenticationService.authenticate(withInput: input) { result in
switch result {
case let .success(output):
/// Authentication went through, then the `AuthenticationOutput.assertionObject` and `AuthenticationOutput.resolvedCredentialIdentifier` should be sent back to a `FIDO` compliant server to validate them both.
case let .failure(error):
/// Failure to authenticate, which usually means that the current account is not registered (i.e non of the store credentials match the `AuthenticationInput.candidateCredentialIdentifiers`).
}
}
// or
let input: String = /// `AuthenticationInput` as Base64 URL String
authenticationService.authenticate(withBase64URLString: input) { result in
switch result {
case let .success(output):
/// Authentication went through, then the `output` - which is Base64 URL String - should be sent back to a `FIDO` compliant server to validate them both.
case let .failure(error):
/// Failure to authenticate, which usually means that the current account is not registered (i.e non of the store credentials match the `AuthenticationInput.candidateCredentialIdentifiers`).
}
}
You can also use the async version of this function:
do {
let input = AuthenticationInput(candidateCredentialIdentifiers: /// credentials list obtained from a FIDO compliant backend tied to the current account/device,
serverChallenge: /// Server challenge in the form of opaque binary data)
async let output = try await authenticationService.authenticate(with: input)
/// Authentication went through, then the `AuthenticationOutput.assertionObject` and `AuthenticationOutput.resolvedCredentialIdentifier` should be sent back to a `FIDO` compliant server to validate them both.
} catch {
/// Failure to authenticate, which usually means that the current account is not registered (i.e non of the store credentials match the `AuthenticationInput.candidateCredentialIdentifiers`).
}
// or
do {
let input: String = /// `AuthenticationInput` as Base64 URL String
async let output = try await authenticationService.authenticate(withBase64URLString: input)
/// Authentication went through, then the `output` - which is Base64 URL String - should be sent back to a `FIDO` compliant server to validate them both.
} catch {
/// Failure to authenticate, which usually means that the current account is not registered (i.e non of the store credentials match the `AuthenticationInput.candidateCredentialIdentifiers`).
}
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.
This SDK is available under the Apache License, Version 2.0. For more information, see the LICENSE file.
link |
Stars: 3 |
Last commit: 1 week ago |
AdyenAuthenticationError.unknown
is thrown if the user try to authenticate while the device is not registered, and now a proper AdyenAuthenticationError.noStoredCredentialsMatch
.Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics