Skip to content

Commit

Permalink
[FAB-6658] NodeSDK - add caName to ca client
Browse files Browse the repository at this point in the history
Add the caName getter to the fabric-ca client.

Change-Id: I2788bd1bd1d6db16ac53857e22b87e083d89a915
Signed-off-by: Bret Harrison <[email protected]>
  • Loading branch information
harrisob committed Oct 17, 2017
1 parent 07a6323 commit c08ea0f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
11 changes: 11 additions & 0 deletions fabric-ca-client/lib/FabricCAClientImpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ var FabricCAServices = class extends BaseClient {
cryptoSuite = cryptoSuite_p;
}

this.caName = caName;

var endpoint = FabricCAServices._parseURL(url);

if (!!cryptoSuite) {
Expand All @@ -96,6 +98,15 @@ var FabricCAServices = class extends BaseClient {
logger.debug('Successfully constructed Fabric CA service client: endpoint - %j', endpoint);

}
/**
* Returns the name of the certificate authority.
*
* @returns {string} caName
*/
getCaName() {
return this.caName;
}

/**
* @typedef {Object} RegisterRequest
* @property {string} enrollmentID - ID which will be used for enrollment
Expand Down
1 change: 1 addition & 0 deletions test/unit/fabric-ca-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,7 @@ test('FabricCAServices: Test optional consturctor', function(t) {
function () {
let service = new FabricCAServices(opts);
t.equals(service._fabricCAClient._caName,'someca','Caname should have been passed correctly');
t.equals(service.getCaName(), 'someca', 'checket getter method for caname');
},
null,
'FabricCAServices consturctor with object and just url'
Expand Down

0 comments on commit c08ea0f

Please sign in to comment.