Skip to content

config: support all sui key formats for operator key#808

Merged
bmwill merged 5 commits into
mainfrom
operator-key
Jul 14, 2026
Merged

config: support all sui key formats for operator key#808
bmwill merged 5 commits into
mainfrom
operator-key

Conversation

@bmwill

@bmwill bmwill commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@bmwill
bmwill requested review from Bridgerz and dlukegordon July 13, 2026 19:56
@github-actions

github-actions Bot commented Jul 13, 2026

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-07-14 14:50 UTC

@jessiemongeon1

jessiemongeon1 commented Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Style Guide Audit

Audited 1 file(s) against the Sui Documentation Style Guide.

3 violation(s) found. All must be fixed before merge.

design/docs/node-operator-runbook.mdx (3 violation(s))

3 violation(s) (2 regex, 1 claude)

  • Line 209 — Use "basic" not "simple"
    • Current: simple
    • Fix: basic
  • Line 209 — Use "might" not "may"
    • Current: may
    • Fix: might
  • Line 209 — word-preference
    • Current: The value may be a file path
    • Fix: The value might be a file path

Automated audit using the Sui Documentation Style Guide.

@dlukegordon dlukegordon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We also need to update crates/hashi/src/backup.rs:329-357.

The key loader now accepts inline suiprivkey and Base64 values, but backup discovery still recognizes only inline PEM. It treats either new inline format as a path, rejects it as missing, and interpolates the complete value into the error at line 356. Automatic backups log that error at crates/hashi/src/backup.rs:109, exposing the private key.

bmwill added 5 commits July 14, 2026 09:32
Pick up sui-crypto suiprivkey (Bech32) decoding (MystenLabs/sui-rust-sdk#254)
and the sui-sdk-types 0.3.1 parsing-hardening fixes. The bech32 feature is
needed to accept operator keys in the format produced by sui keytool.
Operators fed hashi server keys straight from sui keytool and hit
"unable to load Ed25519 private key from ." — the loader only accepted
PKCS#8 PEM/DER, and its error both leaked whatever inline value was
configured (potentially the private key itself) and named no accepted
format.

Key loading now lives in a new hashi::keys module built on
sui_crypto::simple::SimpleKeypair, so all three simple Sui schemes
(Ed25519, secp256k1, and secp256r1) are accepted in every format the
tooling produces, as a file path or an inline config value:

- PKCS#8 PEM and DER (openssl genpkey)
- Bech32 suiprivkey strings (sui keytool generate/export)
- legacy Base64 keystore entries (sui.keystore, sui keytool convert)

Load errors now name the accepted formats and how to generate a key,
call out an empty configured value explicitly, and never echo anything
that could plausibly be key material. Loading was verified against
real sui keytool 1.69.1 output for each scheme and encoding.

The Base64 decoding and address derivation carry local TODOs pointing
at the pending sui-crypto additions (SimpleKeypair::from_base64 and
SimpleVerifiyingKey::derive_address); both shims disappear on the next
dependency bump once those land upstream.

Also resolve the long-standing "TODO support more than just Ed25519"
on Config::operator_private_key.
Section 2.4 of the node operator runbook now lists every accepted
operator-private-key format (PKCS#8 PEM/DER, Bech32 suiprivkey, and
Base64 keystore), which tool produces each, and how to generate a key
with either sui keytool or openssl. Also note that raw hex keys are
not accepted since they carry no scheme flag, and update the config
templates that claimed only PEM/DER files were supported.
MystenLabs/sui-rust-sdk#281 landed SimpleKeypair::from_base64 (and
friends) plus SimpleVerifiyingKey::derive_address, so the two local
shims in hashi::keys — the hand-rolled Base64 keystore decoder and the
address derivation that matched on MultisigMemberPublicKey — are
deleted in favor of the upstream API. Call sites now derive addresses
via keypair.verifying_key().derive_address().

Also replace the e2e sui_network keypair_from_base64 helper, which was
the same Base64 keystore decoding hand-rolled a second time, with
Ed25519PrivateKey::from_base64.
Backup discovery still recognized only inline PEM: an inline
suiprivkey or Base64 keystore operator key was treated as a file path,
rejected as missing, and interpolated verbatim into the error — which
the automatic backup task writes to the log, exposing the private key.

Classification now lives in hashi::keys::referenced_key_file, next to
the loader whose semantics it mirrors (PEM, suiprivkey, or Base64
keystore values are inline; existing files are returned as paths;
anything else is an error). Its errors redact anything that could
plausibly be key material, so a malformed inline key fails the backup
without the value reaching the log. Add tests covering inline
suiprivkey/Base64 backup runs and the no-echo guarantee.
@bmwill
bmwill requested a review from dlukegordon July 14, 2026 14:32
@bmwill
bmwill enabled auto-merge (rebase) July 14, 2026 14:44
@bmwill
bmwill merged commit 827e128 into main Jul 14, 2026
16 checks passed
@bmwill
bmwill deleted the operator-key branch July 14, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants