Skip to content

Commit

Permalink
refactor(sdk): remove experimental js sdk binding (trustbloc#720)
Browse files Browse the repository at this point in the history
The JS SDK was added to v.1.2.0 as experimental. But this hasn't been updated and tested in last few months. This commit removes the experimental code from the sdk.

Signed-off-by: Rolson Quadras <[email protected]>
  • Loading branch information
rolsonquadras authored Feb 12, 2024
1 parent 37de81a commit 508a097
Show file tree
Hide file tree
Showing 39 changed files with 1 addition and 8,284 deletions.
129 changes: 0 additions & 129 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,32 +86,6 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Temporarily disabled due to compatibility issues with Go 1.21.
#
# WASMIntegrationTest:
# runs-on: ubuntu-20.04
# timeout-minutes: 30
# steps:
# - uses: actions/checkout@v3
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}
# - name: Setup Node.js
# uses: actions/setup-node@v3
# - name: Run Integration tests
# uses: GabrielBB/xvfb-action@v1
# with:
# run: |
# echo '127.0.0.1 file-server.trustbloc.local' | sudo tee -a /etc/hosts
# echo '127.0.0.1 did-resolver.trustbloc.local' | sudo tee -a /etc/hosts
# echo '127.0.0.1 vc-rest-echo.trustbloc.local' | sudo tee -a /etc/hosts
# echo '127.0.0.1 api-gateway.trustbloc.local' | sudo tee -a /etc/hosts
# echo '127.0.0.1 cognito-mock.trustbloc.local' | sudo tee -a /etc/hosts
# make integration-test-wasm
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

iOSFlutterIntegrationTest:
runs-on: macos-12
steps:
Expand Down Expand Up @@ -228,106 +202,3 @@ jobs:
emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
disable-animations: true
script: adb reverse tcp:8075 tcp:8075 && adb reverse tcp:8072 tcp:8072 && adb reverse tcp:9229 tcp:9229 && make integration-test-flutter integration-test-android

# BuildJSSDK:
# needs: GenerateVersion
# if: github.event_name == 'push' && (github.repository == 'trustbloc/wallet-sdk' && github.ref == 'refs/heads/main')
# runs-on: ubuntu-22.04
# timeout-minutes: 10
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# lfs: true
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}
# - name: Derive the new version
# run: |
# echo "new version"
# NEW_VER=${{ needs.GenerateVersion.outputs.version }}-snapshot-$(git rev-parse --short=7 HEAD)
# echo "NEW_VERSION=$NEW_VER" >> $GITHUB_ENV
# echo $NEW_VER
# - name: Set npm authentication tokens
# run: |
# echo $PATH
# echo ${{ github.workspace }}
# echo '//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}' > ~/.npmrc
# echo '@trustbloc-cicd:registry=https://npm.pkg.github.com' >> ~/.npmrc
#
# - name: Generate bindings
# run: |
# export PATH=$PATH:$GOPATH/bin
# echo $PATH
#
# cd ./cmd/wallet-sdk-js
# sed -i 's/"version": "[0-9]\+\.[0-9]\+\.[0-9]\+"/"version": "${{ env.NEW_VERSION }}"/g' package.json
# sed -i 's#"name": "@trustbloc/wallet-sdk"#"name": "@trustbloc-cicd/wallet-sdk-js"#g' package.json
# sed -i 's#"url": "https://github.com/trustbloc/wallet-sdk.git",#"url": "https://github.com/trustbloc-cicd/snapshot.git"#g' package.json
# sed -i '/"directory": "cmd\/wallet-sdk-js"/d' package.json
#
# pushd ../../
# make generate-js-bindings
# popd
# env:
# DOCKER_USER: ${{ secrets.CR_USER }}
# GITHUB_TOKEN: ${{ secrets.CR_PAT }}
# GOPATH: /home/runner/work/wallet-sdk/go
#
# BuildDemoApp:
# needs: [ GenerateVersion, BuildJSSDK ]
# if: github.event_name == 'push' && (github.repository == 'trustbloc/wallet-sdk' && github.ref == 'refs/heads/main')
# runs-on: ubuntu-22.04
# timeout-minutes: 40
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# lfs: true
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}
# - name: Derive the new version
# run: |
# echo "new version"
# NEW_VER=${{ needs.GenerateVersion.outputs.version }}-snapshot-$(git rev-parse --short=7 HEAD)
# echo "NEW_VERSION=$NEW_VER" >> $GITHUB_ENV
# echo $NEW_VER
#
# - name: Set npm authentication tokens
# run: |
# echo $PATH
# echo ${{ github.workspace }}
# echo '//npm.pkg.github.com/:_authToken=${{ secrets.CR_PAT }}' > ~/.npmrc
# echo '@trustbloc-cicd:registry=https://npm.pkg.github.com' >> ~/.npmrc
#
# - name: Install dependencies
# run: |
# pushd ./demo/app/web
# npm install
# popd
#
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
#
# - name: Login to Github Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ secrets.CR_USER }}
# password: ${{ secrets.CR_PAT }}
#
# - name: Build container image
# uses: docker/build-push-action@v4
# with:
# context: .
# file: ./images/demo/app/Dockerfile
# platforms: linux/amd64
# build-args: |
# ALPINE_VER=3.18
# GO_VER=1.21
# push: false
# tags: |
# ghcr.io/trustbloc-cicd/wallet-demo-app:${{ env.NEW_VERSION }}
97 changes: 0 additions & 97 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,103 +64,6 @@ jobs:
USER: ${{ secrets.CR_USER }}
TOKEN: ${{ secrets.CR_PAT }}

