KID Identity Commands
File: commands/identity.rs
Crate: kinetic-cli | Stage: 14
What Is a KID Here?
The CLI creates and manages Kinetic Identity Documents — post-quantum DID credentials using ML-DSA-65. These are separate from the node identity (identity.key) — they are user-facing cryptographic identity documents that link a .kin name to a public key.
identity create
#![allow(unused)]
fn main() {
-> See: `kinetic-cli/src/commands/identity.rs` — Lines 62–~120
}
ml_dsa::SigningKey::<MlDsa65>::generate()— generates a post-quantum ML-DSA-65 keypair.- Derives the DID string:
"did:kin:" + hex(SHA-256(public_key_bytes)). - Constructs a
KineticDidfrom the DID string. - Builds a
KidDocument(the actual DID document with public key embedded). - Saves the signing key bytes to
<output>.key(default:kid.key) with0o600permissions. - Saves the DID document as
<output>.json(default:kid.json).
Note
This command is fully offline — no daemon required.
identity publish
#![allow(unused)]
fn main() {
-> See: `kinetic-cli/src/commands/identity.rs` — Lines ~120–~220
}
- Reads the
kid.jsonfile (the DID document). - Reads the
manifest.jsonfile if it exists (a capability manifest — list of permissions the KID grants). POST /api/kidon the daemon with the KID document and manifest.- The daemon stores it and publishes it to the DHT under the name’s zone record.
Required arg: --name saif.kin — the name the KID belongs to.
identity resolve <did>
#![allow(unused)]
fn main() {
-> See: `kinetic-cli/src/commands/identity.rs` — Lines ~220–~250
}
GET /api/kid/<did> from the daemon. Prints the resolved KidDocument JSON. Falls back to printing an error with the daemon URL if unreachable.
identity revoke
#![allow(unused)]
fn main() {
-> See: `kinetic-cli/src/commands/identity.rs` — Lines ~250–~330
}
- Reads the KID file and the signing key.
- Sets
kid.revoked = trueand updates theupdated_attimestamp. - Signs the updated document with the ML-DSA-65 key.
- Saves the revoked document to
<output>(default:revoked_kid.json). POST /api/kidwith the revoked document — publishes the revocation to the network.
identity rotate-key
#![allow(unused)]
fn main() {
-> See: `kinetic-cli/src/commands/identity.rs` — Lines ~330–~440
}
- Reads the existing KID and the old signing key.
- Generates a new ML-DSA-65 keypair.
- Updates the KID document to embed the new public key.
- Signs with the old key (proving authority to rotate).
- Saves the new private key and the updated KID document.
- Publishes via
POST /api/kid.
Important
Key rotation preserves the DID identifier — the
did:kin:<hash>stays the same since it was derived from the original public key. Only theverificationMethodembedded in the document changes.
Quick Reference
| Command | Offline? | Daemon Endpoint |
|---|---|---|
identity create | Yes | None |
identity publish | No | POST /api/kid |
identity resolve | No | GET /api/kid/<did> |
identity revoke | No | POST /api/kid |
identity rotate-key | No | POST /api/kid |