Skip to content

Commit eec6fb5

Browse files
authored
Merge branch 'main' into feature/tls-support
2 parents 3226365 + 28874fa commit eec6fb5

Some content is hidden

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

64 files changed

+345
-1615
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: "Indy-VDR"
22

33
env:
4-
RUST_VERSION: "1.63.0"
4+
RUST_VERSION: "1.65.0"
55
CROSS_VERSION: "0.2.4"
66

77
on:
@@ -243,6 +243,15 @@ jobs:
243243
- name: Check types
244244
run: yarn check-types
245245

246+
- name: Run local node pool
247+
run: |
248+
cd ../../
249+
docker build -f ci/indy-pool.dockerfile -t test_pool --build-arg pool_ip=10.0.0.2 ci
250+
docker network create --subnet=10.0.0.0/8 indy-sdk-network
251+
docker run -d --name indy_pool -p 9701-9708:9701-9708 --net=indy-sdk-network test_pool
252+
cd wrappers/javascript
253+
docker exec $(docker ps -aqf "ancestor=test_pool") cat /var/lib/indy/sandbox/pool_transactions_genesis >> genesis.txn
254+
246255
- name: Run tests
247256
env:
248257
# binary is downloaded to root of repository
@@ -283,16 +292,14 @@ jobs:
283292
- name: Install Rust toolchain
284293
uses: dtolnay/rust-toolchain@master
285294
with:
286-
# First version with support for cdylib: https://github.com/rust-lang/rust/pull/100636
287-
toolchain: "1.65.0"
295+
toolchain: ${{ env.RUST_VERSION }}
288296
targets: ${{ matrix.target }}
289297

290-
# Not useful unless the toolchain version matches the default
291-
# - name: Cache cargo resources
292-
# uses: Swatinem/rust-cache@v2
293-
# with:
294-
# shared-key: deps
295-
# save-if: false
298+
- name: Cache cargo resources
299+
uses: Swatinem/rust-cache@v2
300+
with:
301+
shared-key: deps
302+
save-if: false
296303

297304
- name: Build
298305
run: |
@@ -302,7 +309,7 @@ jobs:
302309
uses: actions/upload-artifact@v3
303310
with:
304311
name: library-${{ matrix.target}}
305-
path: target/${{ matrix.target }}/release/libindy_vdr.dylib
312+
path: target/${{ matrix.target }}/release/libindy_vdr.a
306313

307314
create-ios-xcframework:
308315
name: Create iOS xcframework
@@ -313,7 +320,7 @@ jobs:
313320
- name: Checkout
314321
uses: actions/checkout@v3
315322

316-
- name: Fetch dynamic libraries
323+
- name: Fetch static libraries
317324
uses: actions/download-artifact@v3
318325

319326
- run: >
@@ -337,6 +344,9 @@ jobs:
337344
build-android:
338345
name: Build library (Android)
339346
needs: [checks]
347+
env:
348+
RUST_VERSION: "1.64.0" # Overriding the rust version here for lower NDK support
349+
340350
runs-on: ubuntu-latest
341351
strategy:
342352
matrix:
@@ -352,6 +362,11 @@ jobs:
352362
- name: Checkout
353363
uses: actions/checkout@v3
354364

365+
- name: Install Rust toolchain
366+
uses: dtolnay/rust-toolchain@master
367+
with:
368+
toolchain: ${{ env.RUST_VERSION }}
369+
355370
- name: Build
356371
run: |
357372
cargo install --bins --git https://github.com/rust-embedded/cross --tag v${{ env.CROSS_VERSION }} cross

Cross.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ image = "ghcr.io/rust-cross/manylinux2014-cross:aarch64"
55
image = "ghcr.io/rust-cross/manylinux2014-cross:x86_64"
66

77
[target.x86_64-linux-android]
8-
image = "ghcr.io/cross-rs/x86_64-linux-android:main"
8+
image = "ghcr.io/hyperledger/aries-builder-images/cross/x86_64-linux-android:main"
99

1010
[target.i686-linux-android]
11-
image = "ghcr.io/cross-rs/i686-linux-android:main"
11+
image = "ghcr.io/hyperledger/aries-builder-images/cross/i686-linux-android:main"
1212

1313
[target.aarch64-linux-android]
14-
image = "ghcr.io/cross-rs/aarch64-linux-android:main"
14+
image = "ghcr.io/hyperledger/aries-builder-images/cross/aarch64-linux-android:main"
1515

1616
[target.armv7-linux-androideabi]
17-
image = "ghcr.io/cross-rs/armv7-linux-androideabi:main"
17+
image = "ghcr.io/hyperledger/aries-builder-images/cross/armv7-linux-androideabi:main"

