Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env.sample
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
JWT_SECRET_KEY="secret"
NODE_ENV="development"

PROVIDER_KEYFILE=accounts/provider.json
#PROVIDER_KEYFILE=accounts/provider.json
RSA_PRIVKEY_FILE=accounts/rsa_priv_key.pem
RSA_PUBKEY_FILE=accounts/rsa_pub_key.pem
AUTHLIB_INSECURE_TRANSPORT=true
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/testing-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,16 @@ jobs:
env:
IPFS_PROJECT_ID: ${{ secrets.IPFS_PROJECT_ID }}
IPFS_PROJECT_SECRET: ${{ secrets.IPFS_PROJECT_SECRET }}
PROVIDER_KEYFILE: ${{ secrets.PROVIDER_KEYFILE }}
run: |
yarn setup:dev
yarn start &

# wait for node to start
wget --retry-connrefused --tries=20 http://localhost:8030
- name: Run tests
env:
PROVIDER_KEYFILE: ${{ secrets.PROVIDER_KEYFILE }}
run: |
# HDWalletProvider keeps jest from exiting
yarn integration --detectOpenHandles
2 changes: 1 addition & 1 deletion .github/workflows/testing-nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
./scripts/wait-nevermined.sh
- name: Start node
env:
PROVIDER_KEYFILE: accounts/provider.json
PROVIDER_KEYFILE: ${{ secrets.PROVIDER_KEYFILE }}
RSA_PRIVKEY_FILE: accounts/rsa_priv_key.pem
RSA_PUBKEY_FILE: accounts/rsa_pub_key.pem
PROVIDER_BABYJUB_SECRET: ${{ secrets.PROVIDER_BABYJUB_SECRET }}
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:
- name: Check code formatting
run: yarn format:check
- name: Run tests
env:
PROVIDER_KEYFILE: ${{ secrets.PROVIDER_KEYFILE }}
run: |
yarn setup:dev
yarn test --detectOpenHandles
8 changes: 6 additions & 2 deletions config/nevermined.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,12 @@ const configBase = {
configBase.accounts = []

if (process.env.PROVIDER_KEYFILE) {
const str = fs.readFileSync(process.env.PROVIDER_KEYFILE).toString()
configBase.accounts = [ethers.Wallet.fromEncryptedJsonSync(str, process.env.PROVIDER_PASSWORD)]
configBase.accounts = [
ethers.Wallet.fromEncryptedJsonSync(
process.env.PROVIDER_KEYFILE,
process.env.PROVIDER_PASSWORD,
),
]
}

const config = configBase
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-ts",
"version": "3.0.20",
"version": "3.0.21",
"description": "Nevermined Node",
"main": "main.ts",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/encrypt/encrypt.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { EncryptController } from './encrypt.controller'
import request from 'supertest'
import { ConfigModule } from '../shared/config/config.module'
import { ConfigService } from '../shared/config/config.service'
import { accountFromCredentialsFile, decrypt } from '../common/helpers/encryption.helper'
import { accountFromCredentialsData, decrypt } from '../common/helpers/encryption.helper'

/* eslint-disable @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-argument */

Expand Down Expand Up @@ -47,8 +47,8 @@ describe('Info', () => {
expect(await decrypt(config.cryptoConfig(), result, 'PSK-RSA')).toBe('msg')
})

it('load NvmAccount from credentials file', async () => {
const account = await accountFromCredentialsFile(
it('load NvmAccount from credentials data', async () => {
const account = await accountFromCredentialsData(
process.env.PROVIDER_KEYFILE as string,
process.env.PROVIDER_PASSWORD as string,
)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/config/config.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export class ConfigService {
this.envConfig = this.validateInput(configProfile)
this.crypto = {
provider_password: this.get('PROVIDER_PASSWORD') || '',
provider_key: readFileSync(this.get('PROVIDER_KEYFILE') || '').toString(),
provider_key: this.get('PROVIDER_KEYFILE') || '',
provider_rsa_public: readFileSync(this.get('RSA_PUBKEY_FILE') || '').toString(),
provider_rsa_private: readFileSync(this.get('RSA_PRIVKEY_FILE') || '').toString(),
}
Expand Down