import { PolkadotSigner } from 'polkadot-api'; /** * Product-account derivation, byte-matching the Polkadot Host. * * A host derives one account per product from the user's root key so a product * never sees a key that controls anything but its own subtree. Deploying with * `--product-name` makes the DEPLOYER that same account: the DotNS name ends up * owned by the account the product will later sign with inside a host, so * in-product writes (publishing, record edits) pass the registry's ownership * checks without a transfer step. * * The algorithm mirrors host-rust-core * `rust/crates/truapi-server/src/host_logic/product_account.rs` (RFC-0022): * path `//product//{productId}/{index32}` — two hard string junctions and one * soft junction whose 32-byte chain code is the little-endian u32 index * followed by a 28-byte magic. Junction chain codes SCALE-encode the string * (all-digit strings as u64), zero-padded to 32 bytes, blake2b-256-hashed only * when longer. * * The host also normalizes the product name (trim, NFC, lowercase) before * deriving. Its current TLD allowlist (`dot`, `paseo`, localhost) is NOT * enforced here: previewnet is mid-migration to a `.test` TLD and this CLI * must be able to deploy for products the allowlist will accept next; syntax * beyond normalization is the host's call, not the deployer's. */ /** A junction's 32-byte chain code: padded SCALE encoding, hashed when longer. */ declare function productChainCode(code: string): Uint8Array; /** The soft-junction chain code of a derivation index: LE u32 ++ INDEX_MAGIC. */ declare function productIndexBytes(index: number): Uint8Array; /** Host-side normalization of a product name: trim, NFC, lowercase. */ declare function normalizeProductName(raw: string): string; interface ProductSigner { signer: PolkadotSigner; ss58: string; publicKey: Uint8Array; productName: string; } /** * The product account a host derives for `productName` under this mnemonic. * * Index 0 is a product's default account, the one `getProductAccount` hands a * product that asks with `DerivationIndex::Index(0)`. */ declare function deriveProductSigner(mnemonic: string, productName: string, index?: number): ProductSigner; export { type ProductSigner, deriveProductSigner, normalizeProductName, productChainCode, productIndexBytes };