开发者正在构建一种名为“lnchat”的去中心化即时通讯协议,该协议采用类似SMTP的联邦化模式,允许服务器之间直接通信而无需中央协调器 1。在身份识别方面,用户ID格式必须包含域名部分(如 nickname@domain),以便其他服务器能够定位负责该身份的域 1。为了实现服务发现,各服务器需在 /.well-known/lnchat.json 路径下提供元数据,其中包括协议版本、用于解析用户和发送消息的端点URL以及公钥信息 1。
该协议的核心安全机制依赖于混合公钥加密(HPKE)技术,由客户端生成对称密钥来加密消息,并使用接收者的公钥封装该对称密钥 1。私钥严格保留在客户端,禁止以明文形式发送至服务器,同时系统引入 key_id 以处理密钥轮换并检测可能泄露的密钥 1。此外,发送方服务器需使用独立的 Ed25519 私钥对规范化的请求字符串进行数字签名,接收方则通过下载对方 .well-known 文件中的公钥来验证发送方服务器的身份 1。
为了防范重放攻击,签名内容中包含了时间戳(LNChat-Timestamp)和唯一请求ID(LNChat-Request-Id) 1。文章还强调了获取远程服务器元数据时的安全防护措施,要求使用 HTTPS 协议并禁止重定向到私有网络地址,以防止服务器端请求伪造(SSRF)攻击 1。
A new technical guide details the construction of "lnchat," a decentralized instant messaging protocol designed with a federation model similar to SMTP. 1 In this architecture, servers communicate directly with one another without requiring a central coordinator. 1 User identity within the system is strictly tied to domain names, utilizing a format such as nickname@domain to allow other servers to locate the specific domain responsible for that user's identity. 1
To facilitate service discovery, each participating server must expose metadata at the standard path /.well-known/lnchat.json. 1 This file contains essential information including the protocol version, public key data, and endpoint URLs for operations like resolving users and sending messages. 1 For message security, the protocol employs Hybrid Public Key Encryption (HPKE), where clients generate symmetric keys to encrypt content and use the recipient's public key to encapsulate those symmetric keys. 1 Crucially, private keys remain exclusively on the client side and are never transmitted in plaintext to servers; the system incorporates key_id tracking to manage key rotation and identify compromised keys. 1
Server authentication relies on Ed25519 digital signatures, where the sending server signs a normalized request string using its private key. 1 The receiving server validates these signatures by retrieving the sender’s public key from their .well-known directory. 1 To prevent replay attacks, the signed payload includes both a timestamp (LNChat-Timestamp) and a unique request identifier (LNChat-Request-Id). 1 The implementation also emphasizes defensive security measures during remote metadata retrieval, specifically warning against Server-Side Request Forgery (SSRF) vulnerabilities by mandating HTTPS connections and blocking redirects to private network addresses. 1
评论
还没有评论,欢迎留下第一条。