AttestationService
public class AttestationService
This class is responsible for Application attestation and assertion with Apple. It also validates the results with SAP Mobile Services, establishing the legitimacy of an application.
To be able to use this class App Attest
should be supported on the Apple device.
SAP BTP SDK For iOS uses Apple’s DeviceCheck framework to assert the legitimacy of a particular instance of your application to SAP Mobile Services from where administrators can assess the fraud risk and eventually enforce HTTP communication for asserted devices only.
-
init(sapCpmsSettingsParameters:sapUrlSession:store:attestationSettings:maxAppleServerFailureRetries:)
Initializes an instance of AttestationService.
Throws
AttestationError.debugTokenPreconditionFailed
if any of the requirements for using a debug token are not fulfilled for a platform where App Attest is not supported and attestation is enforced in SAP Mobile Services Cockpit.Declaration
Swift
public init(sapCpmsSettingsParameters: SAPcpmsSettingsParameters, sapUrlSession: SAPURLSession, store: CodableStoring, attestationSettings: SAPcpmsAttestationSettings, maxAppleServerFailureRetries: Int = 3) throws
Parameters
sapCpmsSettingsParameters
Parameters from which the endpoint is created; the
backendURL
is used from this parametersapUrlSession
The
SAPURLSession
instance which will be used to make attestation related network requestsstore
The persistent store where data related to Application attestation and assertion is stored
maxAppleServerFailureRetries
The maximum number of times Application attestation is retried for the error
DCError.serverUnavailable
. Default value is 3.attestationSettings
An instance of
SAPcpmsAttestationSettings
which represents the attestation settings configured in Mobile Services.
-
Reads the attestation token value from the underlying persistent store
Declaration
Swift
public static func getAttestationToken(from urlSession: SAPURLSession) throws -> String?
Parameters
urlSession
The main SAPURLSession instance of the application.
Return Value
An optional string value indicating the attestation token. Can be nil if attestation token is not present or an error is thrown when reading the value from store. When all requirements for using debug token are fullfilled, this method returns the debug token.