auth: delete the bunker private key when an access token is revoked
This commit is contained in:
parent
335f8eae6c
commit
bee7673085
|
@ -123,15 +123,15 @@ function importCredentials(auth: SoapboxAuth, accessToken: string, account: Acco
|
||||||
function revokeNostr(accessToken: string): void {
|
function revokeNostr(accessToken: string): void {
|
||||||
const { connections, revoke } = useBunkerStore.getState();
|
const { connections, revoke } = useBunkerStore.getState();
|
||||||
|
|
||||||
/** User pubkey from token. */
|
for (const conn of connections) {
|
||||||
const pubkey = connections.find((conn) => conn.accessToken === accessToken)?.pubkey;
|
if (conn.accessToken === accessToken) {
|
||||||
|
|
||||||
// Revoke the Bunker connection.
|
// Revoke the Bunker connection.
|
||||||
revoke(accessToken);
|
revoke(accessToken);
|
||||||
|
// Revoke the user's private key.
|
||||||
// Revoke the private key, if it exists.
|
keyring.delete(conn.pubkey);
|
||||||
if (pubkey) {
|
// Revoke the bunker's private key.
|
||||||
keyring.delete(pubkey);
|
keyring.delete(conn.bunkerPubkey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue