Skip to content
This repository has been archived by the owner on Apr 5, 2023. It is now read-only.

feat: Add [waci-issuance] bdd tests #627

Merged
merged 1 commit into from
Feb 17, 2022
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
2 changes: 1 addition & 1 deletion pkg/restapi/issuer/operation/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -1623,7 +1623,7 @@ func getAttachments(action service.DIDCommAction) ([]decorator.GenericAttachment
return nil, fmt.Errorf("failed to decode didComm action message: %w", err)
}

attachmentsRaw, ok := didCommMsgAsMap["requests~attach"]
attachmentsRaw, ok := didCommMsgAsMap["attachments"]
if !ok {
return nil, errors.New("missing attachments from DIDComm message map")
}
Expand Down
16 changes: 8 additions & 8 deletions pkg/restapi/issuer/operation/operations_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3973,9 +3973,9 @@ func TestWACIIssuanceHandler(t *testing.T) {

done := make(chan struct{})

msg := service.NewDIDCommMsgMap(issuecredsvc.RequestCredentialV2{
msg := service.NewDIDCommMsgMap(issuecredsvc.RequestCredentialV3{
Type: issuecredsvc.RequestCredentialMsgTypeV2,
RequestsAttach: []decorator.Attachment{
Attachments: []decorator.AttachmentV2{
{
ID: manifestID,
Data: decorator.AttachmentData{
Expand Down Expand Up @@ -4059,9 +4059,9 @@ func TestWACIIssuanceHandler(t *testing.T) {

// test failed to get credential manifestID from store
testFailure(actionCh, msg, "failed to get credential manifestID from store")
msg = service.NewDIDCommMsgMap(issuecredsvc.RequestCredentialV2{
Type: issuecredsvc.RequestCredentialMsgTypeV2,
RequestsAttach: []decorator.Attachment{
msg = service.NewDIDCommMsgMap(issuecredsvc.RequestCredentialV3{
Type: issuecredsvc.RequestCredentialMsgTypeV3,
Attachments: []decorator.AttachmentV2{
{ID: manifestID,
Data: decorator.AttachmentData{
JSON: &verifiable.Presentation{},
Expand All @@ -4079,9 +4079,9 @@ func TestWACIIssuanceHandler(t *testing.T) {
testFailure(actionCh, msg, "missing credential_application field")

application := createCredentialApplication(t, c, manifestID, profile)
msg = service.NewDIDCommMsgMap(issuecredsvc.RequestCredentialV2{
Type: issuecredsvc.RequestCredentialMsgTypeV2,
RequestsAttach: []decorator.Attachment{
msg = service.NewDIDCommMsgMap(issuecredsvc.RequestCredentialV3{
Type: issuecredsvc.RequestCredentialMsgTypeV3,
Attachments: []decorator.AttachmentV2{
{ID: manifestID,
Data: decorator.AttachmentData{
JSON: application,
Expand Down
27 changes: 22 additions & 5 deletions test/bdd/features/waci_didcommv2.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,36 @@ Feature: WACI DIDComm V2

@issuer_adapter_waci_v2
Scenario Outline: Issuer adapter features
Given "WalletApp" agent is running on "localhost" port "9081" with webhook "http://localhost:9083" and controller "http://localhost:9082"
And Wallet "WalletApp" has profile created and unlocked

Given "<walletID>" agent is running on "localhost" port "9081" with webhook "http://localhost:9083" and controller "http://localhost:9082"
And Wallet "<walletID>" has profile created and unlocked
#This scenario only has output descriptors configured in manifest-config file.
Given Issuer Profile with id "<profileID>", name "<profileName>", issuerURL "<issuerURL>", supportedVCContexts "<supportedVCContexts>", scopes "<scopes>", issuer id "<issuerID>", linked wallet "<linkedWallet>" and oidc provider "https://issuer-hydra.trustbloc.local:9044/" with DIDComm V2 and WACI support
And Retrieved profile with id "<profileID>" contains name "<profileName>", issuerURL "<issuerURL>", supportedVCContexts "<supportedVCContexts>", scopes "<scopes>", issuer id "<issuerID>", linked wallet "<linkedWallet>" and oidc provider "https://issuer-hydra.trustbloc.local:9044/" with DIDComm V2 and WACI support
Then Issuer adapter shows the wallet connect UI when the issuer "<profileID>" with scopes "<scopes>" wants to connect to the wallet
And Issuer adapter ("<profileID>") creates DIDComm connection invitation for "<walletID>"
And "<walletID>" accepts invitation from issuer adapter "<profileID>" and performs WACI credential issuance interaction
# While performing WACI interaction, validation of offer credential attachment(manifest and fulfillment) and
# request credential with credential application attachment presentation is sent via universal wallet
And "<walletID>" accepts invitation from issuer adapter "<profileID>" and performs WACI credential issuance interaction with manifest with PEx requirement "false"
And "<walletID>" received web redirect info from "<profileID>" after successful completion of WACI credential issuance interaction
Examples:
| profileID | profileName | issuerURL | supportedVCContexts | scopes | issuerID | linkedWallet | walletID |
| profileID | profileName | issuerURL | supportedVCContexts | scopes | issuerID | linkedWallet | walletID |
| prCardWACI | PRCard Issuer | http://mock-issuer.com:9080/prCard | https://trustbloc.github.io/context/vc/examples/citizenship-v1.jsonld | prc | did:example:123?linked-domains=3 | https://example.wallet.com/waci | WalletApp |

@issuer_adapter_waci_v2_withPEx
Scenario Outline: Issuer adapter features
Given "<walletID>" agent is running on "localhost" port "9081" with webhook "http://localhost:9083" and controller "http://localhost:9082"
And Wallet "<walletID>" has profile created and unlocked
#This scenario has output descriptors and prc card input descriptor configured in manifest-config file.
Given Issuer Profile with id "<profileID>", name "<profileName>", issuerURL "<issuerURL>", supportedVCContexts "<supportedVCContexts>", scopes "<scopes>", issuer id "<issuerID>", linked wallet "<linkedWallet>" and oidc provider "https://issuer-hydra.trustbloc.local:9044/" with DIDComm V2 and WACI support
And Retrieved profile with id "<profileID>" contains name "<profileName>", issuerURL "<issuerURL>", supportedVCContexts "<supportedVCContexts>", scopes "<scopes>", issuer id "<issuerID>", linked wallet "<linkedWallet>" and oidc provider "https://issuer-hydra.trustbloc.local:9044/" with DIDComm V2 and WACI support
Then Issuer adapter shows the wallet connect UI when the issuer "<profileID>" with scopes "<scopes>" wants to connect to the wallet
And Issuer adapter ("<profileID>") creates DIDComm connection invitation for "<walletID>"
And "<walletID>" accepts invitation from issuer adapter "<profileID>" and performs WACI credential issuance interaction with manifest with PEx requirement "true"
And "<walletID>" received web redirect info from "<profileID>" after successful completion of WACI credential issuance interaction
Examples:
| profileID | profileName | issuerURL | supportedVCContexts | scopes | issuerID | linkedWallet | walletID |
| mDLWACI | Driving License Issuer | http://mock-issuer.com:9080/driversLicense | https://trustbloc.github.io/context/vc/examples/driver-license-evidence-v1.jsonld | mDL | did:example:123?linked-domains=3 | https://example.wallet.com/waci | WalletMDLApp |

@verifier_adapter_waci_v2
Scenario: WACI flow between Verifier and Wallet using DIDComm V2
Given the "Mock Wallet" is running on "localhost" port "9081" with webhook "http://localhost:9083" and controller "http://localhost:9082"
Expand Down
114 changes: 110 additions & 4 deletions test/bdd/fixtures/testdata/manifest-config/cmdescriptors.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,116 @@
}
}
}
]
},
"mDL":{
"output_descriptor":[
{
"id":"driver_license_output",
"schema":"https://schema.org/EducationalOccupationalCredential",
"display":{
"title":{
"path":[
"$.name",
"$.vc.name"
],
"schema":{
"type":"string"
},
"fallback":"Washington State Driver License"
},
"subtitle":{
"path":[
"$.class",
"$.vc.class"
],
"schema":{
"type":"string"
},
"fallback":"Class A, Commercial"
},
"description":{
"text":"License to operate a vehicle with a gross combined weight rating (GCWR) of 26,001 or more pounds, as long as the GVWR of the vehicle(s) being towed is over 10,000 pounds."
},
"properties":[
{
"path":[
"$.donor",
"$.vc.donor"
],
"schema":{
"type":"boolean"
},
"fallback":"Unknown",
"label":"Organ Donor"
}
]
},
"styles":{
"thumbnail":{
"uri":"https://dol.wa.com/logo.png",
"alt":"Washington State Seal"
},
"hero":{
"uri":"https://dol.wa.com/happy-people-driving.png",
"alt":"Happy people driving"
},
"background":{
"color":"#ff0000"
},
"text":{
"color":"#d4d400"
}
}
}
],
"options":{
"challenge":"508adef4-b8e0-4edf-a53d-a260371c1423",
"domain":"9rf25a28rs96"
}
"input_descriptor":[
{
"id":"prc_input",
"name":"Permanent Resident Card",
"purpose":"We need PRC to verify your status.",
"schema":[
{
"uri":"https://w3id.org/citizenship#PermanentResidentCard"
}
],
"constraints":{
"fields":[
{
"path":[
"$.credentialSubject.givenName"
],
"filter":{
"type":"string"
}
},
{
"path":[
"$.credentialSubject.familyName"
],
"filter":{
"type":"string"
}
},
{
"path":[
"$.credentialSubject.birthCountry"
],
"filter":{
"type":"string"
}
},
{
"path":[
"$.credentialSubject.birthDate"
],
"filter":{
"type":"string"
}
}
]
}
}
]
}
}
33 changes: 33 additions & 0 deletions test/bdd/pkg/agent/testdata/vc_prc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"@context":[
"https://www.w3.org/2018/credentials/v1",
"https://w3id.org/citizenship/v1",
"https://w3id.org/security/bbs/v1"
],
"id":"urn:uvci:af5vshde843jf831j128fj",
"type":[
"VerifiableCredential",
"VaccinationCertificate",
"PermanentResidentCard"
],
"name":"Permanent Resident Card",
"description":"Permanent Resident Card of Mr.Louis Pasteu",
"expirationDate":"2029-12-03T12:19:52Z",
"issuanceDate":"2019-12-03T12:19:52Z",
"issuer":"did:example:456",
"credentialSubject":{
"id":"did:example:ebfeb1f712ebc6f1c276e12ec21",
"givenName":"Louis",
"familyName":"Pasteur",
"birthCountry":"Bahamas",
"birthDate":"1958-07-17"
},
"proof":{
"type":"BbsBlsSignatureProof2020",
"created":"2021-02-18T23:04:28Z",
"nonce":"JNGovx4GGoi341v/YCTcZq7aLWtBtz8UhoxEeCxZFevEGzfh94WUSg8Ly/q+2jLqzzY=",
"proofPurpose":"assertionMethod",
"proofValue":"AB0GQA//jbDwMgaIIJeqP3fRyMYi6WDGhk0JlGJc/sk4ycuYGmyN7CbO4bA7yhIW/YQbHEkOgeMy0QM+usBgZad8x5FRePxfo4v1dSzAbJwWjx87G9F1lAIRgijlD4sYni1LhSo6svptDUmIrCAOwS2raV3G02mVejbwltMOo4+cyKcGlj9CzfjCgCuS1SqAxveDiMKGAAAAdJJF1pO6hBUGkebu/SMmiFafVdLvFgpMFUFEHTvElUQhwNSp6vxJp6Rs7pOVc9zHqAAAAAI7TJuDCf7ramzTo+syb7Njf6ExD11UKNcChaeblzegRBIkg3HoWgwR0hhd4z4D5/obSjGPKpGuD+1DoyTZhC/wqOjUZ03J1EtryZrC+y1DD14b4+khQVLgOBJ9+uvshrGDbu8+7anGezOa+qWT0FopAAAAEG6p07ghODpi8DVeDQyPwMY/iu2Lh7x3JShWniQrewY2GbsACBYOPlkNNm/qSExPRMe2X7UPpdsxpUDwqbObye4EXfAabgKd9gCmj2PNdvcOQAi5rIuJSGa4Vj7AtKoW/2vpmboPoOu4IEM1YviupomCKOzhjEuOof2/y5Adfb8JUVidWqf9Ye/HtxnzTu0HbaXL7jbwsMNn5wYfZuzpmVQgEXss2KePMSkHcfScAQNglnI90YgugHGuU+/DQcfMoA0+JviFcJy13yERAueVuzrDemzc+wJaEuNDn8UiTjAdVhLcgnHqUai+4F6ONbCfH2B3ohB3hSiGB6C7hDnEyXFOO9BijCTHrxPv3yKWNkks+3JfY28m+3NO0e2tlyH71yDX0+F6U388/bvWod/u5s3MpaCibTZEYoAc4sm4jW03HFYMmvYBuWOY6rGGOgIrXxQjx98D0macJJR7Hkh7KJhMkwvtyI4MaTPJsdJGfv8I+RFROxtRM7RcFpa4J5wF/wQnpyorqchwo6xAOKYFqCqKvI9B6Y7Da7/0iOiWsjs8a4zDiYynfYavnz6SdxCMpHLgplEQlnntqCb8C3qly2s5Ko3PGWu4M8Dlfcn4TT8YenkJDJicA91nlLaE8TJbBgsvgyT+zlTsRSXlFzQc+3KfWoODKZIZqTBaRZMft3S/",
"verificationMethod":"did:example:123#key-1"
}
}
Loading