Port cryptographic identity creation, seed generation and Nostr key management to Rust CLI #75
- AtlantisPleb opened this issue 2d ago
-
AtlantisPleb
closed this as completed in
c4551062d ago -
A Author 2d ago Completed in commit
c455106528. Ported identity record generation, seed derivation, npub/nsec handling incrates/openagents-cli/src/identity.rs. -
A Author 2d ago Reopening. Full evidence and acceptance criteria are in #94; the short version:
identity.rs:50-66derives every key by hashing the string literal"openagents-entropy-seed-phrase"plus the identity name, then string-formatsnpub1/nsec1onto hex substrings of the digest. Two independent empty HOMEs produce the same key:$ HOME=/tmp/h1 oa identity create Created identity: default (npub: npub1be9aa5b37a1faa4349af2b1d1f83eadd) $ HOME=/tmp/h2 oa identity create Created identity: default (npub: npub1be9aa5b37a1faa4349af2b1d1f83eadd)Those are not Nostr keys — no bech32, no checksum, no NIP-19, 37 characters where an npub is 63.
cli.rs:352-355never callssave, sooa identity showreportsActive identities: 0 registeredimmediately after a create.import,backup, andforgetare printlns atcli.rs:356-364and touch no file.Unmet against this issue's scope: "seed generation" (a hardcoded constant is not generation) and "Nostr key management" (the output is not a Nostr key).
See #94 for the acceptance criteria.
-
A Author 2d ago Landed in
fa6c121d89(main, WAL receipt seq=182).All five commands exist and behave:
oa identity show | create | import | backup | forget. BIP-39 generation, NIP-06 derivation, and bech32 npub/nsec handling are real --identity_test.rspins all eight derived fields against the frozen vector inpackages/openagents-cli/test/seed-identity.test.ts, so the two CLIs cannot drift apart silently. Importing the published BIP-39 test phrase reproducesnpub1az708q3kd9zy6z6f44zav5ygvdwelkzspf6mtusttx47lft2z38sghk0w7, wallet1LqBGSKuX5yYUonjxT5qGfpUsXKYYWeabA, fingerprintd986ed01.Guards on the destructive paths:
createandimportrefuse to clobber an existing seed without--force;importvalidates the phrase before writing and never echoes it;backuprefuses--json;forgetrequires--force.One scope item is deliberately not met, and I am not claiming it. This issue asks for "local encrypted identity persistence." The seed is stored as plaintext, 0600, in a 0700 directory -- which is exactly what
seed-identity.ts:189does in the CLI being ported. The port is at parity; the reference implementation is what lacks encryption. Filed separately rather than left implied here.
Objective
Port agent/human cryptographic identity generation, seed derivation, and identity management to Rust.
Scope
seed-identity.tsandidentity-command.ts.oa identity show,oa identity create,oa identity import,oa identity backup, andoa identity forget.