Telegram需要订阅推送通知的基本64url编码的身份验证秘密是什么?
根据 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 messageskeys
: P-256 elliptic curve Diffie-Hellman parameters in the following objectp256dh
: Base64url-encoded P-256 elliptic curve Diffie-Hellman public keyauth
: 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如文档中所述,有效载荷也可以使用 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].