Class Cwt.CwtBuilder

  • Enclosing class:
    Cwt

    public static class Cwt.CwtBuilder
    extends Object
    A builder for creating Cwt objects.
    • Constructor Detail

      • CwtBuilder

        public CwtBuilder()
        Constructor.
    • Method Detail

      • build

        public Cwt build()
        Builds the CWT.
        Returns:
        the CWT
      • issuer

        public Cwt.CwtBuilder issuer​(String issuer)
        Sets the "iss" claim.
        Parameters:
        issuer - the issuer value
        Returns:
        the builder
      • subject

        public Cwt.CwtBuilder subject​(String subject)
        Sets the "sub" claim.
        Parameters:
        subject - the subject value
        Returns:
        the builder
      • audience

        public Cwt.CwtBuilder audience​(String audience)
        Adds a audience to the "aud" claim.
        Parameters:
        audience - the audience to add
        Returns:
        the builder
      • expiration

        public Cwt.CwtBuilder expiration​(Instant exp)
        Sets the "exp" claim.
        Parameters:
        exp - the expiration time
        Returns:
        the builder
      • notBefore

        public Cwt.CwtBuilder notBefore​(Instant nbf)
        Sets the "nbf" claim.
        Parameters:
        nbf - the not before time
        Returns:
        the builder
      • issuedAt

        public Cwt.CwtBuilder issuedAt​(Instant iat)
        Sets the "iat" claim.
        Parameters:
        iat - the issued at time
        Returns:
        the builder
      • cwtId

        public Cwt.CwtBuilder cwtId​(byte[] cti)
        Sets the "cti" claim.
        Parameters:
        cti - the CWT ID
        Returns:
        the builder
      • dgcV1

        public Cwt.CwtBuilder dgcV1​(byte[] dgcPayload)
        Sets the DGC v1 payload.
        Parameters:
        dgcPayload - the CBOR encoded DGC payload
        Returns:
        the builder
      • claim

        public Cwt.CwtBuilder claim​(int claimKey,
                                    byte[] value)
        Sets a claim identified by claimKey.
        Parameters:
        claimKey - the claim key
        value - the claim value (in its CBOR encoding)
        Returns:
        the builder
      • claim

        public Cwt.CwtBuilder claim​(int claimKey,
                                    com.upokecenter.cbor.CBORObject value)
        Sets a claim identified by claimKey.
        Parameters:
        claimKey - the claim key
        value - the claim value
        Returns:
        the builder
      • claim

        public Cwt.CwtBuilder claim​(String claimKey,
                                    byte[] value)
        Sets a claim identified by claimKey.
        Parameters:
        claimKey - the claim key
        value - the claim value (in its CBOR encoding)
        Returns:
        the builder
      • claim

        public Cwt.CwtBuilder claim​(String claimKey,
                                    com.upokecenter.cbor.CBORObject value)
        Sets a claim identified by claimKey.
        Parameters:
        claimKey - the claim key
        value - the claim value
        Returns:
        the builder