Skip to content

Commit

Permalink
[FABN-909] Move identity classes into fabric-common
Browse files Browse the repository at this point in the history
Remove identity.js from fabric-client, and put the three
classes (Identity, Signer, SigningIdentity) into fabric-common
instead as separate files.

Change-Id: Ie149a04cf7420e7ba3c25f678eb2961f61ce34bb
Signed-off-by: Simon Stone <[email protected]>
  • Loading branch information
Simon Stone committed Feb 5, 2019
1 parent 8dcfe51 commit 3d0c72f
Show file tree
Hide file tree
Showing 23 changed files with 626 additions and 281 deletions.
1 change: 0 additions & 1 deletion build/tasks/ca.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ const DEPS = [
'fabric-client/lib/impl/ecdsa/*',
'fabric-client/lib/impl/CryptoKeyStore.js',
'fabric-client/lib/impl/FileKeyValueStore.js',
'fabric-client/lib/msp/identity.js',
'fabric-client/lib/msp/msp.js',
'fabric-client/types/tsconfig.json',
'fabric-client/types/base.d.ts'
Expand Down
2 changes: 1 addition & 1 deletion fabric-client/lib/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const MSPManager = require('./msp/msp-manager.js');
const Policy = require('./Policy.js');
const Constants = require('./Constants.js');
const CollectionConfig = require('./SideDB.js');
const {Identity} = require('./msp/identity.js');
const {Identity} = require('fabric-common');
const ChannelHelper = require('./utils/ChannelHelper');

const ImplicitMetaPolicy_Rule = {0: 'ANY', 1: 'ALL', 2: 'MAJORITY'};
Expand Down
2 changes: 1 addition & 1 deletion fabric-client/lib/ChannelEventHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const utils = require('./utils.js');
const clientUtils = require('./client-utils.js');
const Constants = require('./Constants.js');
const logger = utils.getLogger('ChannelEventHub.js');
const {Identity} = require('./msp/identity');
const {Identity} = require('fabric-common');
const TransactionID = require('./TransactionID');
const util = require('util');

Expand Down
3 changes: 1 addition & 2 deletions fabric-client/lib/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
const sdkUtils = require('./utils.js');
const clientUtils = require('./client-utils.js');

const {KeyValueStore} = require('fabric-common');
const {KeyValueStore, Signer, SigningIdentity} = require('fabric-common');
const BaseClient = require('./BaseClient.js');
const User = require('./User.js');
const Channel = require('./Channel.js');
Expand All @@ -19,7 +19,6 @@ const Peer = require('./Peer.js');
const ChannelEventHub = require('./ChannelEventHub');
const Orderer = require('./Orderer.js');
const TransactionID = require('./TransactionID.js');
const {Signer, SigningIdentity} = require('./msp/identity.js');
const crypto = require('crypto');

const util = require('util');
Expand Down
6 changes: 1 addition & 5 deletions fabric-client/lib/User.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,8 @@

const util = require('util');
const sdkUtils = require('./utils.js');
const {CryptoAlgorithms} = require('fabric-common');
const {CryptoAlgorithms, Identity, Signer, SigningIdentity} = require('fabric-common');
const logger = sdkUtils.getLogger('User.js');
const idModule = require('./msp/identity.js');
const Identity = idModule.Identity;
const SigningIdentity = idModule.SigningIdentity;
const Signer = idModule.Signer;

/**
* The User class represents users that have been enrolled and represented by
Expand Down
248 changes: 0 additions & 248 deletions fabric-client/lib/msp/identity.js

This file was deleted.

5 changes: 1 addition & 4 deletions fabric-client/lib/msp/msp.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@
*/
'use strict';

const {CryptoAlgorithms} = require('fabric-common');
const idModule = require('./identity.js');
const Identity = idModule.Identity;
const SigningIdentity = idModule.SigningIdentity;
const {CryptoAlgorithms, Identity, SigningIdentity} = require('fabric-common');
const utils = require('../utils.js');
const logger = utils.getLogger('msp.js');

Expand Down
2 changes: 1 addition & 1 deletion fabric-client/test/Channel.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const Channel = require('fabric-client/lib/Channel');
const ChannelRewire = rewire('fabric-client/lib/Channel');
const ChannelEventHub = require('fabric-client/lib/ChannelEventHub');
const Client = require('fabric-client/lib/Client');
const {Identity, SigningIdentity} = require('fabric-client/lib/msp/identity');
const {Identity, SigningIdentity} = require('fabric-common');
const MSP = require('fabric-client/lib/msp/msp');
const MSPManager = require('fabric-client/lib/msp/msp-manager');
const Orderer = require('fabric-client/lib/Orderer');
Expand Down
2 changes: 1 addition & 1 deletion fabric-client/test/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const rewire = require('rewire');
const Client = rewire('../lib/Client');
const NetworkConfig = require('../lib/impl/NetworkConfig_1_0');
const fs = require('fs');
const {Identity} = require('../lib/msp/identity');
const {Identity} = require('fabric-common');
const Package = require('../lib/Package');
const path = require('path');
const User = require('../lib/User');
Expand Down
2 changes: 1 addition & 1 deletion fabric-client/test/TransactionID.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const rewire = require('rewire');
const TransactionID = require('../lib/TransactionID');
const TransactionIDRewire = rewire('../lib/TransactionID');

const Identity = require('../lib/msp/identity').Identity;
const {Identity} = require('fabric-common');
const User = require('../lib/User');
const Utils = require('../lib/utils');

Expand Down
8 changes: 7 additions & 1 deletion fabric-common/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@ const Config = require('./lib/Config');
const CryptoAlgorithms = require('./lib/CryptoAlgorithms');
const CryptoSuite = require('./lib/CryptoSuite');
const HashPrimitives = require('./lib/HashPrimitives');
const Identity = require('./lib/Identity');
const Key = require('./lib/Key');
const KeyValueStore = require('./lib/KeyValueStore');
const Signer = require('./lib/Signer');
const SigningIdentity = require('./lib/SigningIdentity');

module.exports = {
Config,
CryptoAlgorithms,
CryptoSuite,
HashPrimitives,
Identity,
Key,
KeyValueStore
KeyValueStore,
Signer,
SigningIdentity
};
Loading

0 comments on commit 3d0c72f

Please sign in to comment.