@gala-chain/api ∙ API
API > ChainUser
Class: ChainUser
Represents a user configuration object, containing all the information needed to authenticate and sign transactions.
Contents
- Constructors
- new ChainUser(config)
- Properties
- ethAddress
- identityKey
- name
- prefix
- privateKey
- publicKey
- Methods
- withRandomKeys()
Constructors
new ChainUser(config)
new ChainUser(
config
):ChainUser
Parameters
▪ config: object
Configuration object for the constructor.
▪ config.name?: string
If provided, the resulting prefix will be
client
and identityKey will be client|${name}
. Otherwise, the prefix
will be eth
and identityKey will be eth|${ethAddress}
.
▪ config.privateKey: string
A secp256k1 private key to be used for cryptographic operations. It will be used to calculate the public key and the ethAddress, and will be used to sign transactions.
Source
chain-api/src/client/generic/ChainUser.ts:43
Properties
ethAddress
readonly
ethAddress:string
Source
chain-api/src/client/generic/ChainUser.ts:28
identityKey
readonly
identityKey:UserAlias
Source
chain-api/src/client/generic/ChainUser.ts:27
name
readonly
name:string
Source
chain-api/src/client/generic/ChainUser.ts:26
prefix
readonly
prefix:string
Source
chain-api/src/client/generic/ChainUser.ts:25
privateKey
readonly
privateKey:string
Source
chain-api/src/client/generic/ChainUser.ts:29
publicKey
readonly
publicKey:string
Source
chain-api/src/client/generic/ChainUser.ts:30
Methods
withRandomKeys()
static
withRandomKeys(name
?):ChainUser
Generates a new ChainUser object with random keys.
Parameters
▪ name?: string
The name to be used for the ChainUser.
If provided, the resulting identityKey will be client|${name}
.
Otherwise, the identityKey will be eth|${ethAddress}
.
Returns
- A new ChainUser object with the generated random keys and the provided or default name.