# DWN Relay Notes ## Config ```json= { "handlers": [ { "filter": { "method": "CollectionsWrite", "schema": "CredentialApplication" }, "endpoint": { "method": "POST", "url": "http://localhost:5070/v1/manifests/applications" }, "expectedResponse": { 201: { "method": "CollectionsWrite", "schema": "CredentialResponse" } } }, { "filter": { "method": "CollectionsWrite", "schema": "DIDCreation" }, "endpoint": { "method": "POST", "url": "http://localhost:5070/v1/dwn" } }, ] } ``` ## Message sent from Wallet -> DWN Relay ```json= { "descriptor": { "target": "did:example:alice", "recipient": "did:example:alice", "method": "CollectionsWrite", "protocol": "6f06bc3c-55ed-4c9f-bccf-1b4345363473", "contextId": "1", "schema": "CredentialApplication", "recordId": "aa36ec55-c59b-4f20-8143-10f74aac696d", "nonce": "AXwHbetCnCCy8Q1ZSWE5X9yH1RKZ5ZXO", "dataCid": "bafybeihuzogd3utvlrw7dr3rb4kgzu43vqhlorvpzex33prwyqb777si5e", "dateCreated": 1663632617121, "dataFormat": "application/json" }, "authorization": { "payload": "eyJkZXNjcmlwdG9yQ2lkIjoiYmFmeXJlaWVoaXVzZ214Y3Q0ejZieHg3emxsampyNzdybWdrNWlzbWZta3Rlcm1oeW5qMnp3aGkzczQifQ", "signatures": [{ "protected": "eyJhbGciOiJFUzI1NksiLCJraWQiOiJkaWQ6ZXhhbXBsZTpib2Ija2V5MSJ9", "signature": "MEUCIQC1EC1A95c9Rs-0-_11QnJ0cuedKEPwAgfmDRLK-jVUYgIgd5agGdjriekepYLe94IXvdkID4lEiSTxqDgnF7SV8bs" }] }, "encodedData": "eyAicmVxdWVzdGVyRGlkIjogImRpZDp1c2VyOjEyMyIsICJhcHBsaWNhdGlvbiI6IHsgImlkIjogIjliMWRlYjRkLTNiN2QtNGJhZC05YmRkLTJiMGQ3YjNkY2I2ZCIsICJzcGVjX3ZlcnNpb24iOiAiaHR0cHM6Ly9pZGVudGl0eS5mb3VuZGF0aW9uL2NyZWRlbnRpYWwtbWFuaWZlc3Qvc3BlYy92MS4wLjAvIiwgIm1hbmlmZXN0X2lkIjogIldBLURMLUNMQVNTLUEiLCAiZm9ybWF0IjogeyAibGRwX3ZjIjogeyAicHJvb2ZfdHlwZSI6IFsgIkpzb25XZWJTaWduYXR1cmUyMDIwIiwgIkVjZHNhU2VjcDI1NmsxU2lnbmF0dXJlMjAxOSIgXSB9IH0sICJwcmVzZW50YXRpb25fc3VibWlzc2lvbiI6IHsgImlkIjogImEzMGUzYjkxLWZiNzctNGQyMi05NWZhLTg3MTY4OWMzMjJlMiIsICJkZWZpbml0aW9uX2lkIjogIjMyZjU0MTYzLTcxNjYtNDhmMS05M2Q4LWZmMjE3YmRiMDY1MyIsICJkZXNjcmlwdG9yX21hcCI6IFt7ICJpZCI6ICJpZDEiLCAiZm9ybWF0IjogImp3dF92YyIsICJwYXRoIjogIiQudmVyaWZpYWJsZUNyZWRlbnRpYWxbMF0iIH1dIH0gfSB9" } ``` ## DWN Relay -> SSI Service `PUT - {{baseUrl}}/v1/manifests/applications` ```json= { "data": { "requesterDid": "did:user:123", "application": { "id": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", "spec_version": "https://identity.foundation/credential-manifest/spec/v1.0.0/", "manifest_id": "WA-DL-CLASS-A", "format": { "ldp_vc": { "proof_type": [ "JsonWebSignature2020", "EcdsaSecp256k1Signature2019" ] } }, "presentation_submission": { "id": "a30e3b91-fb77-4d22-95fa-871689c322e2", "definition_id": "32f54163-7166-48f1-93d8-ff217bdb0653", "descriptor_map": [{ "id": "id1", "format": "jwt_vc", "path": "$.verifiableCredential[0]" }] } } }, "dwnMessage": <raw jank> } ``` ## Synchronous Response SSI Service -> DWN Relay ```json= { "response": { "id": "536eda73-b89f-4aef-8235-292c7c03ae85", "spec_version": "https://identity.foundation/credential-manifest/spec/v1.0.0/", "manifest_id": "WA-DL-CLASS-A", "application_id": "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d", "fulfillment": { "descriptor_map": [ { "id": "id1", "format": "jwt_vc", "path": "$.verifiableCredential[0]" } ] } }, "credentials": [ { "@context": [ "https://www.w3.org/2018/credentials/v1" ], "id": "a4a9e17b-b865-4cae-8085-ceb5584c18ea", "type": [ "VerifiableCredential" ], "issuer": "did:example:123?linked-domains=3", "issuanceDate": "2022-09-23T20:15:18Z", "credentialSubject": { "id": "did:user:123" } } ] } ``` ## DWN Relay -> Wallet ### Expected Response Fromat from DWNs ```json= { "replies": [ { "status": { "code": 200, "detail": "OK" }, "entries": [] } ] } ``` - Where does `status.code` come from? - downstream service's `response.status` - Where does `status.detail` come from? - Auto-generated by relay service based on `response.status` - Where do the entries come from? ```json= { "descriptor": { "target": "did:example:alice", "recipient": "did:example:alice", "method": "CollectionsWrite", "protocol": "6f06bc3c-55ed-4c9f-bccf-1b4345363473", "contextId": "bob email X", "schema": "CredentialApplication", "recordId": "aa36ec55-c59b-4f20-8143-10f74aac696d", "nonce": "AXwHbetCnCCy8Q1ZSWE5X9yH1RKZ5ZXO", "dataCid": "bafybeihuzogd3utvlrw7dr3rb4kgzu43vqhlorvpzex33prwyqb777si5e", "dateCreated": 1663632617121, "dataFormat": "application/json" }, "authorization": { "payload": "eyJkZXNjcmlwdG9yQ2lkIjoiYmFmeXJlaWVoaXVzZ214Y3Q0ejZieHg3emxsampyNzdybWdrNWlzbWZta3Rlcm1oeW5qMnp3aGkzczQifQ", "signatures": [{ "protected": "eyJhbGciOiJFUzI1NksiLCJraWQiOiJkaWQ6ZXhhbXBsZTpib2Ija2V5MSJ9", "signature": "MEUCIQC1EC1A95c9Rs-0-_11QnJ0cuedKEPwAgfmDRLK-jVUYgIgd5agGdjriekepYLe94IXvdkID4lEiSTxqDgnF7SV8bs" }] }, "encodedData": "ZGF0YSBmcm9tIGJvYg" } ``` * Where does `descriptor.target` come from? * Moe figures out how to cache this in memory on inbound message ingest * Neal has to provide it explicitly * Where does `descriptor.recipient` come from? * Same as `descriptor.target` * Where does `descriptor.method` come from? * Default to `CollectionsWrite` if response.status is `200 >= x <= 299` * where does `descriptor.protocol` come from? * IDFK ????? Feels like it has to come from downstream service but i really don't want that * where does `descriptor.contextId` come from? * IDFK ????? Feels like it has to come from downstream service but i really don't want that * where does `descriptor.schema` come from? * Has to be provided by downstream service