Telegram需要订阅推送通知的基本64url编码的身份验证秘密是什么?

发布于 2025-01-31 20:40:08 字数 902 浏览 4 评论 0原文

根据 telegram docs ,要订阅Web推送通知,您需要通过如下:

一个带有以下键的JSON编码对象:

  • endpoint:按下服务器公开的绝对URL应用程序服务器可以在其中发送推送消息
  • :P-256椭圆形曲线以下对象中的difie-hellman参数
    • p256dh:base64url编码的P-256椭圆曲线diffie-hellman公共密钥
    • auth:base64url-编码身份验证秘密

是最后的密钥,auth> auth指的是?

这个问题是相关的,但并没有真正回答我的问题。


ed Idit:< /strong> 这是一些示例代码生成keys per wizou's per wizou's per wizou's per wizou's per wizou's per wizou's per。

According to the Telegram docs, to subscribe to web push notifications, you need to pass the following:

A JSON-encoded object with the following keys:

  • endpoint: Absolute URL exposed by the push service where the application server can send push messages
  • keys: P-256 elliptic curve Diffie-Hellman parameters in the following object
    • p256dh: Base64url-encoded P-256 elliptic curve Diffie-Hellman public key
    • auth: Base64url-encoded authentication secret

What is the last key, auth is referring to?

This question is related but doesn't really answer my question.


EDIT: Here is some sample code to generate the keys per Wizou's solution.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

煮茶煮酒煮时光 2025-02-07 20:40:08

如文档中所述,有效载荷也可以使用 p-256椭圆曲线diffie-hellman 使用Web推动时。

根据链接的RFC,此加密需要一个公钥和身份验证秘密。

在第3.2节中,RFC指定您应该通过提供16个八位钟的难以确定的序列来生成此秘密,该序列用于认证推送消息。这应该由密码强的随机数生成器[RFC4086]生成。

As mentioned in the doc, payloads can also be encrypted using P-256 Elliptic Curve Diffie-Hellman when using web push.

As per the linked RFC, this encryption requires a public key, and an authentication secret.

In Section 3.2, the RFC specifies that you should generate this secret by providing a hard-to-guess sequence of 16 octets that is used for authentication of push messages. This SHOULD be generated by a cryptographically strong random number generator [RFC4086].

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文