build-xcframework.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@
33
set -eo pipefail
44

55
# Check if lipo and xcodebuild exist
6-
if [ -z `command -v lipo` ] || [ -z `command -v xcodebuild` ]
6+
if [ -z `command -v lipo` ] || [ -z `command -v xcodebuild` ] || [ -z `command -v sed` ]
7+
78
then
8-
echo "!!! lipo or xcodebuild could not be found !!!"
9+
echo "!!! lipo, xcodebuild or sed could not be found !!!"
910
help
1011
fi
1112

1213
NAME="indy_vdr"
14+
BUNDLE_NAME="indy-vdr"
1315
VERSION=$(cargo generate-lockfile && cargo pkgid indy-vdr | sed -e "s/^.*[#@]//")
1416
echo $VERSION
15-
BUNDLE_IDENTIFIER="org.hyperledger.$NAME"
16-
LIBRARY_NAME="lib$NAME.dylib"
17+
BUNDLE_IDENTIFIER="org.hyperledger.$BUNDLE_NAME"
18+
LIBRARY_NAME="lib$NAME.a"
1719
XC_FRAMEWORK_NAME="$NAME.xcframework"
1820
FRAMEWORK_LIBRARY_NAME=$NAME
1921
FRAMEWORK_NAME="$FRAMEWORK_LIBRARY_NAME.framework"
2022
HEADER_NAME="lib$NAME.h"
2123
OUT_PATH="out"
24+
MIN_IOS_VERSION="12.0"
2225