# PublishJSSDKRelease:
# runs-on: ubuntu-22.04
# timeout-minutes: 10
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# lfs: true
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}
# - name: Derive the new version
# run: |
# echo "new version"
# NEW_VER=$(git describe --tags --always `git rev-list --tags --max-count=1`)
# echo "NEW_VERSION=$NEW_VER" >> $GITHUB_ENV
# echo $NEW_VER
# - name: Set npm authentication tokens
# run: |
# echo $PATH
# echo ${{ github.workspace }}
# echo '//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}' > ~/.npmrc
# echo '@trustbloc:registry=https://npm.pkg.github.com' >> ~/.npmrc
# - name: Generate bindings and publish to npm
# run: |
# export PATH=$PATH:$GOPATH/bin
# echo $PATH
#
# cd ./cmd/wallet-sdk-js
# sed -i 's/"version": "[0-9]\+\.[0-9]\+\.[0-9]\+"/"version": "${{ env.NEW_VERSION }}"/g' package.json
# sed -i 's#"name": "@trustbloc/wallet-sdk"#"name": "@trustbloc/wallet-sdk-js"#g' package.json
# sed -i 's#"url": "https://github.com/trustbloc/wallet-sdk.git",#"url": "https://github.com/trustbloc/wallet-sdk.git"#g' package.json
# sed -i '/"directory": "cmd\/wallet-sdk-js"/d' package.json
#
# pushd ../../
# make generate-js-bindings
# popd
#
# npm publish
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GOPATH: /home/runner/work/wallet-sdk/go

# PublishWebDemoAppRelease:
# runs-on: ubuntu-22.04
# timeout-minutes: 40
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0
# lfs: true
# - name: Set up Go
# uses: actions/setup-go@v3
# with:
# go-version: ${{ env.GO_VERSION }}
# - name: Derive the new version
# run: |
# echo "new version"
# NEW_VER=$(git describe --tags --always `git rev-list --tags --max-count=1`)
# echo "NEW_VERSION=$NEW_VER" >> $GITHUB_ENV
# echo $NEW_VER
# - name: Set npm authentication tokens
# run: |
# echo $PATH
# echo ${{ github.workspace }}
# echo '//npm.pkg.github.com/:_authToken=${{ secrets.CR_PAT }}' > ~/.npmrc
# echo '@trustbloc-cicd:registry=https://npm.pkg.github.com' >> ~/.npmrc
# echo '@trustbloc:registry=https://npm.pkg.github.com' >> ~/.npmrc
# - name: Install dependencies
# run: |
# pushd ./demo/app/web
# npm install
# popd
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v2
# - name: Login to Github Container Registry
# uses: docker/login-action@v2
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.CR_PAT }}
# - name: Build and Push container image
# uses: docker/build-push-action@v4
# with:
# context: .
# file: ./images/demo/app/Dockerfile
# platforms: linux/amd64
# build-args: |
# ALPINE_VER=3.18
# GO_VER=1.21
# push: true
# tags: |
# ghcr.io/trustbloc/wallet-demo-app:${{ env.NEW_VERSION }}
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

PublishIosSDKRelease:
needs: [ PublishAndroidSDKRelease ]
runs-on: macos-latest
Expand Down
20 changes: 0 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ generate-android-bindings:
generate-ios-bindings:
@GIT_REV="${GIT_REV}" NEW_VERSION="${NEW_VERSION}" BUILD_TIME="${BUILD_TIME}" make generate-ios-bindings -C ./cmd/wallet-sdk-gomobile

.PHONY: generate-js-bindings
generate-js-bindings:
@make generate-js-bindings -C ./cmd/wallet-sdk-js

.PHONY: copy-android-bindings
copy-android-bindings:
@mkdir -p "demo/app/android/app/libs" && cp -R cmd/wallet-sdk-gomobile/bindings/android/walletsdk.aar demo/app/android/app/libs
Expand All @@ -64,10 +60,6 @@ copy-android-bindings:
copy-ios-bindings:
@rm -rf demo/app/ios/Runner/walletsdk.xcframework && cp -R cmd/wallet-sdk-gomobile/bindings/ios/walletsdk.xcframework demo/app/ios/Runner

