Skip to content

Commit 7f37a62

Browse files
authored
chore: merge 0.3.0-pre into main branch (openwallet-foundation#1057)
2 parents 72260cd + 6652520 commit 7f37a62

File tree

711 files changed

+42391
-10457
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

711 files changed

+42391
-10457
lines changed

.eslintrc.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,16 @@ module.exports = {
9999
},
100100
},
101101
{
102-
files: ['*.test.ts', '**/__tests__/**', '**/tests/**', 'jest.*.ts', 'samples/**', 'demo/**', 'scripts/**'],
102+
files: [
103+
'*.test.ts',
104+
'**/__tests__/**',
105+
'**/tests/**',
106+
'jest.*.ts',
107+
'samples/**',
108+
'demo/**',
109+
'scripts/**',
110+
'**/tests/**',
111+
],
103112
env: {
104113
jest: true,
105114
node: false,

DEVREADME.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
This file is intended for developers working on the internals of the framework. If you're just looking how to get started with the framework, see the [docs](./docs)
44

5+
## Installing dependencies
6+
7+
Right now, as a patch that will later be changed, some platforms will have an "error" when installing the dependencies with yarn. This is because the BBS signatures library that we use is built for Linux x86 and MacOS x86 (and not Windows and MacOS arm). This means that it will show that it could not download the binary.
8+
This is not an error for developers, the library that fails is `node-bbs-signaturs` and is an optional dependency for perfomance improvements. It will fallback to a, slower, wasm build.
9+
510
## Running tests
611

712
Test are executed using jest. Some test require either the **mediator agents** or the **ledger** to be running. When running tests that require a connection to the ledger pool, you need to set the `TEST_AGENT_PUBLIC_DID_SEED` and `GENESIS_TXN_PATH` environment variables.

demo/src/Alice.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,17 @@ export class Alice extends BaseAgent {
5252
}
5353

5454
public async acceptProofRequest(proofRecord: ProofRecord) {
55-
const retrievedCredentials = await this.agent.proofs.getRequestedCredentialsForProofRequest(proofRecord.id, {
56-
filterByPresentationPreview: true,
55+
const requestedCredentials = await this.agent.proofs.autoSelectCredentialsForProofRequest({
56+
proofRecordId: proofRecord.id,
57+
config: {
58+
filterByPresentationPreview: true,
59+
},
60+
})
61+
62+
await this.agent.proofs.acceptRequest({
63+
proofRecordId: proofRecord.id,
64+
proofFormats: requestedCredentials.proofFormats,
5765
})
58-
const requestedCredentials = this.agent.proofs.autoSelectCredentialsForProofRequest(retrievedCredentials)
59-
await this.agent.proofs.acceptRequest(proofRecord.id, requestedCredentials)
6066
console.log(greenText('\nProof request accepted!\n'))
6167
}
6268

demo/src/BaseAgent.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export class BaseAgent {
3131
{
3232
genesisTransactions: bcovrin,
3333
id: 'greenlights' + name,
34+
indyNamespace: 'greenlights' + name,
3435
isProduction: false,
3536
},
3637
],
@@ -42,7 +43,7 @@ export class BaseAgent {
4243

4344
this.config = config
4445

45-
this.agent = new Agent(config, agentDependencies)
46+
this.agent = new Agent({ config, dependencies: agentDependencies })
4647
this.agent.registerInboundTransport(new HttpInboundTransport({ port }))
4748
this.agent.registerOutboundTransport(new HttpOutboundTransport())
4849
}

demo/src/Faber.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@ import type { CredDef, Schema } from 'indy-sdk'
33
import type BottomBar from 'inquirer/lib/ui/bottom-bar'
44

55
import {
6-
V1CredentialPreview,
76
AttributeFilter,
87
ProofAttributeInfo,
8+
ProofProtocolVersion,
99
utils,
10+
V1CredentialPreview,
1011
ConnectionEventTypes,
1112
} from '@aries-framework/core'
1213
import { ui } from 'inquirer'
@@ -187,8 +188,18 @@ export class Faber extends BaseAgent {
187188
const connectionRecord = await this.getConnectionRecord()
188189
const proofAttribute = await this.newProofAttribute()
189190
await this.printProofFlow(greenText('\nRequesting proof...\n', false))
190-
await this.agent.proofs.requestProof(connectionRecord.id, {
191-
requestedAttributes: proofAttribute,
191+
192+
await this.agent.proofs.requestProof({
193+
protocolVersion: ProofProtocolVersion.V1,
194+
connectionId: connectionRecord.id,
195+
proofFormats: {
196+
indy: {
197+
name: 'proof-request',
198+
version: '1.0',
199+
nonce: '1298236324864',
200+
requestedAttributes: proofAttribute,
201+
},
202+
},
192203
})
193204
this.ui.updateBottomBar(
194205
`\nProof request sent!\n\nGo to the Alice agent to accept the proof request\n\n${Color.Reset}`

docs/getting-started/ledger.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,13 @@ const agentConfig: InitConfig = {
1818
indyLedgers: [
1919
{
2020
id: 'sovrin-main',
21+
didIndyNamespace: 'sovrin',
2122
isProduction: true,
2223
genesisPath: './genesis/sovrin-main.txn',
2324
},
2425
{
2526
id: 'bcovrin-test',
27+
didIndyNamespace: 'bcovrin:test',
2628
isProduction: false,
2729
genesisTransactions: 'XXXX',
2830
},

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"ts-jest": "^27.0.3",
5858
"ts-node": "^10.0.0",
5959
"tsconfig-paths": "^3.9.0",
60-
"tsyringe": "^4.6.0",
60+
"tsyringe": "^4.7.0",
6161
"typescript": "~4.3.0",
6262
"ws": "^7.4.6"
6363
},

packages/action-menu/README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
<p align="center">
2+
<br />
3+
<img
4+
alt="Hyperledger Aries logo"
5+
src="https://raw.githubusercontent.com/hyperledger/aries-framework-javascript/aa31131825e3331dc93694bc58414d955dcb1129/images/aries-logo.png"
6+
height="250px"
7+
/>
8+
</p>
9+
<h1 align="center"><b>Aries Framework JavaScript Action Menu Plugin</b></h1>
10+
<p align="center">
11+
<a
12+
href="https://raw.githubusercontent.com/hyperledger/aries-framework-javascript/main/LICENSE"
13+
><img
14+
alt="License"
15+
src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"
16+
/></a>
17+
<a href="https://www.typescriptlang.org/"
18+
><img
19+
alt="typescript"
20+
src="https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg"
21+
/></a>
22+
<a href="https://www.npmjs.com/package/@aries-framework/action-menu"
23+
><img
24+
alt="@aries-framework/action-menu version"
25+
src="https://img.shields.io/npm/v/@aries-framework/action-menu"
26+
/></a>
27+
28+
</p>
29+
<br />
30+
31+
Action Menu plugin for [Aries Framework JavaScript](https://github.com/hyperledger/aries-framework-javascript.git). Implements [Aries RFC 0509](https://github.com/hyperledger/aries-rfcs/blob/1795d5c2d36f664f88f5e8045042ace8e573808c/features/0509-action-menu/README.md).
32+
33+
### Installation
34+
35+
Make sure you have set up the correct version of Aries Framework JavaScript according to the AFJ repository. To find out which version of AFJ you need to have installed you can run the following command. This will list the required peer dependency for `@aries-framework/core`.
36+
37+
```sh
38+
npm info "@aries-framework/action-menu" peerDependencies
39+
```
40+
41+
Then add the action-menu plugin to your project.
42+
43+
```sh
44+
yarn add @aries-framework/action-menu
45+
```
46+
47+
### Quick start
48+
49+
In order for this plugin to work, we have to inject it into the agent to access agent functionality. See the example for more information.
50+
51+
### Example of usage
52+
53+
```ts
54+
import { ActionMenuModule } from '@aries-framework/action-menu'
55+
56+
const agent = new Agent({
57+
config: {
58+
/* config */
59+
},
60+
dependencies: agentDependencies,
61+
modules: {
62+
actionMenu: new ActionMenuModule(),
63+
/* other custom modules */
64+
},
65+
})
66+
67+
await agent.initialize()
68+
69+
// To request root menu to a given connection (menu will be received
70+
// asynchronously in a ActionMenuStateChangedEvent)
71+
await agent.modules.actionMenu.requestMenu({ connectionId })
72+
73+
// To select an option from the action menu
74+
await agent.modules.actionMenu.performAction({
75+
connectionId,
76+
performedAction: { name: 'option-1' },
77+
})
78+
```

packages/action-menu/jest.config.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { Config } from '@jest/types'
2+
3+
import base from '../../jest.config.base'
4+
5+
import packageJson from './package.json'
6+
7+
const config: Config.InitialOptions = {
8+
...base,
9+
name: packageJson.name,
10+
displayName: packageJson.name,
11+
}
12+
13+
export default config

packages/action-menu/package.json

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{
2+
"name": "@aries-framework/action-menu",
3+
"main": "build/index",
4+
"types": "build/index",
5+
"version": "0.2.5",
6+
"private": true,
7+
"files": [
8+
"build"
9+
],
10+
"license": "Apache-2.0",
11+
"publishConfig": {
12+
"access": "public"
13+
},
14+
"homepage": "https://github.com/hyperledger/aries-framework-javascript/tree/main/packages/action-menu",
15+
"repository": {
16+
"type": "git",
17+
"url": "https://github.com/hyperledger/aries-framework-javascript",
18+
"directory": "packages/action-menu"
19+
},
20+
"scripts": {
21+
"build": "yarn run clean && yarn run compile",
22+
"clean": "rimraf -rf ./build",
23+
"compile": "tsc -p tsconfig.build.json",
24+
"prepublishOnly": "yarn run build",
25+
"test": "jest"
26+
},
27+
"dependencies": {
28+
"rxjs": "^7.2.0",
29+
"class-transformer": "0.5.1",
30+
"class-validator": "0.13.1"
31+
},
32+
"peerDependencies": {
33+
"@aries-framework/core": "0.2.5"
34+
},
35+
"devDependencies": {
36+
"@aries-framework/node": "0.2.5",
37+
"reflect-metadata": "^0.1.13",
38+
"rimraf": "~3.0.2",
39+
"typescript": "~4.3.0"
40+
}
41+
}

0 commit comments

Comments
 (0)