### Initialize CardRevealService Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Initialize the CardRevealService for PAN reveal operations. No specific setup is required beyond this initialization. ```swift let cardRevealService = CardRevealService() ``` -------------------------------- ### Initialize PinRevealService Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Initialize the PinRevealService for PIN reveal operations. This service is used to retrieve sensitive PIN data. ```swift let pinRevealService = PinRevealService() ``` -------------------------------- ### Initialize PinChangeService Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Initialize the PinChangeService for PIN change operations. This service facilitates updating the card's PIN. ```swift let pinChangeService = PinChangeService() ``` -------------------------------- ### Generate Encrypted Key for PIN Reveal (PEM) Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Generate an encrypted key for PIN reveal using a PEM public key. This is an alternative to using JWK for key generation. ```swift let encryptedKey = try pinRevealService.generateEncryptedKey(pem: publicKey) ``` -------------------------------- ### Generate Encrypted Key for PAN Reveal Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Generate an encrypted key using the provided JWK public key for PAN reveal. Ensure the JWK is fetched correctly from the backend. ```swift let encryptedKey = try cardRevealService.generateEncryptedKey(jwk: publicKey) ``` -------------------------------- ### Generate Encrypted Key for PIN Reveal (JWK) Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Generate an encrypted key for PIN reveal using a JWK public key. Ensure the JWK is obtained from the specified backend endpoint. ```swift let encryptedKey = try pinRevealService.generateEncryptedKey(jwk: publicKey) ``` -------------------------------- ### Response Structure for PIN Change Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md JSON structure of the response indicating the status of a PIN change operation. A 'completed' status signifies success. ```json { "status" : "completed" } ``` -------------------------------- ### Response Structure for Encrypted PIN Data Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md JSON structure of the response containing encrypted PIN block and a token. These are required for retrieving the actual PIN. ```json { "encryptedPinBlock": "{data_string}", "token": "{token}" } ``` -------------------------------- ### Generate Encrypted PIN Block for PIN Change Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Generate an encrypted PIN block using the PEM public key and the new PIN. This encrypted block is used in the PIN change request. ```swift let encryptedPin = try pinChangeService.encryptedPinBlock(pem: publicKey, pin: pin) ``` -------------------------------- ### Retrieve PIN from Encrypted Data Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Use PinRevealService to retrieve the PIN using the encryptedPinBlock and token obtained from the backend. This method decrypts the sensitive PIN. ```swift let pin = try pinRevealService.pin(encryptedPinBlock: encryptedPinBlock, token: token) ``` -------------------------------- ### Request Body for PIN Change Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Structure for the POST request body to change a card's PIN. Requires paymentInstrumentId, encryptedKey, encryptedPinBlock, and token. ```json { "paymentInstrumentId": "{payment_instrument_id}", "encryptedKey": "{encrypted_key}", "encryptedPinBlock": "{encrypted_pin_block}", "token": "{token}" } ``` -------------------------------- ### Request Body for Encrypted PAN Data Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Structure for the POST request body to fetch encrypted PAN data. Requires paymentInstrumentId and the generated encryptedKey. ```json { "paymentInstrumentId": "{payment_instrument_id}", "encryptedKey": "{encrypted_key}" } ``` -------------------------------- ### Decrypt Encrypted PAN Data Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md Use CardRevealService to decrypt the obtained encrypted data. This method returns the card details after successful decryption. ```swift let details = try cardRevealService.cardDetails(from: encryptedData) ``` -------------------------------- ### Response Structure for Encrypted PAN Data Source: https://github.com/adyen/adyen-card-reveal-ios/blob/main/README.md JSON structure of the response containing encrypted PAN data. The 'encryptedData' field holds the sensitive information. ```json { "encryptedData": "{data_string}" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.