-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-5363] NodeSDK - common config part 1
The NodeSDK use of the common network configuration. This is using the latest yaml schema as described in the FAB. This demonstrates how the SDK would load a configuration and build a channel instance based on the network configuration. This starts the use of how peers would be automatically selected. Change-Id: I0b1479d12684aa13bc052e872fbf118166004453 Signed-off-by: Bret Harrison <[email protected]>
- Loading branch information
1 parent
febff14
commit 1e61110
Showing
19 changed files
with
2,544 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
/* | ||
Copyright 2017 IBM All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var api = require('./api.js'); | ||
var utils = require('./utils.js'); | ||
var util = require('util'); | ||
|
||
var logger = utils.getLogger('CertificateAuthority.js'); | ||
|
||
/** | ||
* The CertificateAuthority class represents an Certificate Authority in the target blockchain network. | ||
* | ||
* @class | ||
*/ | ||
var CertificateAuthority = class { | ||
|
||
/** | ||
* Construct a CertificateAuthority object | ||
* @param {string} name - The name of this Certificate Authority | ||
* @returns {string} The url of this CertificateAuthority | ||
* @returns {CertificateAuthority} The CertificateAuthority instance. | ||
*/ | ||
constructor(name, url, connection_options, tlsCACerts, registrar) { | ||
logger.debug('CertificateAuthority.const '); | ||
logger.debug('Organization.const '); | ||
if (typeof name === 'undefined' || name === null) { | ||
throw new Error('Missing name parameter'); | ||
} | ||
if (typeof url === 'undefined' || url === null) { | ||
throw new Error('Missing url parameter'); | ||
} | ||
this._name = name; | ||
this._url = url; | ||
this._connection_options = connection_options; | ||
this._tlsCACerts = tlsCACerts;; | ||
this._registrar = registrar; | ||
} | ||
|
||
/** | ||
* Gets the name of this CertificateAuthority | ||
* | ||
* @returns {string} The name of this CertificateAuthority | ||
*/ | ||
getName() { | ||
return this._name; | ||
} | ||
|
||
/** | ||
* Gets the url of this CertificateAuthority | ||
* | ||
* @returns {string} The url of this CertificateAuthority | ||
*/ | ||
getUrl() { | ||
return this._url; | ||
} | ||
|
||
/** | ||
* Gets the connection options of this CertificateAuthority | ||
* | ||
* @returns {object} The connection options of this CertificateAuthority | ||
*/ | ||
getConnectionOptions() { | ||
return this._connection_options; | ||
} | ||
|
||
/** | ||
* Gets the TLS CA Cert of this CertificateAuthority | ||
* | ||
* @returns {string} The TLS CA Cert PEM string of this CertificateAuthority | ||
*/ | ||
getTlsCACerts() { | ||
return this._tlsCACerts; | ||
} | ||
|
||
/** | ||
* Gets the registrar of this CertificateAuthority | ||
* | ||
* @returns {object} The registrar of this CertificateAuthority | ||
*/ | ||
getRegistrar() { | ||
return this._registrar; | ||
} | ||
|
||
/** | ||
* return a printable representation of this object | ||
*/ | ||
toString() { | ||
return ' CertificateAuthority : {' + | ||
'name : ' + this._name + | ||
', url : ' + this._url + | ||
'}'; | ||
} | ||
|
||
}; | ||
|
||
module.exports = CertificateAuthority; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.