Skip to content

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.7.1. Here is how you can add it to your app/build.gradle:

groovy
dependencies {
    /* ... */
    implementation 'io.seald:seald_sdk_android:0.7.1'
}

You can then import it in your code with:

kotlin
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:

kotlin
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.7.1.txt.

Types

NameSummary
AccountInfodata 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.
ActionStatusdata class ActionStatus(val success: Boolean, val errorCode: String, val result: String)
Represents the status of an operation on single user/device.
AuthFactordata class AuthFactor(val type: AuthFactorType, val value: String)
Represents a user's authentication factor
AuthFactorTypeenum AuthFactorType : Enum<AuthFactorType>
BeardErrordata 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.
CheckSigchainResponsedata class CheckSigchainResponse(val found: Boolean, val position: Int, val lastPosition: Int)
Represents the results of a call to SealdSDK.checkSigchainHash.
ClearFiledata class ClearFile(val filename: String, val sessionId: String, val fileContent: ByteArray)
ClearFile represents a decrypted file.
Connectordata class Connector(val sealdId: String, val type: ConnectorType, val value: String, val id: String, val state: ConnectorState)
Connector represents all details about a connector.
ConnectorStateenum ConnectorState : Enum<ConnectorState>
ConnectorState represents the allowed values for Connector states.
ConnectorTypeenum ConnectorType : Enum<ConnectorType>
ConnectorType represents the allowed values for Connector types:
ConnectorTypeValuedata class ConnectorTypeValue(val type: ConnectorType, val value: String)
ConnectorTypeValue is a simplified representation of a connector for which we don't know all details.
ConvertTmrAccessesResponsedata class ConvertTmrAccessesResponse(val status: String, val errored: Int, val succeeded: Int, val converted: Array<String>)
ConvertTmrAccessesResponse holds the information about the converted tmr accesses.
CreateSubIdentityResponsedata class CreateSubIdentityResponse(val deviceId: String, val backupKey: ByteArray)
CreateSubIdentityResponse represents a newly created sub identity.
DeviceMissingKeysdata 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.
EncryptionSessionclass 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.
EncryptionSessionRetrievalDetailsclass EncryptionSessionRetrievalDetails(var flow: EncryptionSessionRetrievalFlow, var groupId: String?, var proxySessionId: String?, var fromCache: Boolean)
EncryptionSessionRetrievalDetails represents the details of how an Encryption Session was retrieved.
EncryptionSessionRetrievalFlowenum 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
GetFactorTokenResponsedata class GetFactorTokenResponse(val token: String, var authenticatedSessionId: String)
GetFactorTokenResponse holds a retrieved authentication factor token
GetSigchainResponsedata class GetSigchainResponse(val sigchainHash: String, val position: Int)
Represents the results of a call to SealdSDK.getSigchainHash.
MassReencryptOptionsdata 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.
MassReencryptResponsedata class MassReencryptResponse(val reencrypted: Int, val failed: Int)
Represents the results of a call to SealdSDK.massReencrypt.
PreGeneratedKeysdata class PreGeneratedKeys(preGeneratedKeys: PreGeneratedKeys)
Represents a set of pre-generated private keys. Returned by generatePrivateKeys. Can be passed to functions that need private keys.
PreValidationTokendata 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.
RecipientRightsdata 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.
RecipientWithRightsdata 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
RetrieveIdentityResponsedata class RetrieveIdentityResponse(val identity: ByteArray, val shouldRenewKey: Boolean, var authenticatedSessionId: String)
RetrieveIdentityResponse holds a retrieved identity
RevokeResultdata class RevokeResult(val recipients: Map<String, ActionStatus>, val proxySessions: Map<String, ActionStatus>)
The result of a revocation operation.
SaveIdentityResponsedata class SaveIdentityResponse(val ssksId: String, var authenticatedSessionId: String?)
SaveIdentityResponse is returned by SaveIdentity when an identity has been successfully saved
SealdExceptionclass SealdException(originalException: Throwable) : RuntimeException
SealdException represents an error that happened during a Seald operation.
SealdSDKclass 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.
SealdSSKSPasswordPluginclass 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.
SealdSSKSTmrPluginclass 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.
TMRAccessesConvertFiltersdata class TMRAccessesConvertFilters(val sessionId: String = "", val createdById: String = "", val tmrAccessId: String = "")
TMRAccessesConvertFilters holds the tmr accesses filters used when converting TMR accesses.
TMRAccessesRetrievalFiltersdata class TMRAccessesRetrievalFilters(val createdById: String = "", val tmrAccessId: String = "")
TMRAccessesRetrievalFilters holds the tmr accesses filters used when retrieving an EncryptionSession.
TmrRecipientWithRightsdata class TmrRecipientWithRights(val authFactor: AuthFactor, val overEncryptionKey: ByteArray, val rights: RecipientRights? = null)
TmrRecipientWithRights Represents a tmr recipient with the associated rights

Functions

NameSummary
generatePrivateKeysfun generatePrivateKeys(keySize: Int = 4096): PreGeneratedKeys
generatePrivateKeysAsyncsuspend fun generatePrivateKeysAsync(keySize: Int = 4096): PreGeneratedKeys
parseSessionIdFromBytesfun parseSessionIdFromBytes(fileByteArray: ByteArray): String
Takes an encrypted file as bytes, and returns the session id.
parseSessionIdFromFilefun parseSessionIdFromFile(encryptedFilePath: String): String
Takes the path to an encrypted file, and returns the session id.
parseSessionIdFromMessagefun parseSessionIdFromMessage(message: String): String
Takes an encrypted message, and returns the session id.