Stripe——这些不同的键是什么?
Stripe - what are all these different keys?
这些键是什么以及如何使用它们?
Dashboard
:
publishable_key
secret_key
restricted_key
webhook_signing_secret
前 3 个在 Dashboard
中可见。
这些密钥都用在什么地方?
我通过反复试验发现的:(我不知道这在生产中会是什么样子)
在 CLI 为 运行 时解码事件:
Webhook.constructEvent(rawRequestBody, signature, WEBHOOK_SIGNING_SECRET)
全局设置API键
Stripe.apiKey = SECRET_KEY
我的问题是:
- 因为prod中没有
Stripe CLI
运行,所以webhook_signing_secret
和secret_key
一样吗? (事件不通过 CLI
转发)
- 为什么
Stripe CLI
不能创建带有签名密钥编码的事件?它已经配置了 publishable_key
和 secret_key
,为什么还需要一个新的?
restricted_key
用在什么地方?
- 可发布密钥 被客户端代码(例如 Stripe.js 用于命中 public API,主要用于标记卡信息.这可以防止您暴露于原始卡信息并招致重大 PCI compliance burden.
- 秘密密钥 是您使用服务器端对 Stripe API 进行 API 调用的 API 密钥。秘密 API 密钥必须保持安全并且应该像您帐户的密码一样对待,因为它们可以执行许多关键功能,例如创建付款、发放退款等。
- 受限密钥类似于秘密密钥,但它们减少了您在 Stripe 控制面板中定义的权限。
- Webhook 签名秘密 是 used by your webhook endpoint code to verify the events sent to that code are actually from Stripe and not someone else pretending to be Stripe。
您可以在 Stripe's documentation on API keys.
中阅读有关可发布、秘密和受限 API 密钥的更多信息
since there is no Stripe CLI
running in prod, is the webhook_signing_secret
the same as the secret_key
? (event is not forwarded through the CLI
)
不,它们完全不同,用途不同。
why can't the Stripe CLI
create an event with the signing secret encoded? it has already the publishable_key
and secret_keys
configured, why does it need a new one?
在事件中包含 webhook 签名秘密会破坏目的,阻止安全措施发挥作用,并且不能代表生产中的工作方式。
这些键是什么以及如何使用它们?
Dashboard
:
publishable_key
secret_key
restricted_key
webhook_signing_secret
前 3 个在 Dashboard
中可见。
这些密钥都用在什么地方?
我通过反复试验发现的:(我不知道这在生产中会是什么样子)
在 CLI 为 运行 时解码事件:
Webhook.constructEvent(rawRequestBody, signature, WEBHOOK_SIGNING_SECRET)
全局设置API键
Stripe.apiKey = SECRET_KEY
我的问题是:
- 因为prod中没有
Stripe CLI
运行,所以webhook_signing_secret
和secret_key
一样吗? (事件不通过CLI
转发) - 为什么
Stripe CLI
不能创建带有签名密钥编码的事件?它已经配置了publishable_key
和secret_key
,为什么还需要一个新的? restricted_key
用在什么地方?
- 可发布密钥 被客户端代码(例如 Stripe.js 用于命中 public API,主要用于标记卡信息.这可以防止您暴露于原始卡信息并招致重大 PCI compliance burden.
- 秘密密钥 是您使用服务器端对 Stripe API 进行 API 调用的 API 密钥。秘密 API 密钥必须保持安全并且应该像您帐户的密码一样对待,因为它们可以执行许多关键功能,例如创建付款、发放退款等。
- 受限密钥类似于秘密密钥,但它们减少了您在 Stripe 控制面板中定义的权限。
- Webhook 签名秘密 是 used by your webhook endpoint code to verify the events sent to that code are actually from Stripe and not someone else pretending to be Stripe。
您可以在 Stripe's documentation on API keys.
中阅读有关可发布、秘密和受限 API 密钥的更多信息since there is no
Stripe CLI
running in prod, is thewebhook_signing_secret
the same as thesecret_key
? (event is not forwarded through theCLI
)
不,它们完全不同,用途不同。
why can't the
Stripe CLI
create an event with the signing secret encoded? it has already thepublishable_key
andsecret_keys
configured, why does it need a new one?
在事件中包含 webhook 签名秘密会破坏目的,阻止安全措施发挥作用,并且不能代表生产中的工作方式。