Class SimpleIdentity

java.lang.Object
smartrics.iotics.identity.SimpleIdentity

public class SimpleIdentity extends Object
Simpler and more java friendly interface to access IOTICS' identity library functions. Wrapper class to manage identities via the identity library.
  • Constructor Details

    • SimpleIdentity

      public SimpleIdentity(SdkApi api, String resolverAddress)
      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 proxy
      resolverAddress -
    • SimpleIdentity

      public SimpleIdentity(SdkApi api, String resolverAddress, String seed)
    • SimpleIdentity

      public SimpleIdentity(SdkApi api, String resolverAddress, String userSeed, String agentSeed)
      Parameters:
      api - the proxy to the library interface
      resolverAddress - the https url of the resolver
      userSeed - the user seed
      agentSeed - the agent seed
  • Method Details

    • CreateAgentIdentity

      public Identity CreateAgentIdentity(String keyName, String name)
      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 seed
      name - the identifier of the public key in the did document
      Returns:
      the identity data
    • RecreateAgentIdentity

      public Identity RecreateAgentIdentity(String keyName, String name)
      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 seed
      name - the identifier of the public key in the did document
      Returns:
      the identity data
    • CreateUserIdentity

      public Identity CreateUserIdentity(String keyName, String name)
      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 seed
      name - the identifier of the public key in the did document
      Returns:
      the identity data
    • RecreateUserIdentity

      public Identity RecreateUserIdentity(String keyName, String name)
      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 seed
      name - 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 seed
      twinName - 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 token
      userDid - the user that the agent claims it's authorising this request
      audience - the purpose of this token
      duration - validity of this token
      Returns:
      JWT token usable as claim for this agent
    • CreateAgentAuthToken

      public String CreateAgentAuthToken(Identity agentIdentity, String userDid, Duration duration)
      Uses a default audience.
      Parameters:
      agentIdentity - the agent needing the token
      userDid - the user that the agent claims it's authorising this request
      duration - validity of this token
      Returns:
      JWT token usable as claim for this agent
    • RecreateAgentAuthToken

      public String RecreateAgentAuthToken(Identity agentIdentity, String userDid, String audience, Duration duration)
    • RecreateAgentAuthToken

      public String RecreateAgentAuthToken(Identity agentIdentity, String userDid, Duration duration)
    • IsAllowedFor

      public String IsAllowedFor(String resolverAddress, String token)
    • 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 agent
      userId - the identity of the user
      delegationName - the delegation name
    • TwinDelegatesControlToAgent

      public void TwinDelegatesControlToAgent(Identity agentId, Identity twinId, String delegationName)
      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 agent
      twinId - the identity of the twin
      delegationName - the delegation name
    • getResolverAddress

      public URL getResolverAddress()