Skip to content

Commit

Permalink
fix(js)!: use patched ref-napi/ffi-napi for nodejs (#171)
Browse files Browse the repository at this point in the history
Signed-off-by: Ariel Gentile <[email protected]>
  • Loading branch information
genaris authored Aug 18, 2023
1 parent 1e67835 commit a0307cb
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 51 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -312,10 +312,10 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Set up Node.JS 16.x
- name: Set up Node.JS 18.x
uses: actions/setup-node@v3
with:
node-version: 16.x
node-version: 18.x

- name: Fetch library artifacts
uses: actions/download-artifact@v3
Expand Down
3 changes: 1 addition & 2 deletions wrappers/javascript/aries-askar-nodejs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ Wrapper for Nodejs around Aries Askar

## Requirements

This has been tested extensively with Nodejs version `16.11.0` and `16.15.0`.
Older and newer versions might also work, but they have not been tested.
This library requires (and has been tested extensively with) Node.js version `18.x`. Newer versions might also work, but they have not been tested.

## Installation

Expand Down
10 changes: 7 additions & 3 deletions wrappers/javascript/aries-askar-nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"install": "node-pre-gyp install --target_arch=$(node scripts/arch.js) --target_platform=$(node scripts/platform.js)"
},
"devDependencies": {
"@types/ffi-napi": "^4.0.5",
"@types/2060.io__ffi-napi": "npm:@types/ffi-napi",
"@types/2060.io__ref-napi": "npm:@types/ref-napi",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.31",
"@types/ref-array-di": "^1.2.3",
Expand All @@ -49,10 +50,10 @@
"dependencies": {
"@hyperledger/aries-askar-shared": "0.1.1",
"@mapbox/node-pre-gyp": "^1.0.10",
"ffi-napi": "^4.0.3",
"@2060.io/ffi-napi": "4.0.5",
"@2060.io/ref-napi": "3.0.4",
"node-cache": "^5.1.2",
"ref-array-di": "^1.2.2",
"ref-napi": "^3.0.3",
"ref-struct-di": "^1.1.1"
},
"binary": {
Expand All @@ -61,5 +62,8 @@
"remote_path": "v0.2.9",
"host": "https://github.com/hyperledger/aries-askar/releases/download/",
"package_name": "library-{platform}-{arch}.tar.gz"
},
"engines": {
"node": ">= 18"
}
}
2 changes: 1 addition & 1 deletion wrappers/javascript/aries-askar-nodejs/src/ffi/alloc.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { alloc } from 'ref-napi'
import { alloc } from '@2060.io/ref-napi'

import { FFI_POINTER, FFI_STRING, FFI_INT32, FFI_INT8 } from './primitives'
import { SecretBufferStruct, EncryptedBufferStruct, AeadParamsStruct } from './structures'
Expand Down
4 changes: 2 additions & 2 deletions wrappers/javascript/aries-askar-nodejs/src/ffi/callback.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Callback } from 'ffi-napi'
import { refType } from 'ref-napi'
import { Callback } from '@2060.io/ffi-napi'
import { refType } from '@2060.io/ref-napi'

import { allocateCallbackBuffer } from './alloc'
import { FFI_VOID, FFI_CALLBACK_ID, FFI_ERROR_CODE, FFI_STRING, FFI_INT32 } from './primitives'
Expand Down
4 changes: 2 additions & 2 deletions wrappers/javascript/aries-askar-nodejs/src/ffi/conversion.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { ByteBufferType, EncryptedBufferType } from './structures'
import type { Pointer } from '@2060.io/ref-napi'
import type { TypedArray } from 'ref-array-di'
import type { Pointer } from 'ref-napi'

import { reinterpret } from '@2060.io/ref-napi'
import { EncryptedBuffer } from '@hyperledger/aries-askar-shared'
import { reinterpret } from 'ref-napi'

import { ByteBufferStruct } from './structures'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { refType } from 'ref-napi'
import { refType } from '@2060.io/ref-napi'

// Primitives

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { ByteBufferStruct, SecretBufferStruct } from './structures'

