Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
introductions and some context (#43)
Signed-off-by: Ana Goessens <ana@animo.id>
- Loading branch information
1 parent
190902c
commit 2b3ea26
Showing
19 changed files
with
391 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
# Getting started | ||
|
||
In this section we will go over everything you need to get started. | ||
In this section we will go over everything you need to get started on a technical level. First there are specific installation guides for NodeJS and React Native. Aries JavaScript works for creating both serverside application (commonly but not always issuer and verifyer) and mobile applications (commonly holder apps). Depending on your use case you can follow the installation guides for [NodeJS](./installation/nodejs/index.md), [React Native](/installation/react-native/index.md), or both. | ||
|
||
After the installation of your prerequisites is complete, we'll walk you through the [initial setup](./set-up/index.md) of the framework. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,222 +1,18 @@ | ||
# Setup | ||
# Installation | ||
|
||
> This guide assumes you have followed the install guides from the previous | ||
> section for your platform and a valid [Node.js](https://nodejs.org) or [React | ||
> Native](https://reactnative.dev) project setup. | ||
In order to work with the Aries JavaScript Ecosystem, you first have to setup your work environment. We strive to create an easy and accessible ecosystem, so the prerequisites are not too large. | ||
|
||
### Installing the required dependencies | ||
Feel free to click through all the installation guides and setup, if you're looking for specifics however, you can see a summary below. | ||
|
||
First we have to install the minimal amount of dependencies that are required | ||
for using the Aries Ecosystem. | ||
Very simply put: | ||
|
||
<!--tabs--> | ||
**Do you want to build a mobile app?** | ||
|
||
# Node.js | ||
- Have [NodeJS](https://nodejs.org/en/) installed (but no need to follow the [NodeJS installation](./installation/nodejs/index.md) guide as it pertains to the `@aries-framework/node` package). | ||
- Follow the [React Native installation](./installation/react-native/index.md) guide. | ||
- Follow the [set up](./../set-up/index.md) guide. | ||
|
||
```console | ||
yarn add @aries-framework/core @aries-framework/node | ||
``` | ||
**Do you want to build a server-side app?** | ||
|
||
# React Native | ||
|
||
```console | ||
yarn add @aries-framework/core @aries-framework/react-native react-native-fs react-native-get-random-values | ||
``` | ||
|
||
<!--/tabs--> | ||
|
||
### Additional setup | ||
|
||
<!--tabs--> | ||
|
||
# Node.js | ||
|
||
no additional setup is required | ||
|
||
# React Native | ||
|
||
Since [React Native](https://reactnative.dev) does not have an implementation | ||
for | ||
[`crypto.getRandomValues()`](https://developer.mozilla.org/en-US/docs/Web/API/Crypto/getRandomValues) | ||
we have to setup a polyfill for this. We have to do this at the entrypoint of | ||
the application. This could is most likely `index.(js|ts|jsx|tsx)` at the root | ||
of your application. | ||
|
||
```diff title="index.tsx" showLineNumbers | ||
+ import 'react-native-get-random-values' | ||
``` | ||
|
||
In addition you need add support for resolving modules with the `.cjs` extension, as this is used by some of AFJ's dependencies and not automatically supported by React Native. | ||
|
||
```js title="metro.config.js" showLineNumbers | ||
module.exports = { | ||
// ... other Metro config options ... | ||
resolver: { | ||
// make sure this includes `cjs` (and other extensions you need) | ||
sourceExts: ['js', 'json', 'ts', 'tsx', 'cjs'], | ||
}, | ||
} | ||
``` | ||
|
||
<!--/tabs--> | ||
|
||
### Setting up the agent | ||
|
||
> this section does not assume any knowledge of the agent configuration. | ||
> [Here](../../tutorials/agent-config) we will discuss in-depth what every | ||
> field in the configuration does and when to set it. | ||
In order to use the agent in the application we have to configure and | ||
initialize it. This following configuration is quite generic and possibly not | ||
enough for your specific use cases. Please refer to the | ||
[tutorials](../../tutorials/index) for a more use-case-specific agent setup. | ||
|
||
<!--tabs--> | ||
|
||
# Node.js | ||
|
||
```typescript showLineNumbers | ||
import type { InitConfig } from '@aries-framework/core' | ||
import { Agent } from '@aries-framework/core' | ||
import { agentDependencies } from '@aries-framework/node' | ||
|
||
const config: InitConfig = { | ||
label: 'docs-nodejs-agent', | ||
walletConfig: { | ||
id: 'wallet-id', | ||
key: 'testkey0000000000000000000000000', | ||
}, | ||
} | ||
|
||
const agent = new Agent(config, agentDependencies) | ||
``` | ||
|
||
# React Native | ||
|
||
```typescript showLineNumbers | ||
import type { InitConfig } from '@aries-framework/core' | ||
import { Agent } from '@aries-framework/core' | ||
import { agentDependencies } from '@aries-framework/react-native' | ||
|
||
const config: InitConfig = { | ||
label: 'docs-rn-agent', | ||
walletConfig: { | ||
id: 'wallet-id', | ||
key: 'testkey0000000000000000000000000', | ||
}, | ||
} | ||
|
||
const agent = new Agent(config, agentDependencies) | ||
``` | ||
|
||
<!--/tabs--> | ||
|
||
### Setting up the transports | ||
|
||
After creating an `Agent` instance, we have to set an outbound transport that | ||
will handle traffic from the agent. It is also possible to set an inbound | ||
transport in the same way as the outbound transport, but it is built-in, so not | ||
required. | ||
|
||
<!--tabs--> | ||
|
||
# Node.js | ||
|
||
Sets up an HTTP outbound and inbound transport. | ||
|
||
```typescript showLineNumbers | ||
import { HttpOutboundTransport, WsOutboundTransport, HttpInboundTransport } from '@aries-framework/core' | ||
|
||
agent.registerOutboundTransport(new HttpOutboundTransport()) | ||
agent.registerInboundTransport(new HttpInboundTransport({ port: 3000 })) | ||
``` | ||
|
||
# React Native | ||
|
||
For mobile agents the WebSocket transport is often required. We will go into | ||
more depth about the reasons for this in the mediation section [TODO: mediator | ||
section](https://example.org) | ||
|
||
```typescript showLineNumbers | ||
import { WsOutboundTransport, HttpOutboundTransport } from '@aries-framework/core' | ||
|
||
agent.registerOutboundTransport(new WsOutboundTransport()) | ||
agent.registerOutboundTransport(new HttpOutboundTransport()) | ||
``` | ||
|
||
<!--/tabs--> | ||
|
||
### Initializing the agent | ||
|
||
```typescript showLineNumbers | ||
// ... | ||
|
||
const agent = new Agent(config, agentDependencies) | ||
|
||
const initialize = async () => await agent.initialize().catch(console.error) | ||
``` | ||
|
||
### Full code snippet | ||
|
||
<!--tabs--> | ||
|
||
# Node.js | ||
|
||
```typescript showLineNumbers | ||
import type { InitConfig } from '@aries-framework/core' | ||
import { Agent } from '@aries-framework/core' | ||
import { agentDependencies } from '@aries-framework/node' | ||
|
||
// The agent initialization configuration | ||
const config: InitConfig = { | ||
label: 'docs-nodejs-agent', | ||
walletConfig: { | ||
id: 'wallet-id', | ||
key: 'testkey0000000000000000000000000', | ||
}, | ||
} | ||
|
||
// Creating an agent instance | ||
const agent = new Agent(config, agentDependencies) | ||
|
||
// Registering the required in- and outbound transports | ||
agent.registerOutboundTransport(new HttpOutboundTransport()) | ||
agent.registerInboundTransport(new HttpInboundTransport({ port: 3000 })) | ||
|
||
// Function to initialize the agent | ||
const initialize = async () => await agent.initialize().catch(console.error) | ||
``` | ||
|
||
# React Native | ||
|
||
```typescript showLineNumbers | ||
import type { InitConfig } from '@aries-framework/core' | ||
import { Agent, WsOutboundTransport, HttpOutboundTransport } from '@aries-framework/core' | ||
import { agentDependencies } from '@aries-framework/react-native' | ||
|
||
// The agent initialization configuration | ||
const config: InitConfig = { | ||
label: 'docs-rn-agent', | ||
walletConfig: { | ||
id: 'wallet-id', | ||
key: 'testkey0000000000000000000000000', | ||
}, | ||
} | ||
|
||
// Creating an agent instance | ||
const agent = new Agent(config, agentDependencies) | ||
|
||
// Registering the required outbound transport | ||
agent.registerOutboundTransport(new HttpOutboundTransport()) | ||
agent.registerOutboundTransport(new WsOutboundTransport()) | ||
|
||
// Function to initialize the agent | ||
const initialize = async () => await agent.initialize().catch(console.error) | ||
``` | ||
|
||
<!--/tabs--> | ||
|
||
### Useful resources | ||
|
||
- [Hyperledger Aries RFC - 004: | ||
Agents](https://github.com/hyperledger/aries-rfcs/blob/main/concepts/0004-agents/README.md) | ||
- Follow the [NodeJS installation](./installation/nodejs/index.md) guide. | ||
- Follow the [set up](./../set-up/index.md) guide. |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# NodeJS | ||
|
||
To work with [Aries Framework | ||
JavaScript](https://github.com/hyperledger/aries-framework-javascript) we need | ||
to install some dependencies. We will go over the specific installation process for each platform. Ga ahead an pick your system of choice to get started! | ||
|
||
- [Linux](./linux.md) | ||
- [Windows](./windows.md) | ||
- [Apple (Intel)](./apple-intel.md) | ||
- [Apple (Arm)](./apple-arm.md) | ||
|
||
The specific dependencies that you will install are the following. They will come up in the installlation guides, but are summarized here to give insight into what you will install. | ||
|
||
- [NodeJS](https://nodejs.org) | ||
- [yarn](https://classic.yarnpkg.com/lang/en/docs/install) or [npm](https://www.npmjs.com/) | ||
- [libsodium](https://github.com/jedisct1/libsodium) | ||
- [libzmq](https://github.com/zeromq/libzmq) | ||
- [indy-sdk](https://github.com/hyperledger/indy-sdk). |
Oops, something went wrong.