Open trta2352 opened 8 months ago
Hey @trta2352, thanks for raising this issue, which version of Credo are you using?
Also -- which version of the proof protocol are you using?
This are all related packages:
"@aries-framework/anoncreds": "0.4.2",
"@aries-framework/anoncreds-rs": "0.4.2",
"@aries-framework/askar": "0.4.2",
"@aries-framework/core": "0.4.2",
"@aries-framework/indy-sdk": "^0.4.2",
"@aries-framework/indy-vdr": "0.4.2",
"@aries-framework/react-hooks": "0.5.0",
"@aries-framework/react-native": "0.4.2",
"@hyperledger/anoncreds-react-native": "0.1.0",
"@hyperledger/aries-askar-react-native": "0.1.0",
"@hyperledger/indy-vdr-react-native": "0.1.0",
And we are using v1 version of the proof protocol.
Just for reference here is also our agent setup:
const config: InitConfig = {
label: 'redacted-wallet-label',
logger: ariesAnalytics,
autoUpdateStorageOnStartup: true,
walletConfig: {
id: walletId,
key: code,
},
};
// ID manager uses V1 protocol which is only compatible with LegacyIndyCredentialFormatService
const legacyIndyCredentialFormatService = new LegacyIndyCredentialFormatService();
const legacyIndyProofFormatService = new LegacyIndyProofFormatService();
const agent = new Agent({
config,
dependencies: agentDependencies,
modules: {
// Askar handles the wallet functionalities
askar: new AskarModule({
ariesAskar,
}),
connections: new ConnectionsModule({ autoAcceptConnections: true }),
credentials: new CredentialsModule({
autoAcceptCredentials: AutoAcceptCredential.ContentApproved,
credentialProtocols: [
new V1CredentialProtocol({
indyCredentialFormat: legacyIndyCredentialFormatService,
}),
new V2CredentialProtocol({
credentialFormats: [
legacyIndyCredentialFormatService,
new AnonCredsCredentialFormatService(),
],
}),
],
}),
mediationRecipient: new MediationRecipientModule({
mediatorInvitationUrl: MEDIATOR_CONNECTIONS_INVITE,
mediatorPickupStrategy: MediatorPickupStrategy.Implicit,
mediatorPollingInterval: appConfig.debugApp ? 10000 : 5000,
}),
// Proof management
proofs: new ProofsModule({
autoAcceptProofs: AutoAcceptProof.Always,
proofProtocols: [
new V1ProofProtocol({
indyProofFormat: legacyIndyProofFormatService,
}),
// V2 protocol is setup, but it is not being used.
new V2ProofProtocol({
proofFormats: [legacyIndyProofFormatService, new AnonCredsProofFormatService()],
}),
],
}),
anoncredsRs: new AnonCredsRsModule({
anoncreds,
}),
anoncreds: new AnonCredsModule({
registries: [new IndyVdrAnonCredsRegistry(), new IndySdkAnonCredsRegistry()],
}),
// indyVdr handles the ledger functionalities.
indyVdr: new IndyVdrModule({
indyVdr,
networks: [
{
isProduction: appConfig.testEnv,
indyNamespace: 'did:sov',
genesisTransactions: genesis,
connectOnStartup: true,
},
],
}),
},
});
agent.registerOutboundTransport(new HttpOutboundTransport());
agent.registerOutboundTransport(new WsOutboundTransport());
await agent.initialize();
@TimoGlastra Any suggestions or is upgrading to V2 protocol the only option?
@TimoGlastra Issue resolved. If you provide a custom proof format then selectedCredentials.selfAttestedAttributes
is not present.
diff --git a/node_modules/@aries-framework/anoncreds-rs/build/services/AnonCredsRsHolderService.js b/node_modules/@aries-framework/anoncreds-rs/build/services/AnonCredsRsHolderService.js
index 0d2263e..707afcb 100644
--- a/node_modules/@aries-framework/anoncreds-rs/build/services/AnonCredsRsHolderService.js
+++ b/node_modules/@aries-framework/anoncreds-rs/build/services/AnonCredsRsHolderService.js
@@ -107,6 +107,11 @@ let AnonCredsRsHolderService = class AnonCredsRsHolderService {
if (!linkSecretRecord.value) {
throw new AnonCredsRsError_1.AnonCredsRsError('Link Secret value not stored');
}
+
+ if (!selectedCredentials.selfAttestedAttributes ) {
+ selectedCredentials.selfAttestedAttributes = {}
+ }
presentation = anoncreds_shared_1.Presentation.create({
credentialDefinitions: rsCredentialDefinitions,
schemas: rsSchemas,
Ah okay, we should fix this, so reopening this issue. Thanks for figuring this out!
Wallet has 4 credentials. 2 times
name_credential
(same credential definition, different data) and 2 timesemail_credential
(same credential definition, but different data). User then receives a proof challenge asking for both types of credentials. To fulfil the proof challenge user has to share 1name_credential
and 1email_credential
. But sine they have 2 of each type they have to choose which ones to share.Using the following code I accept the proof challenge and I provide it with the filtered proof format containing the credentials I want to share.
Agent in this case completely disregards what I added in the
proofFormats
parameter and defaults to the credentials it deems that fulfil the proof challenge.Using this code:
I get this:
So even though Aries knows that multiple credentials fulfil the proof challenge it automatically reverts to the first credential that was added per credential definition. In this case for
name_credential
thats "Name 2" and foremail_credential
is "mail2@gmail.com".