diff --git a/.github/workflows/test-harness-acapy-afj.yml b/.github/workflows/test-harness-acapy-afj.yml index a574ba81..b61b3942 100644 --- a/.github/workflows/test-harness-acapy-afj.yml +++ b/.github/workflows/test-harness-acapy-afj.yml @@ -45,7 +45,7 @@ jobs: with: BUILD_AGENTS: "-a acapy-main -a javascript" TEST_AGENTS: "-d acapy-main -b javascript" - TEST_SCOPE: "-t @AcceptanceTest -t @AIP10,@revocation -t ~@wip -t ~@DIDExchangeConnection" + TEST_SCOPE: "-t @AcceptanceTest -t @AIP10,@RFC0441 -t ~@wip -t ~@DIDExchangeConnection" REPORT_PROJECT: acapy-b-javascript continue-on-error: true - name: run-send-gen-test-results-secure diff --git a/aries-backchannels/javascript/server/src/TestAgent.ts b/aries-backchannels/javascript/server/src/TestAgent.ts index 9420efe9..896c57ff 100644 --- a/aries-backchannels/javascript/server/src/TestAgent.ts +++ b/aries-backchannels/javascript/server/src/TestAgent.ts @@ -1,6 +1,7 @@ import { $log } from '@tsed/common' import { Agent, HttpOutboundTransport, InitConfig, WsOutboundTransport } from '@aries-framework/core' import { agentDependencies, HttpInboundTransport } from '@aries-framework/node' +import indy from 'indy-sdk' import { TsedLogger } from './TsedLogger' @@ -23,6 +24,14 @@ export async function createAgent({ // TODO: Schema is prob already registered $log.level = 'debug' + // @ts-ignore + indy.setLogger(function (level: string, target: string, message: string, modulePath: string, file: string, line: string) { + console.log('libindy said:', level, target, message, modulePath, file, line) + }) + + // @ts-ignore + indy.setRuntimeConfig({ collect_backtrace: true }) + const agentConfig: InitConfig = { label: agentName, walletConfig: { diff --git a/aries-backchannels/javascript/server/src/controllers/PresentProofController.ts b/aries-backchannels/javascript/server/src/controllers/PresentProofController.ts index 95e5c1ca..92fd6338 100644 --- a/aries-backchannels/javascript/server/src/controllers/PresentProofController.ts +++ b/aries-backchannels/javascript/server/src/controllers/PresentProofController.ts @@ -7,16 +7,17 @@ import { ProofRequest, RequestedCredentials, ProofRecord, - IndyCredentialInfo, AgentConfig, Logger, ProofEventTypes, ProofStateChangedEvent, ProofState, + RequestedAttribute, + RequestedPredicate, } from '@aries-framework/core' -import { CredentialUtils } from '../utils/CredentialUtils' import { ProofUtils } from '../utils/ProofUtils' import { filter, firstValueFrom, ReplaySubject, timeout } from 'rxjs' +import util from 'util' @Controller('/agent/command/proof') export class PresentProofController { @@ -135,31 +136,33 @@ export class PresentProofController { RequestedCredentials ) - this.logger.info('Created requested credentials ', { - requestedCredentials: JSON.stringify(requestedCredentials.toJSON(), null, 2), + const retrievedCredentials = await this.agent.proofs.getRequestedCredentialsForProofRequest(proofRecord.id, { + filterByPresentationPreview: true, + // Some tests include presenting a revoked credential, expecting the verification to fail + // So not excluding those from the retrieved credentials. + filterByNonRevocationRequirements: false, }) - const credentialUtils = new CredentialUtils(this.agent) - Object.values(requestedCredentials.requestedAttributes).forEach(async (requestedAttribute) => { - const credentialInfo = JsonTransformer.fromJSON( - await credentialUtils.getIndyCredentialById(requestedAttribute.credentialId), - IndyCredentialInfo - ) - requestedAttribute.credentialInfo = credentialInfo + this.logger.info('Created proof request', { + requestedCredentials: util.inspect(requestedCredentials, { showHidden: false, depth: null }), + retrievedCredentials: util.inspect(retrievedCredentials, { showHidden: false, depth: null }), }) - Object.values(requestedCredentials.requestedPredicates).forEach(async (requestedPredicate) => { - const credentialInfo = JsonTransformer.fromJSON( - await credentialUtils.getIndyCredentialById(requestedPredicate.credentialId), - IndyCredentialInfo - ) - requestedPredicate.credentialInfo = credentialInfo + + Object.keys(requestedCredentials.requestedAttributes).forEach((key) => { + requestedCredentials.requestedAttributes[key] = retrievedCredentials.requestedAttributes[key].find( + (a) => a.credentialId === requestedCredentials.requestedAttributes[key].credentialId + ) as RequestedAttribute }) - this.logger.info('Created proof request ', { - requestedCredentials: requestedCredentials.toJSON(), + Object.keys(requestedCredentials.requestedPredicates).forEach((key) => { + requestedCredentials.requestedPredicates[key] = retrievedCredentials.requestedPredicates[key].find( + (p) => p.credentialId === requestedCredentials.requestedPredicates[key].credentialId + ) as RequestedPredicate }) - proofRecord = await this.agent.proofs.acceptRequest(proofRecord.id, requestedCredentials, { comment: data.comment }) + proofRecord = await this.agent.proofs.acceptRequest(proofRecord.id, requestedCredentials, { + comment: data.comment, + }) return this.mapProofRecord(proofRecord) } diff --git a/aries-test-harness/features/0183-revocation.feature b/aries-test-harness/features/0183-revocation.feature index a886d0a2..049b03aa 100644 --- a/aries-test-harness/features/0183-revocation.feature +++ b/aries-test-harness/features/0183-revocation.feature @@ -59,7 +59,7 @@ Feature: RFC 0183 Aries agent credential revocation and revocation notification | issuer | credential_data | request_for_proof | presentation | | Acme | Data_DL_MaxValues | proof_request_DL_revoc_address | presentation_DL_revoc_address | - @T002-HIPE0011 @critical @AcceptanceTest @Schema_DriversLicense_Revoc @Indy + @T002-HIPE0011 @critical @AcceptanceTest @Schema_DriversLicense_Revoc @Indy @RFC0441 Scenario Outline: Credential revoked and replaced with a new updated credential, holder proves claims with the updated credential with timesstamp Given "2" agents | name | role | @@ -329,7 +329,7 @@ Feature: RFC 0183 Aries agent credential revocation and revocation notification | issuer | credential_data | request_for_proof | presentation | | Acme | Data_DL_MaxValues | proof_request_DL_revoc_address | presentation_DL_revoc_address | - @T013-HIPE0011 @normal @AcceptanceTest @Schema_DriversLicense @Indy + @T013-HIPE0011 @normal @AcceptanceTest @Schema_DriversLicense @Indy @RFC0441 Scenario Outline: Non-revocable Credential, not revoked, and holder proves claims with the credential with timesstamp Given "2" agents | name | role | @@ -346,7 +346,7 @@ Feature: RFC 0183 Aries agent credential revocation and revocation notification | issuer | credential_data | timeframe | request_for_proof | presentation | | Acme | Data_DL_MinValues | now:now | proof_request_DL_address | presentation_DL_address_w_ts | - @T014-HIPE0011 @normal @AcceptanceTest @Schema_DriversLicense_Revoc @Indy + @T014-HIPE0011 @normal @AcceptanceTest @Schema_DriversLicense_Revoc @Indy @RFC0441 Scenario Outline: Revocable Credential, not revoked, and holder proves claims with the credential with timesstamp Given "2" agents | name | role |