Package i5.las2peer.api.security
Interface UserAgent
- All Superinterfaces:
Agent
,PassphraseAgent
- All Known Implementing Classes:
BotAgent
,EthereumAgent
,UserAgentImpl
An agent representing a user.
-
Method Summary
Modifier and TypeMethodDescriptiongetEmail()
Getter for the email address of this user.Getter for the login name.boolean
hasEmail()
Check if the agent has an email address set.boolean
Check if the agent has a login name set.void
Set the email address for this user.void
setLoginName
(String name) Set the login name for this user.Methods inherited from interface i5.las2peer.api.security.Agent
getIdentifier, isLocked
Methods inherited from interface i5.las2peer.api.security.PassphraseAgent
unlock, unlockPrivateKey
-
Method Details
-
getLoginName
String getLoginName()Getter for the login name. Login names are unique in the network.- Returns:
- The login name.
-
getEmail
String getEmail()Getter for the email address of this user. Emails are unique in the network.- Returns:
- The login name.
-
hasLoginName
boolean hasLoginName()Check if the agent has a login name set.- Returns:
- true If a login name is set up.
-
hasEmail
boolean hasEmail()Check if the agent has an email address set.- Returns:
- true If an email address is set up.
-
setLoginName
Set the login name for this user. Note that user names are unique in the network. The name will be stored and reserved in the network only onContext.storeAgent(i5.las2peer.api.security.Agent)
. If the name is already taken, the store operation will fail with aLoginNameAlreadyTakenException
.- Parameters:
name
- A user name matching [a-zA-Z].*.- Throws:
AgentLockedException
- If the agent is locked.IllegalArgumentException
- If the name is of invalid format.
-
setEmail
Set the email address for this user. Note that user names are unique in the network. The address will be stored and reserved in the network only onContext.storeAgent(i5.las2peer.api.security.Agent)
. If the address is already taken, the store operation will fail with aEmailAlreadyTakenException
.- Parameters:
address
- A valid email address.- Throws:
AgentLockedException
- If the agent is locked.IllegalArgumentException
- If the email address is of invalid format.
-