Package smartrics.iotics.identity
Class SimpleIdentity
java.lang.Object
smartrics.iotics.identity.SimpleIdentity
Simpler and more java friendly interface to access IOTICS' identity library functions.
Wrapper class to manage identities via the identity library.
-
Constructor Summary
ConstructorsConstructorDescriptionSimpleIdentity(SdkApi api, String resolverAddress) Abstraction over the library interface with added validation and high level data bags.SimpleIdentity(SdkApi api, String resolverAddress, String seed) SimpleIdentity(SdkApi api, String resolverAddress, String userSeed, String agentSeed) -
Method Summary
Modifier and TypeMethodDescriptionCreateAgentAuthToken(Identity agentIdentity, String userDid, String audience, Duration duration) CreateAgentAuthToken(Identity agentIdentity, String userDid, Duration duration) Uses a default audience.CreateAgentIdentity(String keyName, String name) Makes an agent identity.CreateTwinIdentityWithControlDelegation(Identity agentIdentity, String twinKeyName, String twinName) Creates a new twin and automtaiccally sets the control delegation for this agent identity.CreateUserIdentity(String keyName, String name) Makes a user identity.IsAllowedFor(String resolverAddress, String token) RecreateAgentAuthToken(Identity agentIdentity, String userDid, String audience, Duration duration) RecreateAgentAuthToken(Identity agentIdentity, String userDid, Duration duration) RecreateAgentIdentity(String keyName, String name) Makes an agent identity.RecreateUserIdentity(String keyName, String name) Makes an user identity.voidTwinDelegatesControlToAgent(Identity agentId, Identity twinId, String delegationName) Creates a control delegation from this twin to this agent.voidUserDelegatesAuthenticationToAgent(Identity agentId, Identity userId, String delegationName) Creates an authentication delegation from this user to this agent.
-
Constructor Details
-
SimpleIdentity
Abstraction over the library interface with added validation and high level data bags. This abstraction provides access to the basic high level functionality of the- Parameters:
api- the api proxyresolverAddress-
-
SimpleIdentity
-
SimpleIdentity
- Parameters:
api- the proxy to the library interfaceresolverAddress- the https url of the resolveruserSeed- the user seedagentSeed- the agent seed
-
-
Method Details
-
CreateAgentIdentity
Makes an agent identity. If the identity exists it's returned.- Parameters:
keyName- the key name for this identity, used as passphrase to create the hash of the key from seedname- the identifier of the public key in the did document- Returns:
- the identity data
-
RecreateAgentIdentity
Makes an agent identity. If the identity exists it's recreated and the existing delegations wiped out.- Parameters:
keyName- the key name for this identity, used as passphrase to create the hash of the key from seedname- the identifier of the public key in the did document- Returns:
- the identity data
-
CreateUserIdentity
Makes a user identity. If the identity exists it's returned.- Parameters:
keyName- the key name for this identity, used as passphrase to create the hash of the key from seedname- the identifier of the public key in the did document- Returns:
- the identity data
-
RecreateUserIdentity
Makes an user identity. If the identity exists it's recreated and the existing delegations wiped out.- Parameters:
keyName- the key name for this identity, used as passphrase to create the hash of the key from seedname- the identifier of the public key in the did document- Returns:
- the identity data
-
CreateTwinIdentityWithControlDelegation
public Identity CreateTwinIdentityWithControlDelegation(Identity agentIdentity, String twinKeyName, String twinName) Creates a new twin and automtaiccally sets the control delegation for this agent identity.- Parameters:
agentIdentity-twinKeyName- the key name for this identity, used as passphrase to create the hash of the key from seedtwinName- the identifier of the public key in the did document- Returns:
- the new twin identity
-
CreateAgentAuthToken
public String CreateAgentAuthToken(Identity agentIdentity, String userDid, String audience, Duration duration) - Parameters:
agentIdentity- the agent needing the tokenuserDid- the user that the agent claims it's authorising this requestaudience- the purpose of this tokenduration- validity of this token- Returns:
- JWT token usable as claim for this agent
-
CreateAgentAuthToken
Uses a default audience.- Parameters:
agentIdentity- the agent needing the tokenuserDid- the user that the agent claims it's authorising this requestduration- validity of this token- Returns:
- JWT token usable as claim for this agent
-
RecreateAgentAuthToken
-
RecreateAgentAuthToken
-
IsAllowedFor
-
UserDelegatesAuthenticationToAgent
public void UserDelegatesAuthenticationToAgent(Identity agentId, Identity userId, String delegationName) Creates an authentication delegation from this user to this agent. It assumes secrets for user and agent are avaliable in this context- Parameters:
agentId- the identity of the agentuserId- the identity of the userdelegationName- the delegation name
-
TwinDelegatesControlToAgent
Creates a control delegation from this twin to this agent. It assumes secrets for user and agent are avaliable in this context- Parameters:
agentId- the identity of the agenttwinId- the identity of the twindelegationName- the delegation name
-
getResolverAddress
-