.PHONY: copy-js-bindings
copy-js-bindings:
@rm -rf demo/app/web/node_modules && mkdir -p demo/app/web/node_modules/@trustbloc-cicd/wallet-sdk-js && cp -r cmd/wallet-sdk-js/dist demo/app/web/node_modules/@trustbloc-cicd/wallet-sdk-js/dist && cp cmd/wallet-sdk-js/dist/wallet-sdk.wasm demo/app/web

.PHONY: demo-app-ios
demo-app-ios:generate-ios-bindings copy-ios-bindings
@cd demo/app && flutter doctor && flutter clean && npm install -g ios-sim && ios-sim start --devicetypeid "iPhone-14" && flutter devices && flutter run
Expand All @@ -76,18 +68,6 @@ demo-app-ios:generate-ios-bindings copy-ios-bindings
demo-app-android: generate-android-bindings copy-android-bindings
@cd demo/app && flutter doctor && flutter clean && flutter run && flutter emulators --launch Pixel_3a_API_33_arm64-v8a && flutter run -d Pixel_3a_API_33_arm64-v8a

.PHONY: demo-app-web-local
demo-app-web-local: generate-js-bindings copy-js-bindings
@cd demo/app && flutter doctor && flutter clean && flutter run -d chrome --release

.PHONY: demo-app-web
demo-app-web:
@cd demo/app/web && rm -rf node_modules && npm i && flutter doctor && flutter clean && flutter run -d chrome --release

.PHONY: build-demo-app-web-docker
build-demo-app-web-docker:
@docker build -f ./images/demo/app/Dockerfile --no-cache -t $(DOCKER_OUTPUT_NS)/$(REPO_IMAGE_NAME)/wallet-demo-app:latest .

.PHONY: sample-webhook
sample-webhook:
@echo "Building sample webhook server"
Expand Down
20 changes: 1 addition & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ The project contains the following source code components and build scripts for
- To jump straight to usage documentation, see [here](cmd/wallet-sdk-gomobile/docs/usage.md).
- [Scripts to generate Android and iOS-compatible bindings](cmd/wallet-sdk-gomobile/README.md)
- Allows the Go SDK to be used in an Android or iOS app.
- EXPERIMENTAL: WebAssembly(WASM)/JavaScript(JS) SDK
- [Scripts to generate JavaScript/WebAssembly(WASM) bindings](cmd/wallet-sdk-js/README.md)
- Allows the Go SDK to be used in a Web Application. Refer SDK usage guide [here](cmd/wallet-sdk-js/docs/usage.md).

The repo also has code to generate a [Reference iOS, Android or Web App](demo/app/) built using the [Flutter](https://flutter.dev/) framework.
The repo also has code to generate a [Reference iOS and Android](demo/app/) built using the [Flutter](https://flutter.dev/) framework.

## Specifications

Expand All @@ -41,7 +38,6 @@ The TrustBloc Wallet SDK implements following specifications.

## Build/Run
- [GoMobile Bindings (iOS/Android)](cmd/wallet-sdk-gomobile/README.md)
- [JavaScript/WebAssembly(WASM) Bindings](cmd/wallet-sdk-js/README.md)
- [Demo/Reference App](demo/app/README.md)

## Library/Package
Expand Down Expand Up @@ -81,20 +77,6 @@ The Wallet SDK iOS xcframework packages are distributed through Swift Package Ma
[wallet-sdk tags](https://github.com/trustbloc/wallet-sdk/tags) with the suffix `-swift-pm` (e.g., `1.0.0-swift-pm`) for the
latest releases.

### Web
The Wallet SDK JS package is distributed through npm. Please refer to
[wallet-sdk-js package](https://github.com/trustbloc-cicd/snapshot/pkgs/npm/wallet-sdk-js) for the latest snapshot releases.

#### Web Config
The distributed package contains the WASM build file (`wallet-sdk.wasm`) inside `node_modules/@trustbloc-cicd/wallet-sdk-js/dist`,
which you may want to store in a different location within your project along with other assets.
In such case, you need to provide the path to the location of the WASM build file through
the `opts.assestPath` parameter when you create an Agent instance:
```js
const kmsDatabase = await CreateDB("test")
agent = new Agent({assetsPath: "path-to-folder-with-wallet-sdk-wasm-file", didResolverURI:didResolverURI, kmsDatabase: kmsDatabase});
await agent.initialize();
```

## Project structure

Expand Down
31 changes: 0 additions & 31 deletions cmd/wallet-sdk-js/Makefile

This file was deleted.

7 changes: 0 additions & 7 deletions cmd/wallet-sdk-js/README.md

This file was deleted.

Loading

0 comments on commit 508a097

Please sign in to comment.