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

Commit

Permalink
feat: Add [waci-issuance] bdd tests
Browse files Browse the repository at this point in the history
partof #595

Signed-off-by: talwinder50 <[email protected]>
  • Loading branch information
talwinder50 committed Feb 17, 2022
1 parent 120025c commit fa276a9
Show file tree
Hide file tree
Showing 5 changed files with 491 additions and 35 deletions.
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: 114 additions & 0 deletions test/bdd/fixtures/testdata/manifest-config/cmdescriptors.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,119 @@
"challenge":"508adef4-b8e0-4edf-a53d-a260371c1423",
"domain":"9rf25a28rs96"
}
},
"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"
}
}
}
],
"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"
}
}
]
}
}
],
"options":{
"challenge":"508adef4-b8e0-4edf-a53d-a260371c1423",
"domain":"9rf25a28rs96"
}
}
}
Loading

0 comments on commit fa276a9

Please sign in to comment.