set_nostr_identity
Configure a Nostr identity for the Lightning Wallet MCP agent by securely storing the private key and deriving the public key for decentralized communication.
Instructions
Set a Nostr identity for the agent. Stores the private key and derives the public key. REQUIRES AGENT KEY.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| private_key | Yes | 64-character hex Nostr private key |
Implementation Reference
- src/lightning-faucet.ts:1280-1295 (handler)Implementation of the setNostrIdentity method in the LightningFaucetClient class.
async setNostrIdentity(privateKey: string): Promise<{ publicKey: string; npub: string; rawResponse: ApiResponse; }> { const result = await this.request<ApiResponse & { public_key?: string; npub?: string; }>('set_nostr_identity', { private_key: privateKey }); return { publicKey: result.public_key || '', npub: result.npub || '', rawResponse: result, }; } - src/index.ts:233-236 (schema)Zod validation schema for the set_nostr_identity tool input.
const SetNostrIdentitySchema = z.object({ private_key: z.string().length(64).describe('64-character hex Nostr private key (nsec decoded to hex)'), }); - src/index.ts:691-700 (registration)Tool definition and registration for 'set_nostr_identity' in the MCP server.
name: 'set_nostr_identity', description: 'Set a Nostr identity for the agent. Stores the private key and derives the public key. REQUIRES AGENT KEY.', inputSchema: { type: 'object', properties: { private_key: { type: 'string', description: '64-character hex Nostr private key' }, }, required: ['private_key'], }, }, - src/index.ts:1514-1530 (handler)Handler logic for the 'set_nostr_identity' tool within the MCP server's request handler.
case 'set_nostr_identity': { const parsed = SetNostrIdentitySchema.parse(args); const result = await session.requireClient().setNostrIdentity(parsed.private_key); return { content: [ { type: 'text', text: JSON.stringify({ success: true, message: 'Nostr identity set', public_key: result.publicKey, npub: result.npub, }, null, 2), }, ], }; }