new RiseIdentity(entropyopt, solutionopt, saltopt)
Rise private identity bundle. This is the primary interface for using this module. Allows to generate new identities and use them as the context for protected operations.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
entropy | Uint8Array | | <optional> | Private key (secp256k1). If absent a new one will be created. | |
solution | RiseSolution | <optional> | Equihash solution corresponding to the given private key. | |
salt | Uint8Array | | <optional> | module:rise~RiseSolution~SALT | Salt used for local pbkdf2 operations locking/unlocking this identity. |
Members
fingerprint :buffer
160 bit solution hash.
- buffer
mnemonic :string
BIP39 recovery words.
- string
salt :Uint8Array|buffer
Used for local PBKDF2.
- Uint8Array |
buffer
secret :module:rise~RiseSecret
Underlying secret key.
solution :module:rise~RiseSolution
Underlying equihash solution.
(static) K
Equihash K parameter (length).
(static) MAGIC
Rise magic number. Used as message terminator and protocol identitifier.
(static) N
Equihash N parameter (width in bits).
(static) SALT
Rise default salt for pbkdf2 operations.
(static) TEST_K
Lowered length for testing.
(static) TEST_MAGIC
Magic number to segment test network.
(static) TEST_N
Lowered width for testing.
(static) TEST_Z
Lowered difficulty for testing.
(static) Z
Default difficuly setting. Require this many leading zeroes in solution proofs.
Methods
lock(password) → {buffer}
Creates an encrypted blob representation of this identity, suitable for persistance to disk.
Name | Type | Description |
---|---|---|
password | string | User provided passphrase used to encrypt this identity. |
- Type:
- buffer
message(toPublicKey, bodyopt, headopt) → {module:rise~SignedRiseMessage}
Constructs an encrypted and signed module:rise~RiseMessage for the given public key.
Name | Type | Attributes | Description |
---|---|---|---|
toPublicKey | Uint8Array | | Recipient identity for encryption. | |
body | Object.<string, string> | <optional> | Key-value pairs to serialize in the message. |
head | Object.<string, string> | <optional> | Custom headers to include. Headers are NOT ENCRYPTED. Only information that is necessary for routing should be included here. |
solve(nopt, kopt, epochopt) → {Promise.<module:rise~RiseSolution>}
Creates a new RiseSolution for this identity. This method updates the internal state and will overwrite any previous solution performed in this context.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
n | number | <optional> | module:rise~RiseIdentity~N | Width in bits. |
k | number | <optional> | module:rise~RiseIdentity~K | Solution length. |
epoch | buffer | <optional> | module:rise~RiseIdentity~MAGIC | Prepended to public key before hashing. This can be used to segment protocol versions by changing this value which would render solutions generated with a previous or otherwise different value invalid and require a new solution. |
- Type:
- Promise.<module:rise~RiseSolution>
toJSON() → {object}
Returns a plain object representation of this identity, serializable to JSON.
- Type:
- object
(static) generate(zeroesopt, nopt, kopt, epochopt) → {module:rise~RiseIdentity}
"Mines" a new module:rise~RiseIdentity and iteratively generates module:rise~RiseSolutions until one is found that satisfies the stated difficulty.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
zeroes | number | <optional> | module:rise~RiseIdentity~Z | Difficulty level expressed in number of leading zero bits. |
n | number | <optional> | module:rise~RiseIdentity~N | Width in bits. |
k | number | <optional> | module:rise~RiseIdentity~K | Solution length. |
epoch | buffer | <optional> | module:rise~RiseIdentity~MAGIC | Network magic number. |
- Type:
- module:rise~RiseIdentity
(static) unlock(password, data, saltopt) → {modulex:rise~RiseIdentity}
Decrypts the blob given the password and creates a new instance.
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
password | string | User supplied passphrase for decryption. | ||
data | buffer | Binary blob of encrypted identity. | ||
salt | buffer | <optional> | module:rise~RiseIdentity~SALT | Salt for pbkdf2. |
- Type:
- modulex:rise~RiseIdentity