import { NULL } from '@2060.io/ref-napi'
import { Key, ArcHandle, StoreHandle, SessionHandle, ScanHandle, Jwk } from '@hyperledger/aries-askar-shared'
import { NULL } from 'ref-napi'

import { uint8arrayToByteBufferStruct } from './conversion'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { default as ref, refType } from '@2060.io/ref-napi'
import refArray from 'ref-array-di'
import { default as ref, refType } from 'ref-napi'
import refStruct from 'ref-struct-di'

import { FFI_INT32, FFI_INT64, FFI_UINT8 } from './primitives'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { refType } from 'ref-napi'
import { refType } from '@2060.io/ref-napi'

import {
FFI_CALLBACK_ID,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { NativeMethods } from './NativeBindingInterface'

import { Library } from 'ffi-napi'
import { Library } from '@2060.io/ffi-napi'
import fs from 'fs'
import os from 'os'
import path from 'path'
Expand Down
3 changes: 0 additions & 3 deletions wrappers/javascript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,5 @@
"prettier": "^2.5.1",
"ts-jest": "^29.0.5",
"typescript": "^4.5.5"
},
"engines": {
"node": ">= 12"
}
}
69 changes: 38 additions & 31 deletions wrappers/javascript/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,28 @@
# yarn lockfile v1


"@2060.io/[email protected]":
version "4.0.5"
resolved "https://registry.yarnpkg.com/@2060.io/ffi-napi/-/ffi-napi-4.0.5.tgz#52fd369f25cba85319eb5625e2d598925a1713ce"
integrity sha512-CdV4y/gXYI7yzSiSHWvY/JdW06Li57Gdc3ZKzNesXrCQg4IoHL0S+zIxEr6Mbr0fCNVvj1GNSh8Uz9vSQkCXYA==
dependencies:
"@2060.io/ref-napi" "3.0.4"
debug "^4.1.1"
get-uv-event-loop-napi-h "^1.0.5"
node-addon-api "^3.0.0"
node-gyp-build "^4.2.1"
ref-struct-di "^1.1.0"

"@2060.io/[email protected]":
version "3.0.4"
resolved "https://registry.yarnpkg.com/@2060.io/ref-napi/-/ref-napi-3.0.4.tgz#6a78093b36e8f4ffeb750f706433869382e73eb1"
integrity sha512-Aqf699E+DKs2xANx8bSkuzXyG9gcZ2iFkAk1kUTA8KbV5BSPQtIcBJexzohSRi9QWDhP4X54NLm7xwGA0UNCdQ==
dependencies:
debug "^4.1.1"
get-symbol-from-current-process-h "^1.0.2"
node-addon-api "^3.0.0"
node-gyp-build "^4.2.1"

"@ampproject/remapping@^2.2.0":
version "2.2.1"
resolved "https://registry.yarnpkg.com/@ampproject/remapping/-/remapping-2.2.1.tgz#99e8e11851128b8702cd57c33684f1d0f260b630"
Expand Down Expand Up @@ -1935,6 +1957,22 @@
"@tufjs/canonical-json" "1.0.0"
minimatch "^9.0.0"

"@types/2060.io__ffi-napi@npm:@types/ffi-napi":
version "4.0.7"
resolved "https://registry.yarnpkg.com/@types/ffi-napi/-/ffi-napi-4.0.7.tgz#b3a9beeae160c74adca801ca1c9defb1ec0a1a32"
integrity sha512-2CvLfgxCUUSj7qVab6/uFLyVpgVd2gEV4H/TQEHHn6kZTV8iTesz9uo0bckhwzsh71atutOv8P3JmvRX2ZvpZg==
dependencies:
"@types/node" "*"
"@types/ref-napi" "*"
"@types/ref-struct-di" "*"

