identity init
command | identity.init |
| Kind | Local write |
| Needs | MCLI_DIR or a home directory. No MOSTRO_PUBKEY, RELAYS, stdin or --yes |
| Publishes | Nothing; contacts no relay or node |
| Local write | Creates the data directory and mcli.db with a fresh mnemonic; never changes an existing store |
| Statuses | ok, error |
| Schemas | schemas/identity.init.input.json, schemas/identity.init.output.json |
Creates the local identity store that every signing command needs. It is the only JSON
command that creates an identity: the others fail with identity_missing when there is
none.
Invocation
mostro-cli --output json identity init
It does what the first run of a legacy command does (the two share one implementation), without needing the node’s configuration or a connection.
Input
None. Any option of its own is invalid_arguments (exit 2). Root options such as
--mostro-pubkey or --relays are accepted and ignored.
Behavior
- Uses
MCLI_DIR, else.mcliin the home directory. Creates that directory owner-only (0700on Unix, one level deep); an existing directory is tightened to owner-only. - If
mcli.dbor one of its SQLite companion files (mcli.db-journal,mcli.db-wal,mcli.db-shm) already exists, it changes nothing and fails withidentity_exists. It never deletes or repairs a store: move the old files away first. - Creates
mcli.dbowner-only (0600on Unix) with the same tables as the legacy first run and one user row holding a fresh 12-word mnemonic and no trade index. - If the file was created but could not be completed, it is removed again
(
persistence: failed).
Two runs at the same time create one store; the other reports identity_exists.
The mnemonic and every private key stay in mcli.db. No mode, stream or error shows
them, and there is no option to reveal them. Back the file up yourself.
Success data: IdentityInitData
| Field | Type | Meaning |
|---|---|---|
identity_pubkey | hex64 | The identity public key of the new store (index 0 of the new mnemonic) |
Outcomes
| Case | status | code | Stages (publication / daemon / persistence) |
|---|---|---|---|
| Store created | ok | not_applicable / not_applicable / applied | |
mcli.db or a companion file exists | error | identity_exists | not_applicable / not_applicable / not_attempted |
| No data directory can be determined, or the directory or file cannot be created | error | store_unwritable | not_applicable / not_applicable / not_attempted |
| The file was created but not completed (removed again) | error | store_unwritable | not_applicable / not_applicable / failed |
| An option was given | error | invalid_arguments (exit 2) | not_applicable ×3 |
Errors
invalid_arguments, identity_exists, store_unwritable, internal_error. Nothing
was published in any case. After identity_exists, use identity show
to read the existing identity.
Warnings
None. The schema’s shared WarningCode list names invalid_event_timestamp and
cleanup_incomplete, but this command emits no warning.
Examples
A new store with a fresh mnemonic
identity.init/created · status ok · exit 0 · fixture
mostro-cli --output json identity init
{
"schema_version": "1",
"command": "identity.init",
"status": "ok",
"data": {
"identity_pubkey": "79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"
},
"error": null,
"warnings": [],
"meta": {
"publication": "not_applicable",
"daemon_acceptance": "not_applicable",
"persistence": "applied",
"snapshot": null
}
}
The data directory cannot be created: nothing written
identity.init/directory_not_created · status error · store_unwritable · exit 1 · fixture
mostro-cli --output json identity init
{
"schema_version": "1",
"command": "identity.init",
"status": "error",
"data": null,
"error": {
"code": "store_unwritable",
"message": "The local store cannot be written, so nothing was sent."
},
"warnings": [],
"meta": {
"publication": "not_applicable",
"daemon_acceptance": "not_applicable",
"persistence": "not_attempted",
"snapshot": null
}
}
A store (or a companion file) is already there: nothing changed
identity.init/identity_exists · status error · identity_exists · exit 1 · fixture
mostro-cli --output json identity init
{
"schema_version": "1",
"command": "identity.init",
"status": "error",
"data": null,
"error": {
"code": "identity_exists",
"message": "A local identity already exists, so nothing was changed."
},
"warnings": [],
"meta": {
"publication": "not_applicable",
"daemon_acceptance": "not_applicable",
"persistence": "not_attempted",
"snapshot": null
}
}
The file was created but not completed, and removed again
identity.init/store_not_completed · status error · store_unwritable · exit 1 · fixture
mostro-cli --output json identity init
{
"schema_version": "1",
"command": "identity.init",
"status": "error",
"data": null,
"error": {
"code": "store_unwritable",
"message": "The local store cannot be written, so nothing was sent."
},
"warnings": [],
"meta": {
"publication": "not_applicable",
"daemon_acceptance": "not_applicable",
"persistence": "failed",
"snapshot": null
}
}
identity init takes no options
identity.init/invalid_arguments · status error · invalid_arguments · exit 2 · fixture
mostro-cli --output json identity init --bogus
{
"schema_version": "1",
"command": "identity.init",
"status": "error",
"data": null,
"error": {
"code": "invalid_arguments",
"message": "The command arguments are invalid."
},
"warnings": [],
"meta": {
"publication": "not_applicable",
"daemon_acceptance": "not_applicable",
"persistence": "not_applicable",
"snapshot": null
}
}
Next
identity show reads the key back; then order list and a first order new or take.