abstract class EThreeCore
EThreeCore class simplifies work with Virgil Services to easily implement End to End Encrypted communication.
data class PrivateKeyChangedParams |
EThreeCore(identity: String, getTokenCallback: OnGetTokenCallback, keyChangedCallback: OnKeyChangedCallback?, keyPairType: KeyPairType, enableRatchet: Boolean, keyRotationInterval: TimeSpan, context: Context) |
val cardManager: CardManager |
|
val crypto: VirgilCrypto |
|
val identity: String |
|
abstract val keyStorage: KeyStorage |
fun authDecrypt(data: Data, user: Card? = null): Data fun authDecrypt(data: Data, user: Card, date: Date): Data
Decrypts data and signature and verifies signature of sender. fun authDecrypt(text: String, user: Card? = null): String fun authDecrypt(text: String, user: Card, date: Date): String
Decrypts base64 string and signature and verifies signature of sender. fun authDecrypt(inputStream: InputStream, outputStream: OutputStream, user: Card? = null): Unit fun authDecrypt(inputStream: InputStream, outputStream: OutputStream, user: Card, date: Date): Unit
Decrypts stream and signature and verifies signature of sender. |
|
fun authEncrypt(data: Data, user: Card): Data
Signs then encrypts data (and signature) for user. fun authEncrypt(text: String, user: Card): String
Signs then encrypts string (and signature) for user. fun authEncrypt(text: String, users: FindUsersResult? = null): String fun authEncrypt(data: Data, users: FindUsersResult? = null): Data
Signs then encrypts string (and signature) for group of users. fun authEncrypt(inputStream: InputStream, streamSize: Int, outputStream: OutputStream, user: Card): Unit
Signs then encrypts stream and signature for user. fun authEncrypt(inputStream: InputStream, streamSize: Int, outputStream: OutputStream, users: FindUsersResult? = null): Unit
Signs then encrypts stream and signature for users. |
|
fun backupPrivateKey(password: String): Completable
Encrypts the user's private key using the user's password and backs up the encrypted private key to Virgil's cloud. This enables users to log in from other devices and have access to their private key to decrypt data. |
|
fun changePassword(oldPassword: String, newPassword: String): Completable
Changes the password on a backed-up private key. |
|
fun cleanup(): Unit
|
|
fun createGroup(identifier: Data, users: FindUsersResult? = null): Result<Group> fun createGroup(identifier: String, users: FindUsersResult? = null): Result<Group>
Creates group, saves in cloud and locally. |
|
fun createRatchetChannel(card: Card, name: String? = null): Result<RatchetChannel>
Creates double ratchet channel with user, saves it locally. |
|
fun createTemporaryChannel(identity: String): Result<TemporaryChannel>
Creates channel with unregistered user. |
|
fun fun
Decrypts and verifies data from users. fun
Decrypts encrypted stream. fun fun
Decrypts and verifies base64 string from users. fun
Decrypts and verifies encrypted text that is in base64 String format. fun
Decrypts and verifies encrypted data. |
|
fun deleteGroup(identifier: Data): Completable
Deletes group from cloud (if the user is an initiator) and local storage. fun deleteGroup(identifier: String): Completable
Deletes group from cloud and local storage. |
|
fun deleteRatchetChannel(card: Card, name: String? = null): Completable
Deletes double ratchet channel. |
|
fun deleteTemporaryChannel(identity: String): Completable
Deletes temporary channel from the cloud (if the user is a creator) and from the local storage. |
|
fun
Signs then encrypts data for group of users. fun fun
Encrypts data stream. fun
Signs then encrypts string for group of users. fun
Signs and encrypts data for user. fun
Signs and encrypts string for user. fun fun
Signs then encrypts data for a group of users. fun
Encrypts data stream for a group of users. |
|
fun findCachedUser(identity: String): Result<Card?>
Retrieves card from local storage for given identity. |
|
fun findCachedUsers(identities: List<String>, checkResult: Boolean = true): Result<FindUsersResult>
Retrieves cards from local storage for given identities. |
|
fun findUser(identity: String, forceReload: Boolean = false): Result<Card>
Retrieves user Card from the Virgil Cloud or local storage if exists. |
|
fun findUsers(identities: List<String>, forceReload: Boolean = false, checkResult: Boolean = true): Result<FindUsersResult>
Retrieves users Cards from the Virgil Cloud or local storage if exists. |
|
fun getGroup(identifier: Data): Group? fun getGroup(identifier: String): Group?
Returns cached local group. |
|
fun getRatchetChannel(card: Card, name: String? = null): RatchetChannel?
Retrieves a double ratchet channel from the local storage. |
|
fun getSecureChat(): SecureChat |
|
fun getTemporaryChannel(identity: String): TemporaryChannel?
Returns cached temporary channel. |
|
fun hasLocalPrivateKey(): Boolean
Checks whether the private key is present in the local storage of current device. Returns true if the key is present in the local key storage otherwise false. |
|
fun initializeCore(): Unit
Should be called on each new instance of |
|
fun joinRatchetChannel(card: Card, name: String? = null): Result<RatchetChannel>
Joins double ratchet channel with user, saves it locally. |
|
fun loadGroup(identifier: Data, card: Card): Result<Group> fun loadGroup(identifier: String, card: Card): Result<Group>
Loads group from cloud, saves locally. |
|
fun loadTemporaryChannel(asCreator: Boolean, identity: String): Result<TemporaryChannel>
Loads temporary channel by fetching temporary key form Cloud. |
|
fun
Retrieves user public key from the cloud for encryption/verification operations. fun
Retrieves user public keys from the cloud for encryption/verification operations. |
|
fun register(keyPair: VirgilKeyPair? = null): Completable
Publishes the public key in Virgil's Cards Service in case no public key for current identity is published yet. |
|
fun resetPrivateKeyBackup(): Completable fun
Deletes Private Key stored on Virgil's cloud. This will disable user to log in from other devices. |
|
fun restorePrivateKey(password: String): Completable
Pulls user's private key from the Virgil's cloud, decrypts it with Private key that is generated based on provided password and saves it to the current private keys local storage. |
|
fun rotatePrivateKey(): Completable
Generates new key pair, publishes new public key for current identity and deprecating old public key, saves private key to the local storage. All data that was encrypted earlier will become undecryptable. |
|
fun unregister(): Completable
Revokes the public key for current identity in Virgil's Cards Service. After this operation you can call EThreeCore.register again. |
|
fun updateCachedUsers(): Completable
Updates local cached cards. |
fun derivePasswordsInternal(password: String): DerivedPasswords
Derives different passwords for login and for backup from the one provided. |