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

fix/transport connection id #24

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
dad975d
fix: expose oob domain (#990)
janrtvld Aug 24, 2022
f90a27b
test(credentials): fix flaky tests with events (#966)
2byrds Aug 26, 2022
5f91738
feat: bbs createKey, sign and verify (#684)
berendsliedrecht May 2, 2022
ea34c47
feat: jsonld-credential support (#718)
karimStekelenburg May 19, 2022
c751e28
fix: peer dependency for rn bbs signatures (#785)
TimoGlastra May 20, 2022
38cb106
fix: invalid injection symbols in W3cCredService (#786)
karimStekelenburg May 20, 2022
a769cb8
refactor: change hardcoded URLs to constants
karimStekelenburg May 24, 2022
550ea15
refactor: move signatures suites to vc module (#801)
TimoGlastra May 31, 2022
b47cfcb
refactor!: add agent context (#920)
TimoGlastra Jul 6, 2022
a1b1e5a
feat: add agent context provider (#921)
TimoGlastra Jul 7, 2022
113a575
feat: add base agent class (#922)
TimoGlastra Jul 8, 2022
7cbd08c
feat(tenants): initial tenants module (#932)
TimoGlastra Jul 11, 2022
adfa65b
feat(tenants): tenant lifecycle (#942)
TimoGlastra Jul 13, 2022
1e708e9
feat(ledger): smart schema and credential definition registration (#900)
morrieinmaas Jul 14, 2022
ab8b8ef
feat: add dynamic suite and signing provider (#949)
TimoGlastra Jul 19, 2022
7cbccb1
refactor!: module to api and module config (#943)
TimoGlastra Jul 19, 2022
be37011
feat(vc): delete w3c credential record (#886)
karimStekelenburg Jul 21, 2022
80c3740
fix(vc): change pubKey input from Buffer to Uint8Array (#935)
karimStekelenburg Jul 21, 2022
93f3c93
feat(dids): add did registrar (#953)
TimoGlastra Jul 21, 2022
ed69dac
feat: fetch verification method types by proof type (#913)
karimStekelenburg Aug 11, 2022
f38ac05
feat: add present proof v2 (#979)
NB-MikeRichardson Aug 17, 2022
c99f3c9
feat: OOB public did (#930)
Iskander508 Aug 29, 2022
69d4906
feat(routing): manual mediator pickup lifecycle management (#989)
genaris Aug 30, 2022
4ef8f79
docs(demo): faber creates invitation (#995)
conanoc Aug 30, 2022
f487182
chore(release): v0.2.3 (#999)
github-actions[bot] Aug 30, 2022
4b90e87
fix(question-answer): question answer protocol state/role check (#1001)
genaris Aug 31, 2022
60a8091
feat: Action Menu protocol (Aries RFC 0509) implementation (#974)
genaris Sep 1, 2022
f0ca8b6
fix(ledger): remove poolConnected on pool close (#1011)
niall-shaw Sep 6, 2022
4ca56f6
fix(ledger): check taa version instad of aml version (#1013)
jakubkoci Sep 6, 2022
856f40d
chore: add @janrtvld to maintainers (#1016)
TimoGlastra Sep 7, 2022
543437c
feat(routing): add settings to control back off strategy on mediator …
garretaserra Sep 8, 2022
dba46c3
feat(proofs): delete associated didcomm messages (#1021)
TimoGlastra Sep 9, 2022
2cfadd9
fix: avoid crash when an unexpected message arrives (#1019)
Iskander508 Sep 9, 2022
5cdcfa2
fix: unable to resolve nodejs document loader in react native environ…
karimStekelenburg Sep 9, 2022
273e353
feat!: Discover Features V2 (#991)
genaris Sep 9, 2022
82a17a3
feat!: agent module registration api (#955)
TimoGlastra Sep 10, 2022
c789081
chore(release): v0.2.4 (#1024)
github-actions[bot] Sep 13, 2022
8efade5
feat: use did:key flag (#1029)
genaris Sep 20, 2022
26bb9c9
feat(proofs): add getRequestedCredentialsForProofRequest (#1028)
NB-MikeRichardson Sep 22, 2022
5a286b7
refactor(proofs)!: createRequest for connectionless proof request (#1…
genaris Sep 22, 2022
5e9e0fc
feat(proofs): proofs module migration script for 0.3.0 (#1020)
TimoGlastra Sep 22, 2022
34db14b
ci: set default rust version (#1036)
sairanjit Sep 24, 2022
e1d6592
fix(oob): allow encoding in content type header (#1037)
TimoGlastra Sep 26, 2022
0d14a71
feat: connection type (#994)
KolbyRKunz Sep 29, 2022
a230841
feat: improve sending error handling (#1045)
genaris Oct 6, 2022
9dd95e8
feat: expose findAllByQuery method in modules and services (#1044)
jimezesinachi Oct 6, 2022
8a89ad2
feat: possibility to set masterSecretId inside of WalletConfig (#1043)
an-uhryn Oct 7, 2022
df3777e
feat: add indynamespace for ledger id for anoncreds (#965)
morrieinmaas Oct 7, 2022
991151b
feat(bbs): extract bbs logic into separate module (#1035)
TimoGlastra Oct 7, 2022
7be979a
fix(oob): set connection alias when creating invitation (#1047)
jakubkoci Oct 8, 2022
34658b0
chore: merge branch 'main' into 0.3.0-pre (#1030)
genaris Oct 11, 2022
97d3073
feat(question-answer)!: separate logic to a new module (#1040)
berendsliedrecht Oct 11, 2022
e0df0d8
feat(action-menu)!: move to separate package (#1049)
genaris Oct 12, 2022
72260cd
chore(release): v0.2.5 (#1052)
github-actions[bot] Oct 13, 2022
db184a8
refactor: fix inconsistencies in issue credential and present proof a…
NB-MikeRichardson Oct 20, 2022
4deca2c
chore: merge branch 'main' into 0.3.0-pre
TimoGlastra Oct 20, 2022
78d19e7
chore: update versions for all packages to 0.2.5
TimoGlastra Oct 20, 2022
67daf73
chore(bbs): rename module-bbs directory
TimoGlastra Oct 20, 2022
5351f6a
chore(tenants): rename module-tenants to tenants
TimoGlastra Oct 20, 2022
6652520
chore: fix incorrect import paths
TimoGlastra Oct 20, 2022
7f37a62
chore: merge 0.3.0-pre into main branch (#1057)
TimoGlastra Oct 24, 2022
76dab16
refactor(proofs): remove ProofProtocolVersion enum in 0.3.0-pre (#1062)
NB-MikeRichardson Oct 25, 2022
28f54e2
test: increment default timeout for modules (#1069)
genaris Oct 25, 2022
d4fd1ae
feat(routing): add reconnection parameters to RecipientModuleConfig (…
genaris Oct 25, 2022
f777b3d
refactor(proofs)!: rename ProofRecord to ProofExchangeRecord (#1071)
NB-MikeRichardson Oct 25, 2022
c6762bb
fix(react-native): move bbs dep to bbs package (#1076)
TimoGlastra Oct 27, 2022
d215e84
chore(react-native)!: update indy-sdk-react-native to 0.3.0 (#1077)
TimoGlastra Oct 27, 2022
a635565
docs: remove remaining docs (#1080)
morrieinmaas Oct 31, 2022
7850a27
refactor(proofs)!: make nonce optional and add missing exports (#1073)
genaris Oct 31, 2022
fa553b4
chore: make action-menu and question-answer public (#1082)
genaris Nov 2, 2022
bd01e40
ci: use graph-type all for lerna publish (#1084)
genaris Nov 2, 2022
ab403c9
chore: update extension module sample (#1083)
genaris Nov 2, 2022
ef20f1e
fix(connections): do not log AgentContext object (#1085)
genaris Nov 7, 2022
15cfd91
fix(routing): async message pickup on init (#1093)
genaris Nov 9, 2022
6747756
fix(demo): direct import to remove warnings (#1094)
berendsliedrecht Nov 11, 2022
574e6a6
feat: issue credentials v2 (W3C/JSON-LD) (#1092)
NB-MikeRichardson Nov 11, 2022
85d62ec
refactor: remove dependency on indy ledger service from sov did resol…
sairanjit Nov 11, 2022
1667aa2
chore: deleted PresentationExchangeRecord.ts (#1098)
jimezesinachi Nov 16, 2022
d82ad01
refactor: remove ACK status type of fail (#1107)
jimezesinachi Nov 17, 2022
427a80f
fix: remove sensitive information from agent config toJSON() method (…
jimezesinachi Nov 23, 2022
03cdf39
feat: specify httpinboundtransport path (#1115)
niall-shaw Nov 23, 2022
c68145a
feat!: add AgentMessageSentEvent and associate records to outbound me…
genaris Nov 24, 2022
c4e9679
fix(problem-report): proper string interpolation (#1120)
berendsliedrecht Nov 28, 2022
f294129
fix(proofs): await shouldAutoRespond to correctly handle the check (#…
berendsliedrecht Dec 1, 2022
157a357
refactor(oob)!: merge oob invitation parsing (#1134)
TimoGlastra Dec 1, 2022
e48f481
fix: expose AttachmentData and DiscoverFeaturesEvents (#1146)
genaris Dec 8, 2022
9e242c9
build(deps): bump decode-uri-component from 0.2.0 to 0.2.2 (#1139)
dependabot[bot] Dec 9, 2022
9f10da8
feat!: use did:key in protocols by default (#1149)
genaris Dec 9, 2022
3c040b6
fix: expose OutOfBandEvents (#1151)
morrieinmaas Dec 11, 2022
36d4656
fix: use custom document loader in jsonld.frame (#1119)
karimStekelenburg Dec 12, 2022
bf4ceef
refactor(proofs): remove proofrequest property (#1153)
tipusingh Dec 12, 2022
979c695
fix(routing): add connection type on mediation grant (#1147)
genaris Dec 12, 2022
1af57fd
feat: remove keys on mediator when deleting connections (#1143)
genaris Dec 12, 2022
9352fa5
feat(oob): receive Invitation with timeout (#1156)
Zzocker Dec 14, 2022
c752461
feat(proofs): proof negotiation (#1131)
Przytua Dec 14, 2022
0e89e6c
fix: credential values encoding (#1157)
Przytua Dec 14, 2022
e4e5ca1
refactor(action-menu): clearly mark public api (#1163)
TimoGlastra Dec 15, 2022
5e48696
refactor!: rename Handler to MessageHandler (#1161)
TimoGlastra Dec 16, 2022
ff6abdf
feat(w3c): add custom document loader option (#1159)
TimoGlastra Dec 16, 2022
c9acef3
refactor(credentials): credential format service improvements (#1140)
NB-MikeRichardson Dec 16, 2022
ff6293c
feat(credentials)!: custom registration of credential protocols (#1158)
TimoGlastra Dec 19, 2022
c0569b8
fix(connections): use new did for each connection from reusable invit…
TimoGlastra Dec 20, 2022
7781a55
feat!: allow to connect with self (#1173)
TimoGlastra Dec 20, 2022
bc912c3
refactor: jsonld credential format improvements (#1178)
TimoGlastra Dec 20, 2022
d5c28bc
refactor(dids): use class instances in module config (#1175)
TimoGlastra Dec 21, 2022
a0b6602
chore(migrations)!: connections 0.3.0 migration script and tests (#1177)
amanji Dec 21, 2022
5a6e40a
refactor(wallet)!: remove wallet.createDid method (#1180)
TimoGlastra Dec 22, 2022
e299a03
chore(release): v0.3.0 (#1064)
github-actions[bot] Dec 22, 2022
460510d
fix: missing migration script and exports (#1184)
genaris Dec 27, 2022
1c6b880
chore(release): v0.3.1 (#1186)
github-actions[bot] Dec 31, 2022
541356e
fix(credentials): typing if no modules provided (#1188)
TimoGlastra Jan 4, 2023
5f98fed
chore(release): v0.3.2 (#1190)
github-actions[bot] Jan 4, 2023
adba83d
feat: add anoncreds package (#1118)
karimStekelenburg Jan 9, 2023
2f6ae14
build(deps): bump luxon from 1.28.0 to 1.28.1 (#1196)
dependabot[bot] Jan 10, 2023
59d1982
build(deps): bump json5 from 1.0.1 to 1.0.2 (#1191)
dependabot[bot] Jan 10, 2023
fd006f2
feat: adding trust ping events and trust ping command (#1182)
KimEbert42 Jan 10, 2023
da7abde
chore: rename plugin to module (#1201)
TimoGlastra Jan 10, 2023
9933b35
feat(indy-sdk): add indy-sdk package (#1200)
TimoGlastra Jan 11, 2023
c34a3df
docs: update readme packages (#1206)
karimStekelenburg Jan 12, 2023
8a04d1b
chore: remove husky pre-push hook (#1209)
TimoGlastra Jan 12, 2023
86647e7
feat(anoncreds): add anoncreds registry service (#1204)
TimoGlastra Jan 12, 2023
b6f89f9
feat: add minimal oidc-client package (#1197)
karimStekelenburg Jan 12, 2023
c697716
fix(openid4vc-client): set package to private (#1210)
karimStekelenburg Jan 12, 2023
409d36c
docs: corrected some mistakes on demo documentation (#1215)
GramThanos Jan 17, 2023
087980f
fix: fix typing issues with typescript 4.9 (#1214)
TimoGlastra Jan 17, 2023
4a572fe
chore(release): v0.3.3 (#1217)
github-actions[bot] Jan 18, 2023
b7d136c
fix(transport): added docs moved connection to connectionId
berendsliedrecht Jan 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
11 changes: 10 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,16 @@ module.exports = {
},
},
{
files: ['*.test.ts', '**/__tests__/**', '**/tests/**', 'jest.*.ts', 'samples/**', 'demo/**', 'scripts/**'],
files: [
'*.test.ts',
'**/__tests__/**',
'**/tests/**',
'jest.*.ts',
'samples/**',
'demo/**',
'scripts/**',
'**/tests/**',
],
env: {
jest: true,
node: false,
Expand Down
4 changes: 4 additions & 0 deletions .github/actions/setup-postgres-wallet-plugin/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,15 @@ author: 'sairanjit.tummalapalli@ayanworks.com'
runs:
using: composite
steps:
# cargo build failing on latest release of rust due to
# socket2 dependency in the plugin https://users.rust-lang.org/t/build-broken-with-parse-quote-spanned-is-ambiguous/80280/2
# so pointing rust version to 1.63.0
- name: Setup Postgres wallet plugin
run: |
sudo apt-get install -y libzmq3-dev libsodium-dev pkg-config libssl-dev
curl https://sh.rustup.rs -sSf | bash -s -- -y
export PATH="/root/.cargo/bin:${PATH}"
rustup default 1.63.0
cd ../
git clone https://github.com/hyperledger/indy-sdk.git
cd indy-sdk/experimental/plugins/postgres_storage/
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ coverage
.DS_Store
logs.txt
logs/
packages/core/src/__tests__/genesis-von.txn
lerna-debug.log
1 change: 0 additions & 1 deletion .husky/pre-push

This file was deleted.

208 changes: 208 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion DEVREADME.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ GENESIS_TXN_PATH=network/genesis/local-genesis.txn TEST_AGENT_PUBLIC_DID_SEED=00
Locally, you might want to run the tests without postgres tests. You can do that by ignoring the tests:

```sh
yarn test --testPathIgnorePatterns ./packages/core/tests/postgres.test.ts -u
yarn test --testPathIgnorePatterns ./packages/core/tests/postgres.e2e.test.ts -u
```

In case you run into trouble running the tests, e.g. complaining about snapshots not being up-to-date, you can try and remove the data stored for the indy-client. On a Unix system with default setup you achieve this by running:
Expand Down
3 changes: 3 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ RUN apt-get install -y --no-install-recommends yarn
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"

# cargo build failing on latest release of rust due to socket2 dependency in the plugin https://users.rust-lang.org/t/build-broken-with-parse-quote-spanned-is-ambiguous/80280/2 so pointing rust version to 1.63.0
RUN rustup default 1.63.0

# clone indy-sdk and build postgres plugin
RUN git clone https://github.com/hyperledger/indy-sdk.git
WORKDIR /indy-sdk/experimental/plugins/postgres_storage/
Expand Down
1 change: 1 addition & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@
| Karim Stekelenburg | [@karimStekelenburg](https://github.com/karimStekelenburg) | ssi_karim#3505 |
| Timo Glastra | [@TimoGlastra](https://github.com/TimoGlastra) | TimoGlastra#2988 |
| Ariel Gentile | [@genaris](https://github.com/genaris) | GenAris#4962 |
| Jan Rietveld | [@janrtvld](https://github.com/janrtvld) | janrtvld#3868 |
25 changes: 24 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Some features are not yet supported, but are on our roadmap. Check [the roadmap]
- ✅ Smart Auto Acceptance of Connections, Credentials and Proofs
- 🚧 Receiving and Verifying revocable Indy Credentials
- 🚧 W3C Linked Data VCs, BBS+ Signatures
- 🚧 Multi Tenancy
- Multi Tenancy
- ❌ Browser

### Packages
Expand Down Expand Up @@ -101,6 +101,29 @@ Some features are not yet supported, but are on our roadmap. Check [the roadmap]
</a>
</td>
</tr>
<tr>
<td>@aries-framework/action-menu</td>
<td>
<a href="https://npmjs.com/package/@aries-framework/action-menu">
<img alt="@aries-framework/action-menu version" src="https://img.shields.io/npm/v/@aries-framework/action-menu"/>
</a>
</td>
</tr>
<td>@aries-framework/question-answer</td>
<td>
<a href="https://npmjs.com/package/@aries-framework/question-answer">
<img alt="@aries-framework/question-answer version" src="https://img.shields.io/npm/v/@aries-framework/question-answer"/>
</a>
</td>
</tr>
<tr>
<td>@aries-framework/tenants</td>
<td>
<a href="https://npmjs.com/package/@aries-framework/tenants">
<img alt="@aries-framework/tenants version" src="https://img.shields.io/npm/v/@aries-framework/tenants"/>
</a>
</td>
</tr>
</table>

## Getting Started
Expand Down
8 changes: 4 additions & 4 deletions demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Alice, a former student of Faber College, connects with the College, is issued a

In order to use Aries Framework JavaScript some platform specific dependencies and setup is required. See our guides below to quickly set up you project with Aries Framework JavaScript for NodeJS, React Native and Electron.

- [NodeJS](https:/aries.js.org/guides/getting-started/prerequisites/nodejs)
- [NodeJS](https://aries.js.org/guides/getting-started/installation/nodejs)

### Run the demo

Expand Down Expand Up @@ -57,16 +57,16 @@ yarn faber

To set up a connection:

- Select 'setup connection' in both Agents
- Alice will print a invitation link which you then copy and paste to Faber
- Select 'receive connection invitation' in Alice and 'create connection invitation' in Faber
- Faber will print a invitation link which you then copy and paste to Alice
- You have now set up a connection!

To offer a credential:

- Select 'offer credential' in Faber
- Faber will start with registering a schema and the credential definition accordingly
- You have now send a credential offer to Alice!
- Go to Alice to accept the incoming credential offer
- Go to Alice to accept the incoming credential offer by selecting 'yes'.

To request a proof:

Expand Down
101 changes: 28 additions & 73 deletions demo/src/Alice.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
import type {
ConnectionRecord,
ConnectionStateChangedEvent,
CredentialExchangeRecord,
ProofRecord,
} from '@aries-framework/core'

import { ConnectionEventTypes } from '@aries-framework/core'
import type { ConnectionRecord, CredentialExchangeRecord, ProofExchangeRecord } from '@aries-framework/core'

import { BaseAgent } from './BaseAgent'
import { greenText, Output, redText } from './OutputClass'

export class Alice extends BaseAgent {
public outOfBandId?: string
public connected: boolean
public connectionRecordFaberId?: string

public constructor(port: number, name: string) {
super(port, name)
Expand All @@ -26,74 +19,30 @@ export class Alice extends BaseAgent {
}

private async getConnectionRecord() {
if (!this.outOfBandId) {
throw Error(redText(Output.MissingConnectionRecord))
}

const [connection] = await this.agent.connections.findAllByOutOfBandId(this.outOfBandId)

if (!connection) {
if (!this.connectionRecordFaberId) {
throw Error(redText(Output.MissingConnectionRecord))
}

return connection
return await this.agent.connections.getById(this.connectionRecordFaberId)
}

private async printConnectionInvite() {
const outOfBand = await this.agent.oob.createInvitation()
this.outOfBandId = outOfBand.id

console.log(
Output.ConnectionLink,
outOfBand.outOfBandInvitation.toUrl({ domain: `http://localhost:${this.port}` }),
'\n'
)
}

private async waitForConnection() {
if (!this.outOfBandId) {
throw new Error(redText(Output.MissingConnectionRecord))
private async receiveConnectionRequest(invitationUrl: string) {
const { connectionRecord } = await this.agent.oob.receiveInvitationFromUrl(invitationUrl)
if (!connectionRecord) {
throw new Error(redText(Output.NoConnectionRecordFromOutOfBand))
}
return connectionRecord
}

console.log('Waiting for Faber to finish connection...')

const getConnectionRecord = (outOfBandId: string) =>
new Promise<ConnectionRecord>((resolve, reject) => {
// Timeout of 20 seconds
const timeoutId = setTimeout(() => reject(new Error(redText(Output.MissingConnectionRecord))), 20000)

// Start listener
this.agent.events.on<ConnectionStateChangedEvent>(ConnectionEventTypes.ConnectionStateChanged, (e) => {
if (e.payload.connectionRecord.outOfBandId !== outOfBandId) return

clearTimeout(timeoutId)
resolve(e.payload.connectionRecord)
})

// Also retrieve the connection record by invitation if the event has already fired
void this.agent.connections.findAllByOutOfBandId(outOfBandId).then(([connectionRecord]) => {
if (connectionRecord) {
clearTimeout(timeoutId)
resolve(connectionRecord)
}
})
})

const connectionRecord = await getConnectionRecord(this.outOfBandId)

try {
await this.agent.connections.returnWhenIsConnected(connectionRecord.id)
} catch (e) {
console.log(redText(`\nTimeout of 20 seconds reached.. Returning to home screen.\n`))
return
}
console.log(greenText(Output.ConnectionEstablished))
private async waitForConnection(connectionRecord: ConnectionRecord) {
connectionRecord = await this.agent.connections.returnWhenIsConnected(connectionRecord.id)
this.connected = true
console.log(greenText(Output.ConnectionEstablished))
return connectionRecord.id
}

public async setupConnection() {
await this.printConnectionInvite()
await this.waitForConnection()
public async acceptConnection(invitation_url: string) {
const connectionRecord = await this.receiveConnectionRequest(invitation_url)
this.connectionRecordFaberId = await this.waitForConnection(connectionRecord)
}

public async acceptCredentialOffer(credentialRecord: CredentialExchangeRecord) {
Expand All @@ -102,12 +51,18 @@ export class Alice extends BaseAgent {
})
}

public async acceptProofRequest(proofRecord: ProofRecord) {
const retrievedCredentials = await this.agent.proofs.getRequestedCredentialsForProofRequest(proofRecord.id, {
filterByPresentationPreview: true,
public async acceptProofRequest(proofRecord: ProofExchangeRecord) {
const requestedCredentials = await this.agent.proofs.autoSelectCredentialsForProofRequest({
proofRecordId: proofRecord.id,
config: {
filterByPresentationPreview: true,
},
})

await this.agent.proofs.acceptRequest({
proofRecordId: proofRecord.id,
proofFormats: requestedCredentials.proofFormats,
})
const requestedCredentials = this.agent.proofs.autoSelectCredentialsForProofRequest(retrievedCredentials)
await this.agent.proofs.acceptRequest(proofRecord.id, requestedCredentials)
console.log(greenText('\nProof request accepted!\n'))
}

Expand Down
28 changes: 15 additions & 13 deletions demo/src/AliceInquirer.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { CredentialExchangeRecord, ProofRecord } from '@aries-framework/core'
import type { CredentialExchangeRecord, ProofExchangeRecord } from '@aries-framework/core'

import { clear } from 'console'
import { textSync } from 'figlet'
import inquirer from 'inquirer'
import { prompt } from 'inquirer'

import { Alice } from './Alice'
import { BaseInquirer, ConfirmOptions } from './BaseInquirer'
Expand All @@ -17,7 +17,7 @@ export const runAlice = async () => {
}

enum PromptOptions {
CreateConnection = 'Create connection invitation',
ReceiveConnectionUrl = 'Receive connection invitation',
SendMessage = 'Send message',
Exit = 'Exit',
Restart = 'Restart',
Expand All @@ -42,18 +42,18 @@ export class AliceInquirer extends BaseInquirer {
}

private async getPromptChoice() {
if (this.alice.outOfBandId) return inquirer.prompt([this.inquireOptions(this.promptOptionsString)])
if (this.alice.connectionRecordFaberId) return prompt([this.inquireOptions(this.promptOptionsString)])

const reducedOption = [PromptOptions.CreateConnection, PromptOptions.Exit, PromptOptions.Restart]
return inquirer.prompt([this.inquireOptions(reducedOption)])
const reducedOption = [PromptOptions.ReceiveConnectionUrl, PromptOptions.Exit, PromptOptions.Restart]
return prompt([this.inquireOptions(reducedOption)])
}

public async processAnswer() {
const choice = await this.getPromptChoice()
if (this.listener.on) return

switch (choice.options) {
case PromptOptions.CreateConnection:
case PromptOptions.ReceiveConnectionUrl:
await this.connection()
break
case PromptOptions.SendMessage:
Expand All @@ -70,16 +70,16 @@ export class AliceInquirer extends BaseInquirer {
}

public async acceptCredentialOffer(credentialRecord: CredentialExchangeRecord) {
const confirm = await inquirer.prompt([this.inquireConfirmation(Title.CredentialOfferTitle)])
const confirm = await prompt([this.inquireConfirmation(Title.CredentialOfferTitle)])
if (confirm.options === ConfirmOptions.No) {
await this.alice.agent.credentials.declineOffer(credentialRecord.id)
} else if (confirm.options === ConfirmOptions.Yes) {
await this.alice.acceptCredentialOffer(credentialRecord)
}
}

public async acceptProofRequest(proofRecord: ProofRecord) {
const confirm = await inquirer.prompt([this.inquireConfirmation(Title.ProofRequestTitle)])
public async acceptProofRequest(proofRecord: ProofExchangeRecord) {
const confirm = await prompt([this.inquireConfirmation(Title.ProofRequestTitle)])
if (confirm.options === ConfirmOptions.No) {
await this.alice.agent.proofs.declineRequest(proofRecord.id)
} else if (confirm.options === ConfirmOptions.Yes) {
Expand All @@ -88,7 +88,9 @@ export class AliceInquirer extends BaseInquirer {
}

public async connection() {
await this.alice.setupConnection()
const title = Title.InvitationTitle
const getUrl = await prompt([this.inquireInput(title)])
await this.alice.acceptConnection(getUrl.input)
if (!this.alice.connected) return

this.listener.credentialOfferListener(this.alice, this)
Expand All @@ -103,7 +105,7 @@ export class AliceInquirer extends BaseInquirer {
}

public async exit() {
const confirm = await inquirer.prompt([this.inquireConfirmation(Title.ConfirmTitle)])
const confirm = await prompt([this.inquireConfirmation(Title.ConfirmTitle)])
if (confirm.options === ConfirmOptions.No) {
return
} else if (confirm.options === ConfirmOptions.Yes) {
Expand All @@ -112,7 +114,7 @@ export class AliceInquirer extends BaseInquirer {
}

public async restart() {
const confirm = await inquirer.prompt([this.inquireConfirmation(Title.ConfirmTitle)])
const confirm = await prompt([this.inquireConfirmation(Title.ConfirmTitle)])
if (confirm.options === ConfirmOptions.No) {
await this.processAnswer()
return
Expand Down
3 changes: 2 additions & 1 deletion demo/src/BaseAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export class BaseAgent {
{
genesisTransactions: bcovrin,
id: 'greenlights' + name,
indyNamespace: 'greenlights' + name,
isProduction: false,
},
],
Expand All @@ -42,7 +43,7 @@ export class BaseAgent {

this.config = config

this.agent = new Agent(config, agentDependencies)
this.agent = new Agent({ config, dependencies: agentDependencies })
this.agent.registerInboundTransport(new HttpInboundTransport({ port }))
this.agent.registerOutboundTransport(new HttpOutboundTransport())
}
Expand Down
4 changes: 2 additions & 2 deletions demo/src/BaseInquirer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import inquirer from 'inquirer'
import { prompt } from 'inquirer'

import { Title } from './OutputClass'

Expand Down Expand Up @@ -48,7 +48,7 @@ export class BaseInquirer {

public async inquireMessage() {
this.inputInquirer.message = Title.MessageTitle
const message = await inquirer.prompt([this.inputInquirer])
const message = await prompt([this.inputInquirer])

return message.input[0] === 'q' ? null : message.input
}
Expand Down
Loading