services/message_signer library

Airpass Protocol — Message Signing Service

Provides HMAC-SHA256 signing and verification for message integrity.

How It Works

  1. When a message is created locally, signMessage() produces a hex-encoded HMAC-SHA256 digest of the payload + metadata.
  2. The signature is stored in the Messages.signature column.
  3. When a message arrives via sync, verifySignature() re-computes the HMAC and compares it to the stored signature.

Key Management

The signing key is derived from the local node's UUID. This means:

  • Any node can verify messages it created.
  • Relaying nodes can verify the sender's signature only if they share a group key (future: group-level key exchange).
  • For now, the node UUID serves as a simple shared secret that proves the message wasn't tampered with by the originating node.

In a production deployment, replace this with proper PKI or pre-shared group keys distributed via a trusted bootstrap.

Classes

MessageSigner
Signs and verifies Airpass messages using HMAC-SHA256.