"@types/2060.io__ref-napi@npm:@types/ref-napi", "@types/ref-napi@*":
version "3.0.7"
resolved "https://registry.yarnpkg.com/@types/ref-napi/-/ref-napi-3.0.7.tgz#20adc93a7a2f9f992dfb17409fd748e6f4bf403d"
integrity sha512-CzPwr36VkezSpaJGdQX/UrczMSDsDgsWQQFEfQkS799Ft7n/s183a53lsql7RwVq+Ik4yLEgI84pRnLC0XXRlA==
dependencies:
"@types/node" "*"

"@types/babel__core@^7.1.14":
version "7.20.1"
resolved "https://registry.yarnpkg.com/@types/babel__core/-/babel__core-7.20.1.tgz#916ecea274b0c776fec721e333e55762d3a9614b"
Expand Down Expand Up @@ -1986,15 +2024,6 @@
resolved "https://registry.yarnpkg.com/@types/fast-text-encoding/-/fast-text-encoding-1.0.1.tgz#7a9e6d8dd2ac1fa70772b500a307c2620cec1fe3"
integrity sha512-DRFqoqjXfvuX3f5jIQKAQr/QzuFdNoHOtou0KQ9bzUJOreCciO7T/kFJHgEote7QusmgE1fTxsQSqNvXVR0GBw==

"@types/ffi-napi@^4.0.5":
version "4.0.7"
resolved "https://registry.yarnpkg.com/@types/ffi-napi/-/ffi-napi-4.0.7.tgz#b3a9beeae160c74adca801ca1c9defb1ec0a1a32"
integrity sha512-2CvLfgxCUUSj7qVab6/uFLyVpgVd2gEV4H/TQEHHn6kZTV8iTesz9uo0bckhwzsh71atutOv8P3JmvRX2ZvpZg==
dependencies:
"@types/node" "*"
"@types/ref-napi" "*"
"@types/ref-struct-di" "*"

"@types/graceful-fs@^4.1.2", "@types/graceful-fs@^4.1.3":
version "4.1.6"
resolved "https://registry.yarnpkg.com/@types/graceful-fs/-/graceful-fs-4.1.6.tgz#e14b2576a1c25026b7f02ede1de3b84c3a1efeae"
Expand Down Expand Up @@ -4421,18 +4450,6 @@ fb-watchman@^2.0.0:
dependencies:
bser "2.1.1"

ffi-napi@^4.0.3:
version "4.0.3"
resolved "https://registry.yarnpkg.com/ffi-napi/-/ffi-napi-4.0.3.tgz#27a8d42a8ea938457154895c59761fbf1a10f441"
integrity sha512-PMdLCIvDY9mS32RxZ0XGb95sonPRal8aqRhLbeEtWKZTe2A87qRFG9HjOhvG8EX2UmQw5XNRMIOT+1MYlWmdeg==
dependencies:
debug "^4.1.1"
get-uv-event-loop-napi-h "^1.0.5"
node-addon-api "^3.0.0"
node-gyp-build "^4.2.1"
ref-napi "^2.0.1 || ^3.0.2"
ref-struct-di "^1.1.0"

[email protected], figures@^3.0.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af"
Expand Down Expand Up @@ -8735,16 +8752,6 @@ ref-array-di@^1.2.2:
array-index "^1.0.0"
debug "^3.1.0"

"ref-napi@^2.0.1 || ^3.0.2", ref-napi@^3.0.3:
version "3.0.3"
resolved "https://registry.yarnpkg.com/ref-napi/-/ref-napi-3.0.3.tgz#e259bfc2bbafb3e169e8cd9ba49037dd00396b22"
integrity sha512-LiMq/XDGcgodTYOMppikEtJelWsKQERbLQsYm0IOOnzhwE9xYZC7x8txNnFC9wJNOkPferQI4vD4ZkC0mDyrOA==
dependencies:
debug "^4.1.1"
get-symbol-from-current-process-h "^1.0.2"
node-addon-api "^3.0.0"
node-gyp-build "^4.2.1"

ref-struct-di@^1.1.0, ref-struct-di@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/ref-struct-di/-/ref-struct-di-1.1.1.tgz#5827b1d3b32372058f177547093db1fe1602dc10"
Expand Down

0 comments on commit a0307cb

Please sign in to comment.