Class CredentialOfferInfo

  • All Implemented Interfaces:
    Serializable

    public class CredentialOfferInfo
    extends Object
    implements Serializable
    Information about a credential offer.

    Breaking Changes

    The "OpenID for Verifiable Credential Issuance" specification tends to repeat breaking changes. Such changes affect this Java class.

    In the past draft of the specification, elements in the "credentials" array in a credential offer are either strings or JSON objects. Therefore, the type of the "credentials" property in the previous implementation of this class was a "string" whose content must be able to be parsed as a JSON array. However, as a result of a breaking change in the specification, it is ensured that all elements in the "credentials" array in a credential offer are strings. To make it easier to treat the "credentials" property of this class, the type of the property has been changed from a string to an array of strings.

    Due to another breaking change made in December 2023, the credentials property in a credential offer has been renamed to credential_configurations. In addition, the user_pin_required boolean property has been replaced with the tx_code JSON object.

    Another breaking change. The credential_configurations property has been renamed to credential_configuration_ids.

    Since:
    3.59, Authlete 3.0
    See Also:
    OpenID for Verifiable Credential Issuance, Serialized Form
    • Constructor Detail

      • CredentialOfferInfo

        public CredentialOfferInfo()
    • Method Detail

      • getIdentifier

        public String getIdentifier()
        Get the identifier of the credential offer.

        The identifier is a base64url string with 256-bit entropy consisting of 43 characters.

        Returns:
        The identifier of the credential offer.
      • setIdentifier

        public CredentialOfferInfo setIdentifier​(String identifier)
        Set the identifier of the credential offer.

        The identifier is a base64url string with 256-bit entropy consisting of 43 characters.

        Parameters:
        identifier - The identifier of the credential offer.
        Returns:
        this object.
      • getCredentialOffer

        public String getCredentialOffer()
        Get the credential offer in the JSON format.

        The value is suitable for use as the value of the credential_offer parameter which is sent to the credential offer endpoint of the wallet. It is also suitable as the message body of a response returned from the endpoint designated by the credential_offer_uri parameter.

        The credential offer holds JSON like below.

         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "authorization_code": {
               "issuer_state": "..."
             },
             "urn:ietf:params:oauth:grant-type:pre-authorized_code": {
               "pre-authorized_code": "...",
               "tx_code": {
                 "input_mode": "numeric",
                 "length": 6,
                 "description": "..."
               }
             }
           }
         }
         
        Returns:
        The credential offer in the JSON format.
      • setCredentialOffer

        public CredentialOfferInfo setCredentialOffer​(String offer)
        Set the credential offer in the JSON format.

        The value is suitable for use as the value of the credential_offer parameter which is sent to the credential offer endpoint of the wallet. It is also suitable as the message body of a response returned from the endpoint designated by the credential_offer_uri parameter.

        The credential offer should hold JSON like below.

         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "authorization_code": {
               "issuer_state": "..."
             },
             "urn:ietf:params:oauth:grant-type:pre-authorized_code": {
               "pre-authorized_code": "...",
               "tx_code": {
                 "input_mode": "numeric",
                 "length": 6,
                 "description": "..."
               }
             }
           }
         }
         
        Parameters:
        offer - The credential offer in the JSON format.
        Returns:
        this object.
      • getCredentialIssuer

        public URI getCredentialIssuer()
        Get the identifier of the credential issuer.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": { ... }
         }
         
        Returns:
        The identifier of the credential issuer.
        Since:
        3.60
      • setCredentialIssuer

        public CredentialOfferInfo setCredentialIssuer​(URI issuer)
        Set the identifier of the credential issuer.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": { ... }
         }
         
        Parameters:
        issuer - The identifier of the credential issuer.
        Returns:
        this object.
        Since:
        3.60
      • getCredentialConfigurationIds

        public String[] getCredentialConfigurationIds()
        Get the value of the credential_configuration_ids property of the credential offer.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": { ... }
         }
         

        The type of the object returned from this method has been changed from String to String[] since version 3.86 to align with the breaking change of the OID4VCI specification.

        NOTE: Due to the breaking change made in December 2023, the credentials property in a credential offer has been renamed to credential_configurations.

        NOTE: A breaking change again. The credential_configurations property has been renamed to credential_configuration_ids.

        Returns:
        The value of the credential_configuration_ids property of the credential offer.
        Since:
        3.93
      • setCredentialConfigurationIds

        public CredentialOfferInfo setCredentialConfigurationIds​(String[] ids)
        Set the value of the credential_configuration_ids property of the credential offer.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": { ... }
         }
         

        NOTE: Due to the breaking change made in December 2023, the credentials property in a credential offer has been renamed to credential_configurations.

        NOTE: A breaking change again. The credential_configurations property has been renamed to credential_configuration_ids.

        Parameters:
        ids - The value of the credential_configuration_ids property of the credential offer.
        Returns:
        this object.
        Since:
        3.93
      • isAuthorizationCodeGrantIncluded

        public boolean isAuthorizationCodeGrantIncluded()
        Get the flag indicating whether the authorization_code object is included in the grants object.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "authorization_code": { ... }
           }
         }
         
        Returns:
        true if the authorization_code object is included in the grants object.
      • setAuthorizationCodeGrantIncluded

        public CredentialOfferInfo setAuthorizationCodeGrantIncluded​(boolean included)
        Set the flag indicating whether the authorization_code object is included in the grants object.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "authorization_code": { ... }
           }
         }
         
        Parameters:
        included - true to indicate that the authorization_code object is included in the grants object.
        Returns:
        this object.
      • isIssuerStateIncluded

        public boolean isIssuerStateIncluded()
        Get the flag indicating whether the issuer_state property is included in the authorization_code object in the grants object.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "authorization_code": {
               "issuer_state": "..."
             }
           }
         }
         
        Returns:
        true if the issuer_state property is included in the authorization_code object in the grants object.
      • setIssuerStateIncluded

        public CredentialOfferInfo setIssuerStateIncluded​(boolean included)
        Set the flag indicating whether the issuer_state property is included in the authorization_code object in the grants object.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "authorization_code": {
               "issuer_state": "..."
             }
           }
         }
         
        Parameters:
        included - true to indicate that the issuer_state property is included in the authorization_code object in the grants object.
        Returns:
        this object.
      • getIssuerState

        public String getIssuerState()
        Get the value of the issuer_state property in the authorization_code object in the grants object.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "authorization_code": {
               "issuer_state": "..."
             }
           }
         }
         
        Returns:
        The value of the issuer_state property in the authorization_code object in the grants object.
      • setIssuerState

        public CredentialOfferInfo setIssuerState​(String state)
        Set the value of the issuer_state property in the authorization_code object in the grants object.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "authorization_code": {
               "issuer_state": "..."
             }
           }
         }
         
        Parameters:
        state - The value of the issuer_state property in the authorization_code object in the grants object.
        Returns:
        this object.
      • isPreAuthorizedCodeGrantIncluded

        public boolean isPreAuthorizedCodeGrantIncluded()
        Get the flag indicating whether the urn:ietf:params:oauth:grant-type:pre-authorized_code object is included in the grants object.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "urn:ietf:params:oauth:grant-type:pre-authorized_code": { ... }
           }
         }
         
        Returns:
        true if the urn:ietf:params:oauth:grant-type:pre-authorized_code object is included in the grants object.
      • setPreAuthorizedCodeGrantIncluded

        public CredentialOfferInfo setPreAuthorizedCodeGrantIncluded​(boolean included)
        Set the flag indicating whether the urn:ietf:params:oauth:grant-type:pre-authorized_code object is included in the grants object.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "urn:ietf:params:oauth:grant-type:pre-authorized_code": { ... }
           }
         }
         
        Parameters:
        included - true to indicate that the urn:ietf:params:oauth:grant-type:pre-authorized_code object is included in the grants object.
        Returns:
        this object.
      • getPreAuthorizedCode

        public String getPreAuthorizedCode()
        Get the value of the pre-authorized_code property in the urn:ietf:params:oauth:grant-type:pre-authorized_code object in the grants object.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "urn:ietf:params:oauth:grant-type:pre-authorized_code": {
               "pre-authorized_code": "..."
             }
           }
         }
         
        Returns:
        The value of the pre-authorized_code property in the urn:ietf:params:oauth:grant-type:pre-authorized_code object in the grants object.
      • setPreAuthorizedCode

        public CredentialOfferInfo setPreAuthorizedCode​(String code)
        Set the value of the pre-authorized_code property in the urn:ietf:params:oauth:grant-type:pre-authorized_code object in the grants object.
         {
           "credential_issuer": "...",
           "credential_configuration_ids": [ ... ],
           "grants": {
             "urn:ietf:params:oauth:grant-type:pre-authorized_code": {
               "pre-authorized_code": "..."
             }
           }
         }
         
        Parameters:
        code - The value of the pre-authorized_code property in the urn:ietf:params:oauth:grant-type:pre-authorized_code object in the grants object.
        Returns:
        this object.
      • getSubject

        public String getSubject()
        Get the subject associated with the credential offer.

        This property holds the value specified by the subject request parameter passed to the /vci/offer/create API.

        Returns:
        The value of the subject.
        See Also:
        CredentialOfferCreateRequest.getSubject()
      • setSubject

        public CredentialOfferInfo setSubject​(String subject)
        Set the subject associated with the credential offer.

        This property should hold the value specified by the subject request parameter passed to the /vci/offer/create API.

        Parameters:
        subject - The value of the subject.
        Returns:
        this object.
        See Also:
        CredentialOfferCreateRequest.setSubject(String)
      • getExpiresAt

        public long getExpiresAt()
        Get the time at which the credential offer will expire.
        Returns:
        The time at which the credential offer will expire. The value represents milliseconds elapsed since the Unix epoch.
      • setExpiresAt

        public CredentialOfferInfo setExpiresAt​(long expiresAt)
        Set the time at which the credential offer will expire.
        Parameters:
        expiresAt - The time at which the credential offer will expire. The value represents milliseconds elapsed since the Unix epoch.
        Returns:
        this object.
      • getContext

        public String getContext()
        Get the general-purpose arbitrary string.

        This property holds the value specified by the context request parameter passed to the /vci/offer/create API.

        Returns:
        The general-purpose arbitrary string.
        See Also:
        CredentialOfferCreateRequest.getContext()
      • setContext

        public CredentialOfferInfo setContext​(String context)
        Set the general-purpose arbitrary string.

        This property should hold the value specified by the context request parameter passed to the /vci/offer/create API.

        Parameters:
        context - The general-purpose arbitrary string.
        Returns:
        this object.
        See Also:
        CredentialOfferCreateRequest.setContext(String)
      • getProperties

        public Property[] getProperties()
        Get the extra properties associated with the credential offer. Extra properties are general-purpose key-value pairs.

        The extra properties will be eventually associated with an access token which will be created based on the credential offer.

        Returns:
        The extra properties associated with the credential offer.
        Since:
        3.62
      • setProperties

        public CredentialOfferInfo setProperties​(Property[] properties)
        Set the extra properties associated with the credential offer. Extra properties are general-purpose key-value pairs.

        The extra properties will be eventually associated with an access token which will be created based on the credential offer.

        Parameters:
        properties - The extra properties associated with the credential offer.
        Returns:
        this object.
        Since:
        3.62
      • getJwtAtClaims

        public String getJwtAtClaims()
        Get the additional claims in JSON object format that are added to the payload part of the JWT access token.

        This property has a meaning only when the format of access tokens issued by the service is JWT. In other words, it has a meaning only when the accessTokenSignAlg property of the Service holds a non-null value. See the description of the getAccessTokenSignAlg() method for details.

        The additional claims will be eventually associated with an access token which will be created based on the credential offer.

        Returns:
        Additional claims that are added to the payload part of the JWT access token.
        Since:
        3.62
      • setJwtAtClaims

        public CredentialOfferInfo setJwtAtClaims​(String claims)
        Set the additional claims in JSON object format that are added to the payload part of the JWT access token.

        This property has a meaning only when the format of access tokens issued by the service is JWT. In other words, it has a meaning only when the accessTokenSignAlg property of the Service holds a non-null value. See the description of the getAccessTokenSignAlg() method for details.

        The additional claims will be eventually associated with an access token which will be created based on the credential offer.

        Parameters:
        claims - Additional claims that are added to the payload part of the JWT access token.
        Returns:
        this object.
        Since:
        3.62
      • getAuthTime

        public long getAuthTime()
        Get the time when the user authentication was performed during the course of issuing the credential offer.
        Returns:
        The time of the user authentication in seconds since the Unix epoch.
        Since:
        3.62
      • setAuthTime

        public CredentialOfferInfo setAuthTime​(long authTime)
        Set the time when the user authentication was performed during the course of issuing the credential offer.
        Parameters:
        authTime - The time of the user authentication in seconds since the Unix epoch.
        Returns:
        this object.
        Since:
        3.62
      • getAcr

        public String getAcr()
        Get the Authentication Context Class Reference of the user authentication performed during the course of issuing the credential offer.
        Returns:
        The Authentication Context Class Reference.
        Since:
        3.62
      • setAcr

        public CredentialOfferInfo setAcr​(String acr)
        Set the Authentication Context Class Reference of the user authentication performed during the course of issuing the credential offer.
        Parameters:
        acr - The Authentication Context Class Reference.
        Returns:
        this object.
        Since:
        3.62
      • getTxCode

        public String getTxCode()
        Get the transaction code.
        Returns:
        The transaction code.
        Since:
        3.91
      • setTxCode

        public CredentialOfferInfo setTxCode​(String txCode)
        Set the transaction code.
        Parameters:
        txCode - The transaction code.
        Returns:
        this object.
        Since:
        3.91
      • getTxCodeInputMode

        public String getTxCodeInputMode()
        Get the input mode of the transaction code.
        Returns:
        The input mode of the transaction code.
        Since:
        3.91
      • setTxCodeInputMode

        public CredentialOfferInfo setTxCodeInputMode​(String inputMode)
        Set the input mode of the transaction code.
        Parameters:
        inputMode - The input mode of the transaction code. Such as "numeric" and "text".
        Returns:
        this object.
        Since:
        3.91
      • getTxCodeDescription

        public String getTxCodeDescription()
        Get the description of the transaction code.
        Returns:
        The description of the transaction code.
        Since:
        3.91
      • setTxCodeDescription

        public CredentialOfferInfo setTxCodeDescription​(String description)
        Set the description of the transaction code.
        Parameters:
        description - The description of the transaction code.
        Returns:
        this object.
        Since:
        3.91