Signer class¶
Signer owns key material and can sign messages, transactions, and blocks.
Production applications must load keys from secure storage or use a wallet
extension; never put a real private key in source code.
export async function signLocalMessage() {
const signer = new Signer({ privateKey: new Uint8Array(32).fill(1) });
const signature = await signer.signMessage("Koinos documentation example");
return { address: signer.getAddress(), signature };
}
View complete file · Run example
The example signs a local message with an explicitly disposable deterministic key. It never sends the key or a transaction.