Skip to content

Commit

Permalink
chore: Enhance gRPC TLS by Dynamic Certificate Retrieval (#2718)
Browse files Browse the repository at this point in the history
* bug: Added dynamically retrieving for the gRPC certifications

Signed-off-by: ivaylogarnev-limechain <[email protected]>

* refactor: Refactored the caching variables and grpc error handling

Signed-off-by: ivaylogarnev-limechain <[email protected]>

* refactored: ALL_NETWORK_IPS ignored for sonar checks

Signed-off-by: ivaylogarnev-limechain <[email protected]>

* refactored: ALL_NETWORK_IPS ignored for sonar checks

Signed-off-by: ivaylogarnev-limechain <[email protected]>

* refactored: ALL_NETWORK_IPS ignored for sonar checks

Signed-off-by: ivaylogarnev-limechain <[email protected]>

* refactored: ALL_NETWORK_IPS ignored for sonar checks

Signed-off-by: ivaylogarnev-limechain <[email protected]>

* fix: Delete cert cache on client close, no-sonar addition

Signed-off-by: ivaylogarnev-limechain <[email protected]>

* fix: Removed pointless certificate caching and fixed an SonarCloud ips error

Signed-off-by: ivaylogarnev-limechain <[email protected]>

* docs: Added comment for the IP address SonarCloud issue

Signed-off-by: ivaylogarnev-limechain <[email protected]>

---------

Signed-off-by: ivaylogarnev-limechain <[email protected]>
  • Loading branch information
ivaylogarnev-limechain authored Dec 17, 2024
1 parent 6e15795 commit c66beb8
Show file tree
Hide file tree
Showing 5 changed files with 248 additions and 692 deletions.
23 changes: 1 addition & 22 deletions src/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/

import ManagedNode from "./ManagedNode.js";
import { PREVIEWNET_CERTS, TESTNET_CERTS, MAINNET_CERTS } from "./NodeCerts.js";

/**
* @typedef {import("./account/AccountId.js").default} AccountId
Expand All @@ -33,7 +32,7 @@ import { PREVIEWNET_CERTS, TESTNET_CERTS, MAINNET_CERTS } from "./NodeCerts.js";
* @typedef {object} NewNode
* @property {AccountId} accountId
* @property {string} address
* @property {(address: string, cert?: string) => Channel} channelInitFunction
* @property {(address: string) => Channel} channelInitFunction
*/

/**
Expand Down Expand Up @@ -100,26 +99,6 @@ export default class Node extends ManagedNode {
);
}

/**
* @param {LedgerId|string} ledgerId
* @returns {this}
*/
setCert(ledgerId) {
switch (ledgerId.toString()) {
case "previewnet":
this._cert = PREVIEWNET_CERTS[this._accountId.toString()];
break;
case "testnet":
this._cert = TESTNET_CERTS[this._accountId.toString()];
break;
case "mainnet":
this._cert = MAINNET_CERTS[this._accountId.toString()];
break;
}

return this;
}

/**
* @returns {AccountId}
*/
Expand Down
Loading

0 comments on commit c66beb8

Please sign in to comment.