2326
# Setting some default paths
2427
AARCH64_APPLE_IOS_PATH="./target/aarch64-apple-ios/release"
@@ -33,9 +36,9 @@ Help() {
3336
echo " - xcodebuild"
3437
echo "To build an xcframework with underlying Frameworks"
3538
echo "the following can be passed in as positional arguments"
36-
echo " 1. Path to the aarch64-apple-ios directory where the $LIBRARY is stored"
37-
echo " 2. Path to the aarch64-apple-ios-sim directory where the $LIBRARY is stored"
38-
echo " 3. Path to the x86_64-apple-ios directory where the $LIBRARY is stored"
39+
echo " 1. Path to the aarch64-apple-ios directory where the $LIBRARY_NAME is stored"
40+
echo " 2. Path to the aarch64-apple-ios-sim directory where the $LIBRARY_NAME is stored"
41+
echo " 3. Path to the x86_64-apple-ios directory where the $LIBRARY_NAME is stored"
3942
echo " 4. Path to the header file, excluding the header"
4043
echo "Make sure to add the 'release' section of the path for a"
4144
echo "release build."
@@ -156,6 +159,8 @@ cat <<EOT >> Info.plist
156159
<string>$VERSION</string>
157160
<key>NSPrincipalClass</key>
158161
<string></string>
162+
<key>MinimumOSVersion</key>
163+
<string>$MIN_IOS_VERSION</string>
159164
</dict>
160165
</plist>
161166
EOT
@@ -179,8 +184,4 @@ xcodebuild -create-xcframework \
179184
echo "cleaning up..."
180185
rm -rf $FRAMEWORK_NAME real sim
181186

182-
echo "Fixing the identifiers of the dylib..."
183-
install_name_tool -id @rpath/$NAME.framework/$FRAMEWORK_LIBRARY_NAME $XC_FRAMEWORK_NAME/ios-arm64/$FRAMEWORK_NAME/$FRAMEWORK_LIBRARY_NAME
184-
install_name_tool -id @rpath/$NAME.framework/$FRAMEWORK_LIBRARY_NAME $XC_FRAMEWORK_NAME/ios-arm64_x86_64-simulator/$FRAMEWORK_NAME/$FRAMEWORK_LIBRARY_NAME
185-
186187
echo "Framework written to $OUT_PATH/$XC_FRAMEWORK_NAME"

libindy_vdr/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "indy-vdr"
3-
version = "0.4.0-dev.14"
3+
version = "0.4.0-dev.16"
44
authors = ["Hyperledger Indy Contributors <[email protected]>"]
55
description = "A library for interacting with Hyperledger Indy Node, a distributed ledger for self-sovereign identity (https://www.hyperledger.org/use/hyperledger-indy)."
66
edition = "2021"

wrappers/javascript/.eslintrc.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ module.exports = {
7171
},
7272
overrides: [
7373
{
74-
files: ['arch.js'],
75-
env: { node: true },
74+
files: ['arch.js', 'platform.js'],
75+
env: {
76+
node: true,
77+
},
7678
rules: {
7779
'@typescript-eslint/no-unsafe-assignment': 'off',
7880
'no-console': 'off',
@@ -91,5 +93,14 @@ module.exports = {
9193
'@typescript-eslint/no-unsafe-call': 'off',
9294
},
9395
},
96+
{
97+
files: ['**.test.**'],
98+
env: {
99+
node: true,
100+
},
101+
rules: {
102+
'@typescript-eslint/no-unsafe-assignment': 'off',
103+
},
104+
},
94105
],
95106
}

wrappers/javascript/indy-vdr-nodejs/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,22 @@ const getSchemaRequest = new GetSchemaRequest({
3333
const schemaResponse = await pool.submitRequest(getSchemaRequest)
3434
```
3535

36+
## Testing
37+
38+
In order to test this library, you need a local indy network running. This can be done with the following commands (from the root of the repository):
39+
40+
```sh
41+
docker build -f ci/indy-pool.dockerfile -t test_pool --build-arg pool_ip=10.0.0.2 ci
42+
docker network create --subnet=10.0.0.0/8 indy-sdk-network
43+
docker run -d --name indy_pool -p 9701-9708:9701-9708 --net=indy-sdk-network test_pool
44+
45+
# Network is now running
46+
47+
cd wrappers/javascript
48+
49+
docker exec $(docker ps -aqf "ancestor=test_pool") cat /var/lib/indy/sandbox/pool_transactions_genesis >> genesis.txn
50+
51+
yarn test:local-build
52+
```
53+
3654
> **Note**: If you want to use this library in a cross-platform environment you need to import methods from the `@hyperledger/indy-vdr-shared` package instead. This is a platform independent package that allows to register the native bindings. The `@hyperledger/indy-vdr-nodejs` package uses this package under the hood. See the [Indy VDR Shared README](https://github.com/hyperledger/indy-vdr/tree/main/wrappers/javascript/indy-vdr-shared/README.md) for documentation on how to use this package.

wrappers/javascript/indy-vdr-nodejs/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hyperledger/indy-vdr-nodejs",
3-
"version": "0.1.0-dev.14",
3+
"version": "0.1.0",
44
"license": "Apache-2.0",
55
"description": "Nodejs wrapper for Indy Vdr",
66
"source": "src/index",
@@ -41,7 +41,7 @@
4141
"typescript": "~4.9.4"
4242
},
4343
"dependencies": {
44-
"@hyperledger/indy-vdr-shared": "0.1.0-dev.14",
44+
"@hyperledger/indy-vdr-shared": "0.1.0",
4545
"@mapbox/node-pre-gyp": "^1.0.10",
4646
"@types/ref-array-di": "^1.2.5",
4747
"ffi-napi": "^4.0.3",
@@ -52,7 +52,7 @@
5252
"binary": {
5353
"module_name": "indy_vdr",
5454
"module_path": "native",
55-
"remote_path": "v0.4.0-dev.14",
55+
"remote_path": "v0.4.0-dev.16",
5656
"host": "https://github.com/hyperledger/indy-vdr/releases/download/",
5757
"package_name": "library-{platform}-{arch}.tar.gz"
5858
}

wrappers/javascript/indy-vdr-nodejs/scripts/platform.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-var-requires */
2-
/* eslint-disable no-console */
3-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
4-
/* eslint-disable no-undef */
51
const os = require('os')
62

73
// Find appropriate target architecture for retrieving the anoncreds library

wrappers/javascript/indy-vdr-nodejs/tests/IndyVdrPool.test.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
1-
// TODO: this should be turned off at a eslint config level for tests
2-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
3-
41
import type { IndyVdrPool } from '@hyperledger/indy-vdr-nodejs'
52

6-
import { SOVRIN_GENESIS_TRANSACTION_BUILDER_NET } from './utils'
3+
import { genesisTxnPath } from './utils'
74

85
import { PoolCreate } from '@hyperledger/indy-vdr-nodejs'
96

107
describe('IndyVdrPool', () => {
118
let pool: IndyVdrPool
129

1310
beforeAll(() => {
14-
pool = new PoolCreate({ parameters: { transactions: SOVRIN_GENESIS_TRANSACTION_BUILDER_NET } })
11+
pool = new PoolCreate({ parameters: { transactions_path: genesisTxnPath } })
1512
})
1613

1714
test('Get pool handle', () => {

wrappers/javascript/indy-vdr-nodejs/tests/IndyVdrRequest.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
2-
31
import type { IndyVdrRequest } from '@hyperledger/indy-vdr-nodejs'
42

53
import { DID, SCHEMA_ID } from './utils'

0 commit comments

Comments
 (0)