Files
motr-enclave/internal/crypto/AGENTS.md
Prad Nukala 299a10b0a8 docs(crypto): add guidelines for crypto agents
docs(keybase): document keybase guidelines
chore: add search summary
feat: add package lock file
2026-01-10 18:20:33 -05:00

1.7 KiB

Crypto Agent Guidelines

OVERVIEW

Low-level primitives for 2-of-2 MPC (secp256k1), UCAN v1.0.0-rc.1 capabilities, and BIP-44 address derivation.

STRUCTURE

internal/crypto/
├── bip44/      # SLIP-0044 multi-chain address derivation (Sonr, ETH, BTC)
├── mpc/        # 2-of-2 threshold ECDSA (secp256k1) signing logic
└── ucan/       # UCAN v1.0.0-rc.1 builders using DAG-CBOR envelopes

WHERE TO LOOK

Task File Primary Types/Funcs
MPC Lifecycle mpc/simple.go SimpleEnclave, NewSimpleEnclave(), Sign()
MPC Verification mpc/verify.go VerifyWithPubKey(), Verify()
MPC Serialization mpc/codec.go Marshal(), Unmarshal()
UCAN Delegation ucan/delegation.go NewBuilder(), BuildDelegation()
UCAN Invocation ucan/invocation.go Invocation, BuildInvocation()
UCAN Policies ucan/policy.go Evaluate(), Statement
Address Derivation bip44/bip44.go DeriveAddress(pubkey, coinType)

CONVENTIONS

  • MPC Security: Restricted to secp256k1. Implements 2-of-2 additive secret sharing. Never log raw shares.
  • UCAN Encoding: Strictly follows v1.0.0-rc.1 spec using DAG-CBOR (no JWT/JSON strings).
  • BIP44 Support: Handles Sonr (118/60), Ethereum (60), and Bitcoin (0). Default is Sonr (60).
  • No Side Effects: Crypto packages must not perform I/O or networking.
  • Error Prefixing: Every error must be prefixed: crypto/<pkg>: <reason>.
  • Statelessness: Favor pure functions or immutable builders over stateful managers.
  • WASM Safety: Avoid non-deterministic functions or external syscalls not provided by PDK.