KeyService

interface KeyService

Types

Link copied to clipboard
data class BootstrapCrossSigning(val recoveryKey: String, val result: Result<UIA<Unit>>)

Functions

Link copied to clipboard
abstract suspend fun bootstrapCrossSigning(recoveryKey: ByteArray = SecureRandom.nextBytes(32), secretKeyEventContentGenerator: suspend () -> SecretKeyEventContent = { val iv = SecureRandom.nextBytes(16) AesHmacSha2Key( iv = iv.encodeBase64(), mac = createAesHmacSha2MacFromKey(recoveryKey, iv) ) }): KeyService.BootstrapCrossSigning

This allows you to bootstrap cross signing. Be aware, that this could override an existing cross signing setup of the account. Be aware, that this also creates a new key backup, which could replace an existing key backup.

Link copied to clipboard
abstract suspend fun bootstrapCrossSigningFromPassphrase(passphrase: String, secretKeyEventContentGenerator: suspend () -> Pair<ByteArray, SecretKeyEventContent> = { val passphraseInfo = AesHmacSha2Key.SecretStorageKeyPassphrase.Pbkdf2( salt = SecureRandom.nextBytes(32).encodeBase64(), iterations = 120_000, bits = 32 * 8 ) val iv = SecureRandom.nextBytes(16) val key = recoveryKeyFromPassphrase(passphrase, passphraseInfo) key to AesHmacSha2Key( passphrase = passphraseInfo, iv = iv.encodeBase64(), mac = createAesHmacSha2MacFromKey(key = key, iv = iv) ) }): KeyService.BootstrapCrossSigning

This allows you to bootstrap cross signing. Be aware, that this could override an existing cross signing setup of the account. Be aware, that this also creates a new key backup, which could replace an existing key backup.

Link copied to clipboard
abstract fun getCrossSigningKeys(userId: UserId): Flow<List<CrossSigningKeys>?>
Link copied to clipboard
abstract fun getDeviceKeys(userId: UserId): Flow<List<DeviceKeys>?>
Link copied to clipboard
abstract fun getTrustLevel(timelineEvent: TimelineEvent): Flow<DeviceTrustLevel>?
abstract fun getTrustLevel(userId: UserId): Flow<UserTrustLevel>
abstract fun getTrustLevel(userId: UserId, deviceId: String): Flow<DeviceTrustLevel>

Properties

Link copied to clipboard
abstract val bootstrapRunning: StateFlow<Boolean>

Inheritors

Link copied to clipboard