Android
The Evervault Android SDK is a library for encrypting data and collecting credit cards data on Android Devices. It's simple to integrate, easy to use and it supports a wide range of data types.
Features
- Core encryption capabilities for various data types.
- A secure and customizable PaymentCard Compose view.
- Built-in data type recognition and appropriate encryption handling.
Supported Platforms
- Android (API Version 26-33)
Quickstart
Install SDK
Our Android SDK distributed via maven, and can be installed using your preferred build tool.
If you are installing evervault-inputs from version 2.0.0 and onwards you will also need to add the JitPack repository to your build file:
Gradle DSL
Maven
Initialize SDK
Before using the Evervault Android SDK, you need to configure it with your Evervault Team ID and App ID. This step is essential for establishing a connection with the Evervault encryption service.
Make sure to replace <TEAM_ID> and <APP_ID> with your actual Evervault Team ID and App ID which can be found in the Evervault Dashboard
Encrypting Data
Once the SDK is configured, you can use the encrypt method to encrypt sensitive data. The encrypt method accepts Java's primitive data types and an optional role
Here's an example of encrypting a social security number:
A role defines an encryption policy to be applied to the return ciphertext. The encrypt function takes as an optional parameter role which is the id of the role created in your Evervault App
The encrypt method returns an Any type, so you will need to safely cast the result based on the data type you provided. For Boolean, Numerics, and Strings, the encrypted data is returned as a String. For Arrays, Lists and Maps, the encrypted data maintains the same structure but is encrypted (except that Arrays become Lists). For ByteArray, the encrypted data is returned as encrypted ByteArray, which can be useful for encrypting files.
Decrypting Data
Decrypts data previously encrypted with the encrypt() function or through Relay.
The decrypt() function allows you to decrypt previously encrypted data using a token.
The token is a time bound token for decrypting data. The token can be generated using our backend SDKs or through our REST API.
The payload must be the same payload that was used to create the token and expires 10 minutes after creation.
The payload must be a map and the response is Any which can, and should be, cast to Map<String, Any>
Inputs
The Evervault Android SDK also provides a Compose view called PaymentCard. This view is designed for capturing credit card information and automatically encrypts the credit card number and CVC without exposing the unencrypted data. The PaymentCard view can be customized to fit your application's design.
Here's an example of using the PaymentCard composable:
The encrypted credit card number and CVC are captured in the PaymentCardData, as well as the expiry month and year and validation fields.
Styling
The PaymentCard and its components can be customized to fit your application's design. The view excepts a number of parameters that enable you to customize the modifier, text and placeholder styles. The content parameter accepts a @Composable PaymentCardInputScope.() function, which can be used to customize the view's layout. The PaymentCardInputScope components can be customized with a modifier (Modifier), label (String or @Composable), placeholder (String or @Composable), text style (TextStyle), and input field colors (TextFieldColors).
Two build-in layouts are provided:
Inline
InlinePaymentCard(the default layout) - This layout displays the card number, expiry and CVC fields inline.
