- server
- app
Module containing functions about Factom server identities.
src/server/factom-server-identity-manager.js:27-95
Main class to read and write Factom identities.
opts
Object? Options of connection to factomd and factom-walletd.opts.factomd
Object? Options of connection to factomd. See https://factomjs.luciap.ca/#connectionoptions.opts.walletd
Object? Options of connection to factom-walletd. See https://factomjs.luciap.ca/#connectionoptions.
const manager = new FactomServerIdentityManager({
factomd: {
host: 'api.factomd.net',
port: 443,
protocol: 'https'
},
walletd: {
host: 'localhost',
user: 'paul',
password: 'pass'
}
});
src/server/factom-server-identity-manager.js:85-94
Add a coinbase cancel message to a server identity.
rootChainId
string Identity Root Chain Id.descriptorHeight
number Coinbase descriptor block height.descriptorIndex
number Coinbase descriptor index.sk1
string Server identity Secret Key 1.ecAddress
string Entry Credit address paying for the entry.
Returns {txId: string, repeatedCommit: boolean, chainId: string, entryHash: string} Info about the Entry insertion.
src/server/factom-server-identity-manager.js:38-40
Get a server identity information.
rootChainId
string Identity Root Chain Id.
Returns {rootChainId: string, serverManagementSubchainId: string, coinbaseAddress: string, efficiency: number, identityKeys: Array<string>}
src/server/factom-server-identity-manager.js:48-50
Get a server identity information history.
rootChainId
string Identity Root Chain Id.
Returns {rootChainId: string, serverManagementSubchainId: string, coinbaseAddressHistory: Array<Object>, efficiencyHistory: Array<Object>, identityKeys: Array<string>}
src/server/factom-server-identity-manager.js:60-62
Update the coinbase address of a server identity.
rootChainId
string Identity Root Chain Id.fctAddress
string Public Factoid address to set as coinbase address.sk1
string Server identity Secret Key 1.ecAddress
string Entry Credit address paying for the entry.
Returns {txId: string, repeatedCommit: boolean, chainId: string, entryHash: string} Info about the Entry insertion.
src/server/factom-server-identity-manager.js:72-74
Update the efficiency of a server identity.
rootChainId
string Identity Root Chain Id.efficiency
number Efficiency between 0 and 100.sk1
string Server identity Secret Key 1.ecAddress
string Entry Credit address paying for the entry.
Returns {txId: string, repeatedCommit: boolean, chainId: string, entryHash: string} Info about the Entry insertion.
src/server/coinbase-address.js:115-127
Generate Entry object to update a server identity coinbase address.
rootChainId
string Identity Root Chain Id.fctAddress
string Public Factoid address to set as the new coinbase address.sk1
string Server identity Secret Key 1.
src/server/coinbase-cancel.js:54-100
rootChainId
string Identity Root Chain Id.serverManagementSubchainId
string Server Management Subchain Id.height
number Block height of the coinbase descriptor to cancel.index
number Index of the coinbase descriptor to cancel.sk1
string Server identity Secret Key 1.
src/server/efficiency.js:105-125
Generate Entry object to update a server identity efficiency.
rootChainId
string Identity Root Chain Id.serverManagementSubchainId
string Server Management Subchain Id.efficiency
number Efficiency between 0 and 100.sk1
string Server identity Secret Key 1.
Returns {chainId: Buffer, extIds: Array<Buffer>, content: Buffer}
Module containing functions about Factom identities for applications.
src/app/factom-identity-manager.js:29-112
Main class to read and write Factom identities.
daemonsConfig
Object? Configs of connection to factomd and factom-walletd.daemonsConfig.factomd
Object? Configs of connection to factomd. See https://factomjs.luciap.ca/#connectionoptions.daemonsConfig.walletd
Object? Configs of connection to factom-walletd. See https://factomjs.luciap.ca/#connectionoptions.
opts
Object? Options.
const manager = new FactomIdentityManager({
factomd: {
host: 'api.factomd.net',
port: 443,
protocol: 'https'
},
walletd: {
host: 'localhost',
user: 'paul',
password: 'pass'
}
});
src/app/factom-identity-manager.js:87-89
Create a new identity on-chain.
name
Array<string> Array of strings used as the "name" of the identity.keys
(Array<string> | number) Either an array of public identity keys or a number. If a number is provided the library generate new random keys (the secret keys are part of the returned object).ecAddress
string Entry Credit address paying for the entry. If a public EC address is provided the library attempts to retrieve the secret part from the configured walletd instance.
Returns Array<{identityKeys: {public: string, secret: string}, txId: string, repeatedCommit: boolean, chainId: string, entryHash: string}> Info about the Chain creation together with the list of identity keys associated with the new identity.
src/app/factom-identity-manager.js:43-45
Get all the active public identity keys of an identity at a given blockchain height. If no block height is specified, check for the latest block height.
identityChainId
string Identity chain id.blockHeight
number? Specific blockchain height. If not provided check for the latest block.
Returns Array<string> Array of public identity keys active for the identity.
src/app/factom-identity-manager.js:52-54
Retrieve the identity "name" that was set at the creation of the identity chain.
identityChainId
string Identity chain id.
Returns Array<Buffer> Array of Buffer representing the name of the identity.
src/app/factom-identity-manager.js:65-74
Check if an identity key is (was) active for an identity at a given blockchain height. If no block height is specified, check for the latest block height.
identityChainId
string Identity chain id.idKey
string Public or private identity key.blockHeight
number? Specific blockchain height. If not provided check for the latest block.
Returns boolean True if the identity key is active for the identity.
src/app/factom-identity-manager.js:103-111
Replace an identity key by another on-chain.
identityChainId
string Identity chain id.keys
ObjectecAddress
string Entry Credit address paying for the entry. If a public EC address is provided the library attempts to retrieve the secret part from the configured walletd instance.
Returns {txId: string, repeatedCommit: boolean, chainId: string, entryHash: string} Info about the Entry insertion.
Extract the ed25519 cryptographic material encapsulated in the identity key.
idKey
string Public or secret identity key.
Returns Buffer Either the ed25519 32-byte public key or the 32-byte secret seed.
src/app/walletd-key-store.js:19-123
Helper class to user factom-walletd as a key store.
opts
Object? Options of connection to factom-walletd. See https://factomjs.luciap.ca/#connectionoptions.
const store = new FactomWalletdKeyStore({
host: 'localhost',
user: 'paul',
password: 'pass'
});
src/app/walletd-key-store.js:110-122
Generates a new identity key from the wallet seed and stores it into walletd. New keys are generated from the same mnemonic seed used for FCT and EC addresses.
number
number Number of identity keys to generate. (optional, default1
)
Returns {public: string, secret: string}
src/app/walletd-key-store.js:98-101
Get all identity keys stored in walletd.
Returns Array<{public: string, secret: string}>
src/app/walletd-key-store.js:30-40
Fetch corresponding identity key from the wallet if necessary.
idKey
string Identity key.
Returns string Corresponsing secret identity key.
src/app/walletd-key-store.js:48-64
Import keys in walletd.
Returns Array<{public: string, secret: string}>
src/app/walletd-key-store.js:70-91
Remove from walletd some identity keys.
src/app/key-helpers.js:129-136
Generate a random identity key pair.
Returns {public: string, secret: string} Random identity key pair.
Get the public identity key corresponding to the input identity key.
idKey
string Secret (or public) identity key.
Returns string Corresponding public identity key.
Check if an identity key is well formed.
idKey
string Public or secret identity key.
Returns boolean True if the identity key is valid.
Check if a public identity key is well formed.
pubIdKey
string Public identity key.
Returns boolean True if the public identity key is valid.
Check if a secret identity key is well formed.
secIdKey
string Public identity key.
Returns boolean True if the secret identity key is valid.
Convert a 32-byte key to a public identity key.
Returns string Public identity key.
src/app/key-helpers.js:109-111
Convert a 32-byte seed to a secret identity key.
Returns string Secret identity key.