Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(connector-fabric-socketio): fix strict flag warnings #1975

Merged

Conversation

outSH
Copy link
Contributor

@outSH outSH commented Apr 15, 2022

cactus-plugin-ledger-connector-fabric-socketio will compile with global strict flag.

Related issue: #1671

Signed-off-by: Michal Bajer [email protected]

outSH added a commit to outSH/cactus that referenced this pull request Apr 15, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: hyperledger-cacti#1975

Closes: hyperledger-cacti#1976

Signed-off-by: Michal Bajer <[email protected]>
@outSH
Copy link
Contributor Author

outSH commented Apr 15, 2022

@petermetz @izuru0 Please review

Copy link
Contributor

@izuru0 izuru0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

outSH added a commit to outSH/cactus that referenced this pull request Apr 19, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: hyperledger-cacti#1975

Closes: hyperledger-cacti#1976

Signed-off-by: Michal Bajer <[email protected]>
@petermetz petermetz removed the request for review from jonathan-m-hamilton April 25, 2022 22:46
Copy link
Contributor

@petermetz petermetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@outSH LGTM, thank you!

cactus-plugin-ledger-connector-fabric-socketio will compile with global strict flag.

Related issue: hyperledger-cacti#1671

Signed-off-by: Michal Bajer <[email protected]>
@petermetz petermetz force-pushed the fabric_socketio_strict_warn_fix_pr branch from 17641c1 to a79e8de Compare April 26, 2022 00:52
@petermetz petermetz merged commit 232e5c1 into hyperledger-cacti:main Apr 26, 2022
outSH added a commit to outSH/cactus that referenced this pull request May 11, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: hyperledger-cacti#1975

Closes: hyperledger-cacti#1976

Signed-off-by: Michal Bajer <[email protected]>
outSH added a commit to outSH/cactus that referenced this pull request May 19, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: hyperledger-cacti#1975

Closes: hyperledger-cacti#1976

Signed-off-by: Michal Bajer <[email protected]>
outSH added a commit to outSH/cactus that referenced this pull request May 27, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: hyperledger-cacti#1975

Closes: hyperledger-cacti#1976

Signed-off-by: Michal Bajer <[email protected]>
petermetz pushed a commit that referenced this pull request May 28, 2022
Added functional jest test fabric-socketio-connector.test that can be run during CI process.
It checks evaluate/sending transactions and monitoring for new events.
Connector had to be refactored to be testable,
tests also discovered some bugs that had to be fixed in order to pass.

SocketIOApiClient refactors:
- Added option for supplying validatorKeyValue instead of validatorKeyPath.
- JWT validation function works with key value now (instead of reading the key).
- Validator can now return messages that are not encrypted (it throwed error previously).
- Adjusted unit tests.

connector-fabric-socketio refactors:
- Connector can be run both as a standalone app and loaded as a module (www.js file).
  Caller can use exported startFabricSocketIOConnector function to run the connector.
  Configuration must be supplied in file or in env variable like it's done in functional test.
- All cryptographic data (keys, certificates, etc…) can now be supplied as a value
  (previously it supported only path to a file).
- sendSignedTransaction can now be called synchronously (it had wrong response format before).
- Fixed a bug introduced during my last changes in this component,
  which caused fabric-client session to be disconnected but still reused by follow-up requests.
  I didn't know that gateway disconnects client it operates on.
- Increased JWT expiration to 15 minutes to prevent constant JWT expiration error
  (I'm pretty sure 15 minutes is still secure period).
- Minor improvements (logging, formatting, etc…)

fabric-test-ledger-v1 changes:
- Added adminCredentials to have programatic access to admin credentials on currently used ledger
 (unlikely, but can change in the future).

Depends on: #1975

Closes: #1976

Signed-off-by: Michal Bajer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants