cvm-nostr-transport.ts — concrete ContextVM transport for NAP-CVM.
Implements CvmTransport over Nostr, exactly as validated against live
ContextVM servers (e.g. Relatr):
MCP JSON-RPC messages ride in kind-25910 event content.
Requests are CEP-4 gift-wrapped: the inner kind-25910 event is signed with
the shell's ephemeral client key, NIP-44-encrypted to the server, and
placed in a kind-21059 (ephemeral) / 1059 (regular) wrap signed by a fresh
random key, p-tagged to the server. Responses arrive the same way,
p-tagged to the client, and are correlated by the inner JSON-RPC id.
CEP-22 oversized transfers and CEP-41 open streams ride
notifications/progress frames addressed by the request progressToken.
Outbound requests are not split into CEP-22 frames; encrypted arguments
must fit one NIP-44 plaintext message.
Shipped on a separate entry (@kehto/services/cvm-nostr-transport) so the
nostr-tools dependency stays out of the core @kehto/services bundle.
The client key is ephemeral and shell-owned: napplets never see keys, relay
sockets, or NIP-44 material (NAP-CVM §Security).
cvm-nostr-transport.ts — concrete ContextVM transport for NAP-CVM.
Implements CvmTransport over Nostr, exactly as validated against live ContextVM servers (e.g. Relatr):
content.p-tagged to the server. Responses arrive the same way,p-tagged to the client, and are correlated by the inner JSON-RPCid.notifications/progressframes addressed by the request progressToken. Outbound requests are not split into CEP-22 frames; encrypted arguments must fit one NIP-44 plaintext message.Shipped on a separate entry (
@kehto/services/cvm-nostr-transport) so thenostr-toolsdependency stays out of the core@kehto/servicesbundle.The client key is ephemeral and shell-owned: napplets never see keys, relay sockets, or NIP-44 material (NAP-CVM §Security).
Example