feat: wipe database on logout #25
@@ -188,6 +188,14 @@ class Nostr {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun prune() {
|
||||
try {
|
||||
client?.database()?.wipe()
|
||||
} catch (e: Exception) {
|
||||
throw IllegalStateException("Failed to prune database: ${e.message}", e)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun setSigner(new: AsyncNostrSigner) {
|
||||
try {
|
||||
signer.switch(new)
|
||||
|
||||
@@ -325,8 +325,11 @@ class NostrViewModel(
|
||||
|
||||
fun logout() {
|
||||
viewModelScope.launch {
|
||||
secretStore.clear("user_signer")
|
||||
// Reset the nostr state and wipe database
|
||||
nostr.signer.switch(Keys.generate())
|
||||
nostr.prune()
|
||||
// Clear credential
|
||||
secretStore.clear("user_signer")
|
||||
_signerRequired.value = true
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user