Skip to content
This repository has been archived by the owner on Mar 27, 2024. It is now read-only.

test: Enhancements to WACI issuance BDD tests #3138

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions pkg/doc/cm/credentialapplication.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ import (
)

const (
credentialApplicationPresentationContext = "https://identity.foundation/credential-manifest/application/v1"
// CredentialApplicationAttachmentFormat defines the format type of Credential Application when used as an
// attachment in the WACI issuance flow.
// Refer to https://identity.foundation/waci-presentation-exchange/#issuance-2 for more info.
CredentialApplicationAttachmentFormat = "dif/credential-manifest/application@v1.0"
// CredentialApplicationPresentationContext defines the context type of Credential Application when used as part of
// a presentation attachment in the WACI issuance flow.
// Refer to https://identity.foundation/waci-presentation-exchange/#issuance-2 for more info.
CredentialApplicationPresentationContext = "https://identity.foundation/credential-manifest/application/v1"
credentialApplicationPresentationType = "CredentialApplication"
)

Expand Down Expand Up @@ -253,15 +260,15 @@ func setCredentialApplicationContext(presentation *verifiable.Presentation) {

for i := range presentation.Context {
if presentation.Context[i] == presexch.PresentationSubmissionJSONLDContextIRI {
presentation.Context[i] = credentialApplicationPresentationContext
presentation.Context[i] = CredentialApplicationPresentationContext
newContextSet = true

break
}
}

if !newContextSet {
presentation.Context = append(presentation.Context, credentialApplicationPresentationContext)
presentation.Context = append(presentation.Context, CredentialApplicationPresentationContext)
}
}

Expand Down
11 changes: 11 additions & 0 deletions pkg/doc/cm/credentialfulfillment.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ import (
"github.com/hyperledger/aries-framework-go/pkg/doc/verifiable"
)

const (
// CredentialFulfillmentAttachmentFormat defines the format type of Credential Fulfillment when used as an
// attachment in the WACI issuance flow.
// Refer to https://identity.foundation/waci-presentation-exchange/#issuance-2 for more info.
CredentialFulfillmentAttachmentFormat = "dif/credential-manifest/fulfillment@v1.0"
// CredentialFulfillmentPresentationContext defines the context type of Credential Fulfillment when used as part of
// a presentation attachment in the WACI issuance flow.
// Refer to https://identity.foundation/waci-presentation-exchange/#issuance-2 for more info.
CredentialFulfillmentPresentationContext = "https://identity.foundation/credential-manifest/fulfillment/v1"
)

// CredentialFulfillment represents a Credential Fulfillment object as defined in
// https://identity.foundation/credential-manifest/#credential-fulfillment.
type CredentialFulfillment struct {
Expand Down
4 changes: 4 additions & 0 deletions pkg/doc/cm/credentialmanifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import (
"github.com/hyperledger/aries-framework-go/pkg/doc/verifiable"
)

// CredentialManifestAttachmentFormat defines the format type of Credential Manifest when used as an attachment in the
// WACI issuance flow. Refer to https://identity.foundation/waci-presentation-exchange/#issuance-2 for more info.
const CredentialManifestAttachmentFormat = "dif/credential-manifest/manifest@v1.0"

// CredentialManifest represents a Credential Manifest object as defined in
// https://identity.foundation/credential-manifest/#credential-manifest-2.
type CredentialManifest struct {
Expand Down
6 changes: 6 additions & 0 deletions test/bdd/pkg/ldcontext/extra_contexts.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ var (
credentialExamples []byte
//go:embed testdata/odrl.jsonld
odrl []byte
//go:embed testdata/citizenship-v1.jsonld
citizenshipV1 []byte
)

// Extra returns extra JSON-LD contexts used in tests.
Expand All @@ -31,5 +33,9 @@ func Extra() []ldcontext.Document {
URL: "https://www.w3.org/ns/odrl.jsonld",
Content: odrl,
},
{
URL: "https://w3id.org/citizenship/v1",
Content: citizenshipV1,
},
}
}
54 changes: 54 additions & 0 deletions test/bdd/pkg/ldcontext/testdata/citizenship-v1.jsonld
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"@context": {
"@version": 1.1,
"@protected": true,

"name": "http://schema.org/name",
"description": "http://schema.org/description",
"identifier": "http://schema.org/identifier",
"image": {"@id": "http://schema.org/image", "@type": "@id"},

"PermanentResidentCard": {
"@id": "https://w3id.org/citizenship#PermanentResidentCard",
"@context": {
"@version": 1.1,
"@protected": true,

"id": "@id",
"type": "@type",

"description": "http://schema.org/description",
"name": "http://schema.org/name",
"identifier": "http://schema.org/identifier",
"image": {"@id": "http://schema.org/image", "@type": "@id"}
}
},

"PermanentResident": {
"@id": "https://w3id.org/citizenship#PermanentResident",
"@context": {
"@version": 1.1,
"@protected": true,

"id": "@id",
"type": "@type",

"ctzn": "https://w3id.org/citizenship#",
"schema": "http://schema.org/",
"xsd": "http://www.w3.org/2001/XMLSchema#",

"birthCountry": "ctzn:birthCountry",
"birthDate": {"@id": "schema:birthDate", "@type": "xsd:dateTime"},
"commuterClassification": "ctzn:commuterClassification",
"familyName": "schema:familyName",
"gender": "schema:gender",
"givenName": "schema:givenName",
"lprCategory": "ctzn:lprCategory",
"lprNumber": "ctzn:lprNumber",
"residentSince": {"@id": "ctzn:residentSince", "@type": "xsd:dateTime"}
}
},

"Person": "http://schema.org/Person"
}
}
60 changes: 0 additions & 60 deletions test/bdd/pkg/waci/issue_credential_attachments.json

This file was deleted.

Loading