gpt4 book ai didi

stripe-payments - Stripe webhook API 中 "v0"签名方案的用途是什么?

转载 作者:行者123 更新时间:2023-12-05 07:36:53 25 4
gpt4 key购买 nike

signature verification 上的 Stripe 文档说:

Currently, the only valid signature scheme is v1. To aid with testing, Stripe sends an additional signature with a fake v0 scheme, for test-mode events.

Stripe-Signature: t=1492774577,
v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd,
v0=6ffbb59b2300aae63f272406069a9788598b792a944a07aba816edb039989a39

v0 签名以什么方式帮助测试?我可以用它做什么?

v0 签名是如何生成的?它只是一个随机字符串,还是一些可以验证的 HMAC 摘要,类似于 v1 方案?

最佳答案

如果您正在构建自己的客户端来验证 Stripe 的 webhook 事件签名,则 v0 方案会很有用。它旨在测试您的客户端是否忽略了 Stripe-Signature header 中的未知方案(或者,也许在将来的某个时候,已弃用的方案)。

v0 摘要不使用为您的端点生成的签名 secret ; Stripe 尚未发布用于创建它的 secret ,因此您无法验证它。

Stripe 自己的 client libraries包括一个关于忽略无效方案的测试用例。例如,在 Ruby 库中:

should "raise a SignatureVerificationError when there are no signatures with the expected scheme" do
header = generate_header(scheme: "v0")
e = assert_raises(Stripe::SignatureVerificationError) do
Stripe::Webhook::Signature.verify_header(EVENT_PAYLOAD, header, "secret")
end
assert_match("No signatures found with expected scheme", e.message)
end

关于stripe-payments - Stripe webhook API 中 "v0"签名方案的用途是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48892851/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com