Skip to content
This repository has been archived by the owner on Oct 7, 2024. It is now read-only.

Commit

Permalink
changes from review
Browse files Browse the repository at this point in the history
  • Loading branch information
bergarces committed Dec 9, 2022
1 parent 500e1a3 commit a486f5b
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,15 @@ class KeyringController extends EventEmitter {
}
}

/**
* Instantiate, initialize and return a new keyring
*
* The keyring instantiated is of the given `type`.
*
* @param {string} type - The type of keyring to add.
* @param {Object} data - The data to restore a previously serialized keyring.
* @returns {Promise<Keyring>} The new keyring.
*/
async _newKeyring(type, data) {
const keyringBuilder = this.getKeyringBuilderForType(type);

Expand All @@ -899,13 +908,18 @@ class KeyringController extends EventEmitter {
}
}

function keyringBuilderFactory(KeyringClass, BridgeClass) {
const builder = () => {
const constructorDependencies = BridgeClass ? new BridgeClass() : undefined;
return new KeyringClass(constructorDependencies);
};
/**
* Get builder function for `Keyring`
*
* Returns a builder function for `Keyring` with a `type` property.
*
* @param {typeof Keyring} Keyring - The Keyring class for the builder.
* @returns {function: Keyring} A builder function for the given Keyring.
*/
function keyringBuilderFactory(Keyring) {
const builder = () => new Keyring();

builder.type = KeyringClass.type;
builder.type = Keyring.type;

return builder;
}
Expand Down

0 comments on commit a486f5b

Please sign in to comment.