Skip to content

Commit

Permalink
feat: add anoncreds-rs package (openwallet-foundation#1275)
Browse files Browse the repository at this point in the history
Signed-off-by: Ariel Gentile <gentilester@gmail.com>
  • Loading branch information
genaris committed Feb 10, 2023
1 parent 2669d7d commit efe0271
Show file tree
Hide file tree
Showing 34 changed files with 2,155 additions and 40 deletions.
22 changes: 22 additions & 0 deletions .github/actions/setup-libssl/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Setup libSSL
description: Install libssl and libssl-dev 1.1
author: 'gentilester@gmail.com'

runs:
using: composite
steps:
- name: Install libssl1.1
run: |
curl http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb -o libssl1.1.deb
sudo dpkg -i libssl1.1.deb
shell: bash

- name: Instal libssl-dev.1.1
run: |
curl http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1~18.04.21_amd64.deb -o libssl-dev1.1.deb
sudo dpkg -i libssl-dev1.1.deb
shell: bash

branding:
icon: scissors
color: purple
2 changes: 1 addition & 1 deletion .github/actions/setup-postgres-wallet-plugin/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ runs:
# 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
sudo apt-get install -y libzmq3-dev libsodium-dev pkg-config
curl https://sh.rustup.rs -sSf | bash -s -- -y
export PATH="/root/.cargo/bin:${PATH}"
rustup default 1.63.0
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# validation scripts. To still be able to run the CI we can manually trigger it by adding the 'ci-test'
# label to the pull request
ci-trigger:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
outputs:
triggered: ${{ steps.check.outputs.triggered }}
steps:
Expand All @@ -45,13 +45,16 @@ jobs:
echo "::set-output name=triggered::${SHOULD_RUN}"
validate:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: Validate
steps:
- name: Checkout aries-framework-javascript
uses: actions/checkout@v2

# setup dependencies
- name: Setup Libssl
uses: ./.github/actions/setup-libssl

- name: Setup Libindy
uses: ./.github/actions/setup-libindy

Expand All @@ -76,7 +79,7 @@ jobs:
run: yarn build

integration-test:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: Integration Tests

strategy:
Expand All @@ -88,6 +91,9 @@ jobs:
uses: actions/checkout@v2

# setup dependencies
- name: Setup Libssl
uses: ./.github/actions/setup-libssl

- name: Setup Libindy
uses: ./.github/actions/setup-libindy
- name: Setup Indy Pool
Expand Down Expand Up @@ -115,7 +121,7 @@ jobs:
if: always()

version-stable:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
name: Release stable
needs: [integration-test, validate]
if: github.ref == 'refs/heads/main' && github.event_name == 'workflow_dispatch'
Expand All @@ -127,6 +133,9 @@ jobs:
fetch-depth: 0

# setup dependencies
- name: Setup Libssl
uses: ./.github/actions/setup-libssl

- name: Setup Libindy
uses: ./.github/actions/setup-libindy

Expand Down
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:18.04 as base
FROM ubuntu:22.04 as base

ENV DEBIAN_FRONTEND noninteractive

Expand All @@ -9,7 +9,15 @@ RUN apt-get update -y && apt-get install -y \
# Only needed to build indy-sdk
build-essential \
git \
libzmq3-dev libsodium-dev pkg-config libssl-dev
libzmq3-dev libsodium-dev pkg-config

# libssl1.1 (required by libindy)
RUN curl http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.21_amd64.deb -o libssl1.1.deb
RUN dpkg -i libssl1.1.deb

# libssl-dev1.1 (required to compile libindy with posgres plugin)
RUN curl http://security.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1~18.04.21_amd64.deb -o libssl-dev1.1.deb
RUN dpkg -i libssl-dev1.1.deb

# libindy
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
Expand Down
31 changes: 31 additions & 0 deletions packages/anoncreds-rs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<p align="center">
<br />
<img
alt="Hyperledger Aries logo"
src="https://raw.githubusercontent.com/hyperledger/aries-framework-javascript/aa31131825e3331dc93694bc58414d955dcb1129/images/aries-logo.png"
height="250px"
/>
</p>
<h1 align="center"><b>Aries Framework JavaScript AnonCreds RS Module</b></h1>
<p align="center">
<a
href="https://raw.githubusercontent.com/hyperledger/aries-framework-javascript/main/LICENSE"
><img
alt="License"
src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"
/></a>
<a href="https://www.typescriptlang.org/"
><img
alt="typescript"
src="https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg"
/></a>
<a href="https://www.npmjs.com/package/@aries-framework/anoncreds-rs"
><img
alt="@aries-framework/anoncreds-rs version"
src="https://img.shields.io/npm/v/@aries-framework/anoncreds-rs"
/></a>

</p>
<br />

AnonCreds RS module for [Aries Framework JavaScript](https://github.com/hyperledger/aries-framework-javascript.git).
14 changes: 14 additions & 0 deletions packages/anoncreds-rs/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import type { Config } from '@jest/types'

import base from '../../jest.config.base'

import packageJson from './package.json'

const config: Config.InitialOptions = {
...base,
name: packageJson.name,
displayName: packageJson.name,
setupFilesAfterEnv: ['./tests/setup.ts'],
}

export default config
41 changes: 41 additions & 0 deletions packages/anoncreds-rs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"name": "@aries-framework/anoncreds-rs",
"main": "build/index",
"types": "build/index",
"version": "0.3.3",
"private": true,
"files": [
"build"
],
"license": "Apache-2.0",
"publishConfig": {
"access": "public"
},
"homepage": "https://github.com/hyperledger/aries-framework-javascript/tree/main/packages/anoncreds-rs",
"repository": {
"type": "git",
"url": "https://github.com/hyperledger/aries-framework-javascript",
"directory": "packages/anoncreds-rs"
},
"scripts": {
"build": "yarn run clean && yarn run compile",
"clean": "rimraf ./build",
"compile": "tsc -p tsconfig.build.json",
"prepublishOnly": "yarn run build",
"test": "jest"
},
"dependencies": {
"@aries-framework/core": "0.3.3",
"@aries-framework/anoncreds": "0.3.3",
"@hyperledger/anoncreds-shared": "^0.1.0-dev.5",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"rxjs": "^7.2.0",
"tsyringe": "^4.7.0"
},
"devDependencies": {
"@hyperledger/anoncreds-nodejs": "^0.1.0-dev.5",
"rimraf": "^4.0.7",
"typescript": "~4.9.4"
}
}
29 changes: 29 additions & 0 deletions packages/anoncreds-rs/src/AnonCredsRsModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type { DependencyManager, Module } from '@aries-framework/core'

import {
AnonCredsHolderServiceSymbol,
AnonCredsIssuerServiceSymbol,
AnonCredsVerifierServiceSymbol,
} from '@aries-framework/anoncreds'

import { AnonCredsRsHolderService, AnonCredsRsIssuerService, AnonCredsRsVerifierService } from './services'

export class AnonCredsRsModule implements Module {
public register(dependencyManager: DependencyManager) {
try {
// eslint-disable-next-line import/no-extraneous-dependencies
require('@hyperledger/anoncreds-nodejs')
} catch (error) {
try {
require('@hyperledger/anoncreds-react-native')
} catch (error) {
throw new Error('Could not load anoncreds bindings')
}
}

// Register services
dependencyManager.registerSingleton(AnonCredsHolderServiceSymbol, AnonCredsRsHolderService)
dependencyManager.registerSingleton(AnonCredsIssuerServiceSymbol, AnonCredsRsIssuerService)
dependencyManager.registerSingleton(AnonCredsVerifierServiceSymbol, AnonCredsRsVerifierService)
}
}
7 changes: 7 additions & 0 deletions packages/anoncreds-rs/src/errors/AnonCredsRsError.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { AriesFrameworkError } from '@aries-framework/core'

export class AnonCredsRsError extends AriesFrameworkError {
public constructor(message: string, { cause }: { cause?: Error } = {}) {
super(message, { cause })
}
}
5 changes: 5 additions & 0 deletions packages/anoncreds-rs/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// Services
export * from './services'

// Module
export { AnonCredsRsModule } from './AnonCredsRsModule'
Loading

0 comments on commit efe0271

Please sign in to comment.