Class ImmutableJsonWebKey

java.lang.Object
org.eclipse.ditto.jwt.model.ImmutableJsonWebKey
All Implemented Interfaces:
JsonWebKey

@Immutable public final class ImmutableJsonWebKey extends Object implements JsonWebKey
Immutable implementation of JsonWebKey.
  • Method Details

    • of

      public static JsonWebKey of(String type, @Nullable String algorithm, @Nullable String usage, String id, @Nullable BigInteger modulus, @Nullable BigInteger exponent, @Nullable BigInteger xCoordinate, @Nullable BigInteger yCoordinate, @Nullable String curveType)
      Returns a new JsonWebKey for the given type, algorithm, usage, id, modulus and exponent.
      Parameters:
      type - the type of the JWK.
      algorithm - the algorithm of the JWK or null.
      usage - the usage of the JWK or null.
      id - the ID of the JWK.
      modulus - the optional modulus of the JWK.
      exponent - the optional exponent of the JWK.
      xCoordinate - the optional EC X coordinate.
      yCoordinate - the optional EC Y coordinate.
      curveType - the optional type of the used curve.
      Returns:
      the JsonWebKey.
      Throws:
      NullPointerException - if any argument but algorithm or usage is null.
      IllegalArgumentException - if any String argument is empty.
    • fromJson

      public static JsonWebKey fromJson(String jsonString)
      Returns a new JsonWebKey for the given jsonString.
      Parameters:
      jsonString - the string containing the JSON Web Key.
      Returns:
      the JsonWebKey.
    • fromJson

      public static JsonWebKey fromJson(org.eclipse.ditto.json.JsonObject jsonObject)
      Returns a new JsonWebKey for the given jsonObject.
      Parameters:
      jsonObject - the object containing the JSON Web Key.
      Returns:
      the JsonWebKey.
      Throws:
      org.eclipse.ditto.json.JsonMissingFieldException - if any JsonField is missing.
    • getType

      public String getType()
      Description copied from interface: JsonWebKey
      Returns the key type parameter.
      Specified by:
      getType in interface JsonWebKey
      Returns:
      the key type.
    • getAlgorithm

      public Optional<String> getAlgorithm()
      Description copied from interface: JsonWebKey
      Returns the algorithm parameter.
      Specified by:
      getAlgorithm in interface JsonWebKey
      Returns:
      the algorithm.
    • getUsage

      public Optional<String> getUsage()
      Description copied from interface: JsonWebKey
      Returns the usage parameter.
      Specified by:
      getUsage in interface JsonWebKey
      Returns:
      the usage.
    • getId

      public String getId()
      Description copied from interface: JsonWebKey
      Returns the id parameter.
      Specified by:
      getId in interface JsonWebKey
      Returns:
      the id.
    • getModulus

      public Optional<BigInteger> getModulus()
      Description copied from interface: JsonWebKey
      Returns the modulus parameter.
      Specified by:
      getModulus in interface JsonWebKey
      Returns:
      the modulus.
    • getExponent

      public Optional<BigInteger> getExponent()
      Description copied from interface: JsonWebKey
      Returns the exponent parameter.
      Specified by:
      getExponent in interface JsonWebKey
      Returns:
      the exponent.
    • getXCoordinate

      public Optional<BigInteger> getXCoordinate()
      Description copied from interface: JsonWebKey
      Returns the EC X coordinate.
      Specified by:
      getXCoordinate in interface JsonWebKey
      Returns:
      the EC X coordinate.
    • getYCoordinate

      public Optional<BigInteger> getYCoordinate()
      Description copied from interface: JsonWebKey
      Returns the EC Y coordinate.
      Specified by:
      getYCoordinate in interface JsonWebKey
      Returns:
      the EC Y coordinate.
    • getCurveType

      public Optional<String> getCurveType()
      Description copied from interface: JsonWebKey
      Returns the curve type.
      Specified by:
      getCurveType in interface JsonWebKey
      Returns:
      the curve type.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object