Aries Askar
Aries Askar provides secure, encrypted storage and cryptographic support for encrypting, decrypting, signing and verifying data. It also provides both the Wallet
and StorageService
implementations for the agent.
Although Aries Askar is stable and already used in production in agents such as Aries Cloud Agent Python, support for Aries Askar in Aries Framework JavaScript is currently experimental. We recommend new projects to use Aries Askar from the start, and also to migrate existing projects to Aries Askar. However, projects may experience some issues. If you encounter any issues, please open an issue.
Currently, there are few limitations to using Aries Askar.
- When running in Node.JS, only Node.JS 18 is supported for now. See Supported Node.JS versions for Aries Askar
- Install scripts rely on bash command substitution to get the proper binaries for each system architecture and platform. Therefore, if you are under Windows, you must configure
npm
oryarn
to use a bash-compliant shell (e.g.npm config set script-shell "C:\\Program Files\\git\\bin\\bash.exe"
)
If you're upgrading from the Indy SDK to Aries Askar, see Migrating from an Indy SDK Wallet to Aries Askar
Installing Aries Askar
When using Aries Framework JavaScript with Aries Askar, there are a few extra dependencies that need to be installed. We need to install the @aries-framework/askar
package, which implements the needed interfaces for the agent. Secondly, we need to add native bindings for the specific platform @hyperledger/aries-askar-<platform>
. Currently there are bindings for Node.JS, as @hyperledger/aries-askar-nodejs
, and React Native as @hyperlegder/aries-askar-react-native
.
- Node.JS
- React Native
yarn add @aries-framework/askar@^0.4.0 @hyperledger/aries-askar-nodejs@^0.1.0
yarn add @aries-framework/askar@^0.4.0 @hyperledger/aries-askar-react-native@^0.1.0
Adding Aries Askar to the Agent
After installing the dependencies, we can register the Askar Module on the agent.
- Node.JS
- React Native
import { Agent } from '@aries-framework/core'
import { agentDependencies } from '@aries-framework/node'
import { AskarModule } from '@aries-framework/askar'
import { ariesAskar } from '@hyperledger/aries-askar-nodejs'
const agent = new Agent({
config,
dependencies: agentDependencies,
modules: {
// Register the Askar module on the agent
askar: new AskarModule({
ariesAskar,
}),
},
})
import { Agent } from '@aries-framework/core'
import { agentDependencies } from '@aries-framework/react-native'
import { AskarModule } from '@aries-framework/askar'
import { ariesAskar } from '@hyperledger/aries-askar-react-native'
const agent = new Agent({
config,
dependencies: agentDependencies,
modules: {
// Register the Askar module on the agent
askar: new AskarModule({
ariesAskar,
}),
},
})
Supported Node.JS versions for Aries Askar
Due to an issue in ref-napi
(which is used in the Node.JS bindings for Aries Askar), performance for Aries Askar in Node.JS is not as expected. A patched version for ref-napi
has been published that fixes this issue, but this only works in Node.JS 18+.
To use Aries Askar in Node.JS, make sure you're using Node.JS 18 and patch the ref-napi
package to point towards @2060.io/ref-napi
in your package.json
:
- NPM
- Yarn
Using NPM overrides
we can point the ref-napi
package to @2060.io/ref-napi
.
{
"overrides": {
"ref-napi": "npm:@2060.io/ref-napi"
}
}
Using Yarn resolutions
we can point the ref-napi
package to @2060.io/ref-napi
.
{
"resolutions": {
"ref-napi": "npm:@2060.io/ref-napi"
}
}
See the following issues for more information on the performance bottleneck