Fix update webhooks (#4011)

* Fix update webhooks

* Update swagger for webhook update
This commit is contained in:
Andrew Camilleri 2022-08-03 11:35:31 +02:00 committed by GitHub
parent bbce4451aa
commit a753459a6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 1 deletions

View File

@ -309,6 +309,12 @@ namespace BTCPayServer.Services.Stores
.FirstOrDefaultAsync();
if (hook is null)
return;
var currentBlob = hook.GetBlob();
if (string.IsNullOrEmpty(webhookBlob.Secret))
{
webhookBlob.Secret = currentBlob.Secret;
}
hook.SetBlob(webhookBlob);
await ctx.SaveChangesAsync();
}

View File

@ -152,7 +152,7 @@
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/WebhookDataBase"
"$ref": "#/components/schemas/WebhookDataUpdate"
}
}
},
@ -539,6 +539,23 @@
}
]
},
"WebhookDataUpdate": {
"allOf": [
{
"$ref": "#/components/schemas/WebhookDataBase"
},
{
"type": "object",
"properties": {
"secret": {
"type": "string",
"description": "Must be used by the callback receiver to ensure the delivery comes from BTCPay Server. BTCPay Server includes the `BTCPay-Sig` HTTP header, whose format is `sha256=HMAC256(UTF8(webhook's secret), body)`. The pattern to authenticate the webhook is similar to [how to secure webhooks in Github](https://docs.github.com/webhooks/securing/). If left out, null, or empty, the secret will not be changed.",
"nullable": true
}
}
}
]
},
"WebhookDataBase": {
"type": "object",
"additionalProperties": false,