Package com.aresstack.keepassrpc.client
Class DefaultKeePassRpcCredentialClient
java.lang.Object
com.aresstack.keepassrpc.client.DefaultKeePassRpcCredentialClient
- All Implemented Interfaces:
KeePassRpcCredentialClient,AutoCloseable
public final class DefaultKeePassRpcCredentialClient
extends Object
implements KeePassRpcCredentialClient
Default
KeePassRpcCredentialClient implementation backed by the
KeePassRPC protocol client.
Create instances from persisted settings or directly from a pairing result.
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultKeePassRpcCredentialClient(String host, int port, String clientId, String srpKey, String origin) Create a credential client from explicit connection and authentication values. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a new login entry to KeePass.voidclose()Close the underlying WebSocket connection.voidconnect()Open the WebSocket connection and authenticate with KeePassRPC.Create a credential client directly from a successful pairing result.fromSettings(KeePassRpcSettings settings) Create a credential client from stored settings.Query the filename of the active KeePass database.getPassword(String entryTitle) Read the password for the first KeePass entry matching the given title.getUserName(String entryTitle) Read the username for the first KeePass entry matching the given title.Return a textual representation of entries visible through KeePassRPC.voidupdateLogin(String title, String userName, String password) Update an existing login entry by title.
-
Constructor Details
-
DefaultKeePassRpcCredentialClient
public DefaultKeePassRpcCredentialClient(String host, int port, String clientId, String srpKey, String origin) Create a credential client from explicit connection and authentication values.- Parameters:
host- KeePassRPC hostport- KeePassRPC portclientId- paired client identifiersrpKey- persisted SRP key returned by pairingorigin- WebSocket origin accepted by KeePassRPC
-
-
Method Details
-
fromSettings
Create a credential client from stored settings.- Parameters:
settings- settings containing endpoint, origin, and SRP key- Returns:
- credential client configured from the settings
-
fromPairingResult
Create a credential client directly from a successful pairing result.- Parameters:
result- pairing result containing endpoint, origin, client ID, and SRP key- Returns:
- credential client configured from the pairing result
-
connect
public void connect()Description copied from interface:KeePassRpcCredentialClientOpen the WebSocket connection and authenticate with KeePassRPC.- Specified by:
connectin interfaceKeePassRpcCredentialClient
-
getUserName
Description copied from interface:KeePassRpcCredentialClientRead the username for the first KeePass entry matching the given title.- Specified by:
getUserNamein interfaceKeePassRpcCredentialClient- Parameters:
entryTitle- KeePass entry title- Returns:
- username or
nullif no matching entry was found
-
getPassword
Description copied from interface:KeePassRpcCredentialClientRead the password for the first KeePass entry matching the given title.- Specified by:
getPasswordin interfaceKeePassRpcCredentialClient- Parameters:
entryTitle- KeePass entry title- Returns:
- password or
nullif no matching entry was found
-
getDatabaseFileName
Description copied from interface:KeePassRpcCredentialClientQuery the filename of the active KeePass database.- Specified by:
getDatabaseFileNamein interfaceKeePassRpcCredentialClient- Returns:
- database filename or an empty string if KeePassRPC does not return it
-
addLogin
Description copied from interface:KeePassRpcCredentialClientAdd a new login entry to KeePass.- Specified by:
addLoginin interfaceKeePassRpcCredentialClient- Parameters:
title- entry titleuserName- usernamepassword- passwordurl- associated URL
-
updateLogin
Description copied from interface:KeePassRpcCredentialClientUpdate an existing login entry by title.- Specified by:
updateLoginin interfaceKeePassRpcCredentialClient- Parameters:
title- entry titleuserName- new usernamepassword- new password
-
listEntries
Description copied from interface:KeePassRpcCredentialClientReturn a textual representation of entries visible through KeePassRPC.- Specified by:
listEntriesin interfaceKeePassRpcCredentialClient- Returns:
- implementation-specific entry listing
-
close
public void close()Description copied from interface:KeePassRpcCredentialClientClose the underlying WebSocket connection.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceKeePassRpcCredentialClient
-