Skip to content

Commit

Permalink
support for didexchange and conenction reuse
Browse files Browse the repository at this point in the history
Signed-off-by: Clécio Varjão <[email protected]>
  • Loading branch information
cvarjao committed Oct 29, 2024
1 parent 08aeeca commit 9e7a0e4
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions src/AgentCredo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ export const createAgent = async (
//console.log(`Mediator URL:${config.mediatorInvitationUrl}`)
//const wallet = agent.dependencyManager.resolve(InjectionSymbols.Wallet) as AskarWallet
//console.dir(wallet)
/*
try {
fs.rmSync(path.join(homedir(), ".afj"), {
recursive: true,
Expand All @@ -152,6 +153,7 @@ export const createAgent = async (
} catch (error) {
console.log(error);
}
*/
console.dir(agentConfig.walletConfig);
/*
try {
Expand Down Expand Up @@ -301,6 +303,7 @@ export class AgentCredo implements AriesAgent {
} = await this.agent.oob.receiveInvitation(invitation, {
autoAcceptInvitation: true,
autoAcceptConnection: true,
reuseConnection: true,
});
const invitationRequestsThreadIds =
outOfBandRecord.getTags().invitationRequestsThreadIds;
Expand Down
13 changes: 8 additions & 5 deletions src/AgentTraction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -531,18 +531,19 @@ export class AgentTraction implements AriesAgent {
"my_label":`Faber\`s 😇 - ${new Date().getTime()}`,
"handshake_protocols": [invitationType.substring(6)],
}
const params = {
"auto_accept": true,
"multi_use": false,
"create_unique_did": false,
}
if (invitationType === INVITATION_TYPE.OOB_DIDX_1_1){
Object.assign(payload, {
"protocol_version":"1.1",
"use_did_method": "did:peer:4",
})
}
return http.post(`/out-of-band/create-invitation`,payload, {
params: {
"auto_accept": true,
"multi_use": false,
"create_unique_did": false,
},
params: params,
headers:{
'Content-Type': 'application/json',
'Authorization': `Bearer ${config.auth_token}`
Expand Down Expand Up @@ -582,6 +583,8 @@ export class AgentTraction implements AriesAgent {
return this.__createInvitationToConnectConnV1() as Promise<CreateInvitationResponse<typeof invitationType>>
case INVITATION_TYPE.OOB_CONN_1_0:
return this.createOOBInvitationToConnect(invitationType) as Promise<CreateInvitationResponse<typeof invitationType>>
case INVITATION_TYPE.OOB_DIDX_1_1:
return this.createOOBInvitationToConnect(invitationType) as Promise<CreateInvitationResponse<typeof invitationType>>
default:
throw new Error("Invalid invitation type");
}
Expand Down
6 changes: 3 additions & 3 deletions src/attestation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ describe("AppAttestation", () => {
const _logger = pino({ level: 'trace', timestamp: pino.stdTimeFunctions.isoTime, }, loggerTransport);
const logger = new PinoLogger(_logger, LogLevel.trace)
// eslint-disable-next-line @typescript-eslint/no-var-requires
const config = require("../local.env.json")["sovrin_testnet"];
const config = require("../local.env.json");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const ledgers = require("../ledgers.json");
const agentA = new AgentTraction(config, logger);
const agentA = new AgentTraction(config.issuer, logger);
//const agentB: AriesAgent = new AgentManual(config, new ConsoleLogger(LogLevel.trace))
const agentB: AriesAgent = process.env.HOLDER_TYPE === 'manual' ? new AgentManual(config, logger) : new AgentCredo(config, ledgers, logger)
const agentB: AriesAgent = process.env.HOLDER_TYPE === 'manual' ? new AgentManual(config.holder, logger) : new AgentCredo(config.holder, ledgers, logger)
//new PinoLogger(logger, LogLevel.trace));
const schema = new SchemaBuilder().setName('app_attestation').setVersion('1.0').setSchemaId('NXp6XcGeCR2MviWuY51Dva:2:app_attestation:1.0')
const credDef = new CredentialDefinitionBuilder()
Expand Down
2 changes: 1 addition & 1 deletion src/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ describe("Mandatory", () => {
logger.info('Message Received:', msgRcvd)
//expect(requests).toMatchSnapshot();
}, shortTimeout);
test.skip("OOB/connected/messaging", async () => {
test("OOB/connected/messaging", async () => {
const issuer = agentIssuer
const holder = agentB
logger.info(`Executing ${expect.getState().currentTestName}`)
Expand Down

0 comments on commit 9e7a0e4

Please sign in to comment.