-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ATL-7666: Preserve Presentation Format
Signed-off-by: Bassam Riman <[email protected]>
- Loading branch information
1 parent
91cb4e7
commit ee22c87
Showing
11 changed files
with
106 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package org.hyperledger.identus.presentproof.controller.http | ||
|
||
import org.hyperledger.identus.api.http.Annotation | ||
import org.hyperledger.identus.mercury.protocol.presentproof.PresentCredentialRequestFormat | ||
import org.hyperledger.identus.pollux.core.service.serdes.* | ||
import org.hyperledger.identus.presentproof.controller.http.RequestPresentationInput.annotations | ||
import sttp.tapir.{Schema, Validator} | ||
|
@@ -29,6 +30,9 @@ final case class RequestPresentationInput( | |
@description(annotations.anoncredPresentationRequest.description) | ||
@encodedExample(annotations.anoncredPresentationRequest.example) | ||
anoncredPresentationRequest: Option[AnoncredPresentationRequestV1], | ||
@description(annotations.presentationFormat.description) | ||
@encodedExample(annotations.presentationFormat.example) | ||
presentationFormat: Option[PresentCredentialRequestFormat], | ||
@description(annotations.claims.description) | ||
@encodedExample(annotations.claims.example) | ||
claims: Option[zio.json.ast.Json.Obj], | ||
|
@@ -128,6 +132,20 @@ object RequestPresentationInput { | |
) | ||
) | ||
) | ||
|
||
object presentationFormat | ||
extends Annotation[Option[String]]( | ||
description = | ||
"The presentation format to display in Didcomm messages (default to 'prism/jwt', vc+sd-jwt or anoncreds/[email protected])", | ||
example = Some("prism/jwt"), | ||
validator = Validator.enumeration( | ||
List( | ||
Some("prism/jwt"), | ||
Some("vc+sd-jwt"), | ||
Some("anoncreds/[email protected]") | ||
) | ||
) | ||
) | ||
object claims | ||
extends Annotation[Option[zio.json.ast.Json.Obj]]( | ||
description = """ | ||
|
@@ -163,6 +181,8 @@ object RequestPresentationInput { | |
|
||
import AnoncredPresentationRequestV1.given | ||
|
||
given Schema[PresentCredentialRequestFormat] = Schema.derivedEnumeration.defaultStringBased | ||
|
||
given Schema[AnoncredPresentationRequestV1] = Schema.derived | ||
|
||
given Schema[AnoncredRequestedAttributeV1] = Schema.derived | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ package org.hyperledger.identus.mercury.protocol.presentproof | |
|
||
import io.circe.{Decoder, Encoder} | ||
import io.circe.generic.semiauto.* | ||
import zio.json.{DeriveJsonDecoder, DeriveJsonEncoder, JsonDecoder, JsonEncoder} | ||
|
||
/* | ||
Present Credential Formats: | ||
|
@@ -72,8 +73,6 @@ object PresentCredentialProposeFormat { | |
* - dif/presentation-exchange/[email protected] | ||
*/ | ||
enum PresentCredentialRequestFormat(val name: String) { | ||
case Unsupported(other: String) extends PresentCredentialRequestFormat(other) | ||
// case JWT extends PresentCredentialRequestFormat("jwt/[email protected]") // TODO FOLLOW specs for JWT VC | ||
case JWT extends PresentCredentialRequestFormat("prism/jwt") // TODO REMOVE | ||
case SDJWT extends PresentCredentialRequestFormat("vc+sd-jwt") | ||
case Anoncred extends PresentCredentialRequestFormat("anoncreds/[email protected]") | ||
|
@@ -82,6 +81,13 @@ enum PresentCredentialRequestFormat(val name: String) { | |
object PresentCredentialRequestFormat { | ||
given Encoder[PresentCredentialRequestFormat] = deriveEncoder[PresentCredentialRequestFormat] | ||
given Decoder[PresentCredentialRequestFormat] = deriveDecoder[PresentCredentialRequestFormat] | ||
|
||
given JsonEncoder[PresentCredentialRequestFormat] = | ||
DeriveJsonEncoder.gen[PresentCredentialRequestFormat] | ||
|
||
given JsonDecoder[PresentCredentialRequestFormat] = | ||
DeriveJsonDecoder.gen[PresentCredentialRequestFormat] | ||
|
||
} | ||
|
||
/** Present Credential: | ||
|
@@ -98,7 +104,6 @@ object PresentCredentialRequestFormat { | |
* - dif/presentation-exchange/[email protected] | ||
*/ | ||
enum PresentCredentialFormat(val name: String) { | ||
case Unsupported(other: String) extends PresentCredentialFormat(other) | ||
// case JWT extends PresentCredentialFormat("jwt/[email protected]") // TODO FOLLOW specs for JWT VC | ||
case JWT extends PresentCredentialFormat("prism/jwt") // TODO REMOVE | ||
case SDJWT extends PresentCredentialFormat("vc+sd-jwt") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.