Skip to content

Commit

Permalink
Merge pull request #2 from impactility/credentials-api
Browse files Browse the repository at this point in the history
feat: integrate credo in credentials api
  • Loading branch information
jrhender authored Sep 24, 2024
2 parents 34e64da + d949d4f commit 2235732
Show file tree
Hide file tree
Showing 37 changed files with 666 additions and 577 deletions.
129 changes: 59 additions & 70 deletions apps/vc-api/docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@
"KeyDescriptionDto": {
"type": "object",
"properties": {
"keyId": { "type": "string", "description": "id of key (for example, JWK thumbprint)" }
"keyId": { "type": "string", "description": "id of key (for example, public key base58 string)" }
},
"required": ["keyId"]
},
Expand All @@ -653,14 +653,15 @@
},
"required": ["statusCode", "message", "error"]
},
"DidMethod": { "type": "string", "enum": ["key", "ethr"] },
"DidMethod": {
"type": "string",
"description": "DID Method to create.\nMust be one of \"key\" or \"ethr\"",
"enum": ["key", "ethr"]
},
"CreateDidOptionsDto": {
"type": "object",
"properties": {
"method": {
"description": "DID Method to create.\nMust be one of \"key\" or \"ethr\"",
"$ref": "#/components/schemas/DidMethod"
},
"method": { "$ref": "#/components/schemas/DidMethod" },
"keyId": {
"type": "string",
"description": "id of key (for example, JWK thumbprint).\nThis key must be known to the server already.\nIf provided, DID will be created using this key.\nCurrently only supported for did:key."
Expand Down Expand Up @@ -801,64 +802,36 @@
},
"required": ["@context", "type", "issuer", "issuanceDate", "credentialSubject", "proof"]
},
"ProofPurpose": {
"type": "string",
"enum": [
"assertionMethod",
"authentication",
"keyAgreement",
"contactAgreement",
"capabilityInvocation",
"capabilityDelegation"
]
},
"VerifyOptionsDto": {
"type": "object",
"properties": {
"verificationMethod": {
"type": "string",
"description": "The URI of the verificationMethod used for the proof. Default assertionMethod URI."
},
"proofPurpose": {
"description": "The purpose of the proof. Default 'assertionMethod'.",
"$ref": "#/components/schemas/ProofPurpose"
},
"created": {
"type": "string",
"description": "The date and time of the proof (with a maximum accuracy in seconds). Default current system time."
},
"challenge": {
"type": "string",
"description": "A challenge provided by the requesting party of the proof. For example 6e62f66e-67de-11eb-b490-ef3eeefa55f2"
},
"domain": {
"type": "string",
"description": "The intended domain of validity for the proof. For example website.example"
}
}
},
"VerifyCredentialDto": {
"type": "object",
"properties": {
"verifiableCredential": {
"description": "A JSON-LD Verifiable Credential with a proof. https://w3c-ccg.github.io/vc-api/issuer.html#operation/issueCredential",
"allOf": [{ "$ref": "#/components/schemas/VerifiableCredentialDto" }]
},
"options": {
"description": "Parameters for verifying a verifiable credential or a verifiable presentation https://w3c-ccg.github.io/vc-api/verifier.html#operation/verifyCredential https://w3c-ccg.github.io/vc-api/verifier.html#operation/verifyPresentation",
"allOf": [{ "$ref": "#/components/schemas/VerifyOptionsDto" }]
}
},
"required": ["verifiableCredential", "options"]
"required": ["verifiableCredential"]
},
"VerificationResultDto": {
"type": "object",
"properties": {
"checks": { "description": "The checks performed", "type": "array", "items": { "type": "string" } },
"warnings": { "description": "Warnings", "type": "array", "items": { "type": "string" } },
"errors": { "description": "Errors", "type": "array", "items": { "type": "string" } }
"errors": { "description": "Errors", "type": "array", "items": { "type": "string" } },
"verified": { "type": "boolean", "description": "Is the credential valid" }
},
"required": ["checks", "warnings", "errors"]
"required": ["warnings", "errors", "verified"]
},
"ProofPurpose": {
"type": "string",
"description": "The purpose of the proof. Default 'assertionMethod'.",
"enum": [
"assertionMethod",
"authentication",
"keyAgreement",
"contactAgreement",
"capabilityInvocation",
"capabilityDelegation"
]
},
"ProvePresentationOptionsDto": {
"type": "object",
Expand All @@ -871,10 +844,7 @@
"type": "string",
"description": "The URI of the verificationMethod used for the proof. Default assertionMethod URI."
},
"proofPurpose": {
"description": "The purpose of the proof. Default 'assertionMethod'.",
"$ref": "#/components/schemas/ProofPurpose"
},
"proofPurpose": { "$ref": "#/components/schemas/ProofPurpose" },
"created": {
"type": "string",
"description": "The date and time of the proof (with a maximum accuracy in seconds). Default current system time."
Expand Down Expand Up @@ -969,6 +939,28 @@
},
"required": ["presentation", "options"]
},
"VerifyOptionsDto": {
"type": "object",
"properties": {
"verificationMethod": {
"type": "string",
"description": "The URI of the verificationMethod used for the proof. Default assertionMethod URI."
},
"proofPurpose": { "$ref": "#/components/schemas/ProofPurpose" },
"created": {
"type": "string",
"description": "The date and time of the proof (with a maximum accuracy in seconds). Default current system time."
},
"challenge": {
"type": "string",
"description": "A challenge provided by the requesting party of the proof. For example 6e62f66e-67de-11eb-b490-ef3eeefa55f2"
},
"domain": {
"type": "string",
"description": "The intended domain of validity for the proof. For example website.example"
}
}
},
"VerifyPresentationDto": {
"type": "object",
"properties": {
Expand All @@ -989,12 +981,7 @@
},
"ExchangeInteractServiceDefinitionDto": {
"type": "object",
"properties": {
"type": {
"description": "The \"type\" of the interact service.\nSee Verifiable Presentation Request [Interaction Types](https://w3c-ccg.github.io/vp-request-spec/#interaction-types) for background.",
"$ref": "#/components/schemas/VpRequestInteractServiceType"
}
},
"properties": { "type": { "$ref": "#/components/schemas/VpRequestInteractServiceType" } },
"required": ["type"]
},
"PresentationDefinitionDto": {
Expand All @@ -1016,14 +1003,15 @@
"required": ["presentationDefinition"]
},
"VpRequestDidAuthQueryDto": { "type": "object", "properties": {} },
"VpRequestQueryType": { "type": "string", "enum": ["DIDAuth", "PresentationDefinition"] },
"VpRequestQueryType": {
"type": "string",
"description": "Query types as listed in the VP Request spec.\nhttps://w3c-ccg.github.io/vp-request-spec/#query-and-response-types\n\nThe \"PresentationDefinition\" type is proposed here: https://github.com/w3c-ccg/vp-request-spec/issues/7",
"enum": ["DIDAuth", "PresentationDefinition"]
},
"VpRequestQueryDto": {
"type": "object",
"properties": {
"type": {
"description": "Query types as listed in the VP Request spec.\nhttps://w3c-ccg.github.io/vp-request-spec/#query-and-response-types\n\nThe \"PresentationDefinition\" type is proposed here: https://github.com/w3c-ccg/vp-request-spec/issues/7",
"$ref": "#/components/schemas/VpRequestQueryType"
},
"type": { "$ref": "#/components/schemas/VpRequestQueryType" },
"credentialQuery": {
"type": "array",
"description": "The credential query.\nIt should correspond to the query type.",
Expand Down Expand Up @@ -1169,14 +1157,15 @@
},
"required": ["transactionId", "exchangeId", "vpRequest"]
},
"ReviewResult": { "type": "string", "enum": ["approved", "rejected"] },
"ReviewResult": {
"type": "string",
"description": "The judgement made by the reviewer",
"enum": ["approved", "rejected"]
},
"SubmissionReviewDto": {
"type": "object",
"properties": {
"result": {
"description": "The judgement made by the reviewer",
"$ref": "#/components/schemas/ReviewResult"
},
"result": { "$ref": "#/components/schemas/ReviewResult" },
"vp": {
"description": "A reviewer may want to include credentials (wrapped in a VP) to the holder",
"allOf": [{ "$ref": "#/components/schemas/VerifiablePresentationDto" }]
Expand Down
1 change: 0 additions & 1 deletion apps/vc-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"rxjs": "^7.8.1",
"typeorm": "^0.3.17",
"better-sqlite3": "~8.4.0",
"@spruceid/didkit-wasm-node": "~0.2.1",
"did-resolver": "~4.1.0",
"class-validator": "~0.14.0",
"class-transformer": "~0.5.1",
Expand Down
10 changes: 8 additions & 2 deletions apps/vc-api/src/credo/__mocks__/credo.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ export const mockCredoService = {
},
agent: {
wallet: {
createKey: jest.fn()
createKey: jest.fn()
},
w3cCredentials: {
signCredential: jest.fn(),
verifyCredential: jest.fn(),
signPresentation: jest.fn(),
verifyPresentation: jest.fn()
}
}
};
};
Loading

0 comments on commit 2235732

Please sign in to comment.