Seald SDK for Android
This package is the Seald SDK for Android.
To install it, you need to add the package io.seald:seald_sdk_android
, available on Maven Central, to your dependencies.
The current version is 0.8.0
. Here is how you can add it to your app/build.gradle
:
dependencies {
/* ... */
implementation 'io.seald:seald_sdk_android:0.8.0'
}
You can then import it in your code with:
import io.seald.seald_sdk.SealdSDK
You can also see the example app.
This package contains the main SealdSDK class, the EncryptionSession class, as well as multiple helper classes.
SealdSDK
SealdSDK is the main class for the Seald SDK. It represents an instance of the Seald SDK.
You can instantiate it this way:
val seald = SealdSDK(
apiURL = "https://api.seald.io/",
appId = "YourAppId",
databasePath = "/myApp/seald_db",
databaseEncryptionKey = "A Secret Key to encrypt the local database, encoded in b64"
)
This class then allows you to create an account, create or retrieve an EncryptionSession, etc.
See the SealdSDK
reference for more information.
EncryptionSession
An EncryptionSession allows you to encrypt / decrypt multiple messages or files.
This should not be instantiated directly, and should be either created with SealdSDK.createEncryptionSession or retrieved with SealdSDK.retrieveEncryptionSession or SealdSDK.retrieveEncryptionSessionFromMessage.
© 2024 Seald SAS
You can find the license information of Open Source libraries used in Seald SDK for mobile at https://download.seald.io/download/mobile_dependencies_licenses_0.8.0.txt.
Types
Name | Summary |
---|---|
AccountInfo | data class AccountInfo(val userId: String, val deviceId: String, val deviceExpires: Instant?) AccountInfo is returned when calling SealdSDK.createAccount or SealdSDK.getCurrentAccountInfo, containing information about the local account. |
ActionStatus | data class ActionStatus(val success: Boolean, val errorCode: String, val result: String) Represents the status of an operation on single user/device. |
AuthFactor | data class AuthFactor(val type: AuthFactorType, val value: String) Represents a user's authentication factor |
AuthFactorType | enum AuthFactorType : Enum<AuthFactorType> |
BeardError | data class BeardError(val id: String, val code: String) BeardError represents an error returned by the server. It contains a specific id and code to determine the underlying reason. |
CheckSigchainResponse | data class CheckSigchainResponse(val found: Boolean, val position: Int, val lastPosition: Int) Represents the results of a call to SealdSDK.checkSigchainHash. |
ClearFile | data class ClearFile(val filename: String, val sessionId: String, val fileContent: ByteArray) ClearFile represents a decrypted file. |
Connector | data class Connector(val sealdId: String, val type: ConnectorType, val value: String, val id: String, val state: ConnectorState) Connector represents all details about a connector. |
ConnectorState | enum ConnectorState : Enum<ConnectorState> ConnectorState represents the allowed values for Connector states. |
ConnectorType | enum ConnectorType : Enum<ConnectorType> ConnectorType represents the allowed values for Connector types: |
ConnectorTypeValue | data class ConnectorTypeValue(val type: ConnectorType, val value: String) ConnectorTypeValue is a simplified representation of a connector for which we don't know all details. |
ConvertTmrAccessesResponse | data class ConvertTmrAccessesResponse(val status: String, val errored: Int, val succeeded: Int, val converted: Array<String>) ConvertTmrAccessesResponse holds the information about the converted tmr accesses. |
CreateSubIdentityResponse | data class CreateSubIdentityResponse(val deviceId: String, val backupKey: ByteArray) CreateSubIdentityResponse represents a newly created sub identity. |
DeviceMissingKeys | data class DeviceMissingKeys(val deviceId: String) Represents a device of the current account which is missing some keys, and for which you probably want to call SealdSDK.massReencrypt. |
EncryptionSession | class EncryptionSession(encryptionSession: MobileEncryptionSession) An encryption session, with which you can then encrypt / decrypt multiple messages or files. This should not be instantiated directly, and should be either created with SealdSDK.createEncryptionSession, or retrieved with SealdSDK.retrieveEncryptionSession or SealdSDK.retrieveEncryptionSessionFromMessage. |
EncryptionSessionRetrievalDetails | class EncryptionSessionRetrievalDetails(var flow: EncryptionSessionRetrievalFlow, var groupId: String?, var proxySessionId: String?, var fromCache: Boolean) EncryptionSessionRetrievalDetails represents the details of how an Encryption Session was retrieved. |
EncryptionSessionRetrievalFlow | enum EncryptionSessionRetrievalFlow : Enum<EncryptionSessionRetrievalFlow> EncryptionSessionRetrievalFlow represents the way the session was retrieved : as a direct recipient, as member of a group, or through a proxy session |
GetFactorTokenResponse | data class GetFactorTokenResponse(val token: String, var authenticatedSessionId: String) GetFactorTokenResponse holds a retrieved authentication factor token |
GetSigchainResponse | data class GetSigchainResponse(val sigchainHash: String, val position: Int) Represents the results of a call to SealdSDK.getSigchainHash. |
GroupTmrTemporaryKey | data class GroupTmrTemporaryKey(val id: String, val groupId: String, val isAdmin: Boolean, val createdById: String, val authFactorType: String, val created: Instant) GroupTmrTemporaryKey holds the information about a group TMR temporary key. |
ListedGroupTMRTemporaryKeys | data class ListedGroupTMRTemporaryKeys(val nbPage: Int, val gTMRTKeys: Array<GroupTmrTemporaryKey>) ListedGroupTMRTemporaryKeys holds a list of GroupTmrTemporaryKey. |
MassReencryptOptions | data class MassReencryptOptions@JvmOverloadsconstructor(var retries: Int = 3, var retrieveBatchSize: Int = 1000, var waitBetweenRetries: Duration = Duration.ofSeconds(3), var waitProvisioning: Boolean = true, var waitProvisioningTime: Duration = Duration.ofSeconds(5), var waitProvisioningTimeMax: Duration = Duration.ofSeconds(10), var waitProvisioningTimeStep: Duration = Duration.ofSeconds(1), var waitProvisioningRetries: Int = 100, var forceLocalAccountUpdate: Boolean = false) Options for SealdSDK.massReencrypt function. |
MassReencryptResponse | data class MassReencryptResponse(val reencrypted: Int, val failed: Int) Represents the results of a call to SealdSDK.massReencrypt. |
PreGeneratedKeys | data class PreGeneratedKeys(preGeneratedKeys: PreGeneratedKeys) Represents a set of pre-generated private keys. Returned by generatePrivateKeys. Can be passed to functions that need private keys. |
PreValidationToken | data class PreValidationToken(val domainValidationKeyId: String, val nonce: String, val token: String) PreValidationToken represents a way for your server to authorize the adding of a connector. |
RecipientRights | data class RecipientRights(val read: Boolean = true, val forward: Boolean = true, val revoke: Boolean = false) RecipientRights represents the rights a user can have over an encrypted message or an encryption session. |
RecipientWithRights | data class RecipientWithRights(val recipientId: String, val rights: RecipientRights? = null) RecipientWithRight represents a recipient with associated rights. Default rights are: read: true, forward: true, revoke: false Default rights for the current user when creating an encryptionSession are read: true, forward: true, revoke: true |
RetrieveIdentityResponse | data class RetrieveIdentityResponse(val identity: ByteArray, val shouldRenewKey: Boolean, var authenticatedSessionId: String) RetrieveIdentityResponse holds a retrieved identity |
RevokeResult | data class RevokeResult(val recipients: Map<String, ActionStatus>, val proxySessions: Map<String, ActionStatus>) The result of a revocation operation. |
SaveIdentityResponse | data class SaveIdentityResponse(val ssksId: String, var authenticatedSessionId: String?) SaveIdentityResponse is returned by SaveIdentity when an identity has been successfully saved |
SealdException | class SealdException(originalException: Throwable) : RuntimeException SealdException represents an error that happened during a Seald operation. |
SealdSDK | class SealdSDK@JvmOverloadsconstructor(apiURL: String = "https://api.seald.io/", appId: String, databasePath: String? = null, databaseEncryptionKey: ByteArray? = null, instanceName: String = "SealdSDK", logLevel: Byte = 0, logNoColor: Boolean = true, encryptionSessionCacheTTL: Duration? = Duration.ZERO, keySize: Int = 4096) This is the main class for the Seald SDK. It represents an instance of the Seald SDK. |
SealdSSKSPasswordPlugin | class SealdSSKSPasswordPlugin(ssksURL: String = "https://ssks.seald.io/", appId: String, instanceName: String = "SealdSSKSPasswordPlugin", logLevel: Byte = 0, logNoColor: Boolean = true) The SealdSSKSPassword class allows to use the SSKS key storage service to store Seald identities easily and securely, encrypted by a user password. |
SealdSSKSTmrPlugin | class SealdSSKSTmrPlugin(ssksURL: String = "https://ssks.seald.io/", appId: String, instanceName: String = "SealdSSKSTmrPlugin", logLevel: Byte = 0, logNoColor: Boolean = true) The SealdSSKSTmrPlugin class allows to use the SSKS key storage service to store Seald identities easily and securely, encrypted by a key stored on your back-end server. |
SearchGroupTMRTemporaryKeysOpts | data class SearchGroupTMRTemporaryKeysOpts@JvmOverloadsconstructor(val groupId: String = "", val page: Int = 1, val all: Boolean = false) SealdSearchGroupTMRTemporaryKeysOpts holds the tmr filters used when searching group TMR temporary keys. |
TMRAccessesConvertFilters | data class TMRAccessesConvertFilters(val sessionId: String = "", val createdById: String = "", val tmrAccessId: String = "") TMRAccessesConvertFilters holds the tmr accesses filters used when converting TMR accesses. |
TMRAccessesRetrievalFilters | data class TMRAccessesRetrievalFilters(val createdById: String = "", val tmrAccessId: String = "") TMRAccessesRetrievalFilters holds the tmr accesses filters used when retrieving an EncryptionSession. |
TmrRecipientWithRights | data class TmrRecipientWithRights(val authFactor: AuthFactor, val overEncryptionKey: ByteArray, val rights: RecipientRights? = null) TmrRecipientWithRights Represents a tmr recipient with the associated rights |
Functions
Name | Summary |
---|---|
generatePrivateKeys | fun generatePrivateKeys(keySize: Int = 4096): PreGeneratedKeys |
generatePrivateKeysAsync | suspend fun generatePrivateKeysAsync(keySize: Int = 4096): PreGeneratedKeys |
parseSessionIdFromBytes | fun parseSessionIdFromBytes(fileByteArray: ByteArray): String Takes an encrypted file as bytes, and returns the session id. |
parseSessionIdFromFile | fun parseSessionIdFromFile(encryptedFilePath: String): String Takes the path to an encrypted file, and returns the session id. |
parseSessionIdFromMessage | fun parseSessionIdFromMessage(message: String): String Takes an encrypted message, and returns the session id. |