Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: outbound message send via session #1335

Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a56036a
chore: wip outbound message send via session
Feb 17, 2023
b3c7a54
chore: make some progress add some logging
Feb 17, 2023
356a0b5
chore: wip - possibly working
Feb 17, 2023
ff98207
chore: wip broken
Feb 21, 2023
b8a9b47
chore: almost there
Feb 21, 2023
27cc421
chore: still need to tidy up but it worx
Feb 21, 2023
8e2148f
feat: use session based connection for sending without outbound
Feb 22, 2023
ec30c75
feat: added protocol v2 tests and renamed test files
jimezesinachi Feb 22, 2023
634a86f
chore: minor cosmetics of test naming
Feb 22, 2023
6f98f98
chore: code review feedback
Feb 23, 2023
fc573c0
chore: merge remote-tracking branch 'upstream/main' into feat/outboun…
Feb 23, 2023
a599cfb
chore: code review feedback
Feb 24, 2023
42104f1
chore: code review feedback working with debug log
Feb 28, 2023
d42fc89
chore: code review feedback
Feb 28, 2023
88e8172
chore: lint
Feb 28, 2023
aa5a5d7
chore: fix typing and logic for agentcontext optional
Feb 28, 2023
28bdc73
chore: remove non-applicable tests
Mar 1, 2023
d6dc513
Merge remote-tracking branch 'upstream/main' into feat/outbound-messa…
TimoGlastra Mar 8, 2023
32c9a29
chore: small tweaks
TimoGlastra Mar 8, 2023
1f8cc8b
chore: additional tweaks
TimoGlastra Mar 8, 2023
d918b3f
refactor: session logic
TimoGlastra Mar 8, 2023
c37d970
refactor: more tweaks
TimoGlastra Mar 8, 2023
8932ec2
keep aligned with previous implementations
TimoGlastra Mar 8, 2023
03e79f6
restore tests
TimoGlastra Mar 8, 2023
5f6dbb2
fix tests
TimoGlastra Mar 8, 2023
547372a
Merge branch 'main' into feat/outbound-message-send-via-session
morrieinmaas Mar 9, 2023
89019af
Merge branch 'main' into feat/outbound-message-send-via-session
TimoGlastra Mar 11, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Attachment,
AttachmentData,
ProofEventTypes,
ReturnRouteTypes,
} from '../../../../../../core/src'
import { uuid } from '../../../../../../core/src/utils/uuid'
import {
Expand Down Expand Up @@ -244,6 +245,102 @@ describe('V1 Proofs - Connectionless - Indy', () => {
})
})

test('Faber starts with connection-less proof requests to Alice with auto-accept enabled and without an outbound transport', async () => {
const {
holderAgent: aliceAgent,
issuerAgent: faberAgent,
holderReplay: aliceReplay,
credentialDefinitionId,
issuerReplay: faberReplay,
issuerHolderConnectionId: faberConnectionId,
} = await setupAnonCredsTests({
issuerName: 'Faber v1 connection-less Proofs - Always',
holderName: 'Alice v1 connection-less Proofs - Always',
autoAcceptProofs: AutoAcceptProof.Always,
attributeNames: ['name', 'age'],
})

await issueLegacyAnonCredsCredential({
issuerAgent: faberAgent,
holderAgent: aliceAgent,
issuerReplay: faberReplay,
holderReplay: aliceReplay,
issuerHolderConnectionId: faberConnectionId,
offer: {
credentialDefinitionId,
attributes: [
{
name: 'name',
value: 'John',
},
{
name: 'age',
value: '99',
},
],
},
})

agents = [aliceAgent, faberAgent]

const { message, proofRecord: faberProofExchangeRecord } = await faberAgent.proofs.createRequest({
protocolVersion: 'v1',
proofFormats: {
indy: {
name: 'test-proof-request',
version: '1.0',
requested_attributes: {
name: {
name: 'name',
restrictions: [
{
cred_def_id: credentialDefinitionId,
},
],
},
},
requested_predicates: {
age: {
name: 'age',
p_type: '>=',
p_value: 50,
restrictions: [
{
cred_def_id: credentialDefinitionId,
},
],
},
},
},
},
autoAcceptProof: AutoAcceptProof.ContentApproved,
})

message.setService({
morrieinmaas marked this conversation as resolved.
Show resolved Hide resolved
recipientKeys: [faberAgent.config.walletConfig?.key ?? ''],
serviceEndpoint: message.service?.serviceEndpoint ?? 'rxjs:faber',
})

const { message: requestMessage } = await faberAgent.oob.createLegacyConnectionlessInvitation({
recordId: faberProofExchangeRecord.id,
message,
domain: 'https://a-domain.com',
})

await faberAgent.resetOutboundTransport()
message.setReturnRouting(ReturnRouteTypes.all, message.threadId)

await aliceAgent.receiveMessage(requestMessage.toJSON())

await waitForProofExchangeRecordSubject(aliceReplay, {
state: ProofState.Done,
})

await waitForProofExchangeRecordSubject(faberReplay, {
state: ProofState.Done,
})
})

test('Faber starts with connection-less proof requests to Alice with auto-accept enabled and both agents having a mediator', async () => {
testLogger.test('Faber sends presentation request to Alice')

Expand Down
Loading