Top Description Fields Constructors Methods
com.github.javakeyring

public Class Keyring

extends Object
implements AutoCloseable
Class Inheritance
All Implemented Interfaces
java.lang.AutoCloseable
Imports
com.github.javakeyring.internal.KeyringBackend, .KeyringBackendFactory

Keyring.

Field Summary

Modifier and TypeField and Description
private final KeyringBackend
backend

Keyring Storage Back end.

Constructor Summary

AccessConstructor and Description
private
Keyring(KeyringBackend
Keyring backend instance
backend
)

Initializes an instance of Keyring.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements java.lang.AutoCloseable.close.

Closes resources used by the backend.

public static Keyring

Returns:

a functional Keyring or a BackendNotSupportedException is thrown.
create
()

Creates an instance of Keyring using the a default backed based on operating system.

public static Keyring

Returns:

a functional Keyring or a BackendNotSupportedException is thrown.
create
(KeyringStorageType
desired backend.
keyring
)

Creates an instance of Keyring with specified backend.

public void
deletePassword(String
Service name
service
,
String
Account name
account
)

Sets password to key store (Proxy method of KeyringBackend.setPassword)

public KeyringStorageType
public String

Returns:

Password related to specified service and account
getPassword
(String
Service name
service
,
String
Account name
account
)

Gets password from key store (Proxy method of KeyringBackend.getPassword).

public void
setPassword(String
Service name
service
,
String
Account name
account
,
String
Password
password
)

Sets password to key store (Proxy method of KeyringBackend.setPassword)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

backendback to summary
private final KeyringBackend backend

Keyring Storage Back end.

Constructor Detail

Keyringback to summary
private Keyring(KeyringBackend backend)

Initializes an instance of Keyring.

Parameters
backend:KeyringBackend

Keyring backend instance

Method Detail

closeback to summary
public void close() throws Exception

Implements java.lang.AutoCloseable.close.

Closes resources used by the backend.

Annotations
@Override
Exceptions
Exception:
Thrown if the backend can not be closed
createback to summary
public static Keyring create() throws BackendNotSupportedException

Creates an instance of Keyring using the a default backed based on operating system.

Returns:Keyring

a functional Keyring or a BackendNotSupportedException is thrown.

Exceptions
BackendNotSupportedException:
if the default backend for the operating system is unsupported.
createback to summary
public static Keyring create(KeyringStorageType keyring) throws BackendNotSupportedException

Creates an instance of Keyring with specified backend.

Parameters
keyring:KeyringStorageType

desired backend.

Returns:Keyring

a functional Keyring or a BackendNotSupportedException is thrown.

Exceptions
BackendNotSupportedException:
if the default backend for the operating system is unsupported.
deletePasswordback to summary
public void deletePassword(String service, String account) throws PasswordAccessException

Sets password to key store (Proxy method of KeyringBackend.setPassword)

Parameters
service:String

Service name

account:String

Account name

Exceptions
PasswordAccessException:
Thrown when an error happened while saving the password
getKeyringStorageTypeback to summary
public KeyringStorageType getKeyringStorageType()
getPasswordback to summary
public String getPassword(String service, String account) throws PasswordAccessException

Gets password from key store (Proxy method of KeyringBackend.getPassword).

Parameters
service:String

Service name

account:String

Account name

Returns:String

Password related to specified service and account

Exceptions
PasswordAccessException:
Thrown when an error happened while getting password
setPasswordback to summary
public void setPassword(String service, String account, String password) throws PasswordAccessException

Sets password to key store (Proxy method of KeyringBackend.setPassword)

Parameters
service:String

Service name

account:String

Account name

password:String

Password

Exceptions
PasswordAccessException:
Thrown when an error happened while saving the password