Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
@octokit/webhooks-methods
Advanced tools
Methods to handle GitHub Webhook requests
Browsers |
🚧 Load
|
---|---|
Node |
Install with
|
await sign("mysecret", eventPayloadString);
// resolves with a string like "sha256=4864d2759938a15468b5df9ade20bf161da9b4f737ea61794142f3484236bda3"
await sign({ secret: "mysecret", algorithm: "sha1" }, eventPayloadString);
// resolves with a string like "sha1=d03207e4b030cf234e3447bac4d93add4c6643d8"
await verify("mysecret", eventPayloadString, "sha256=486d27...");
// resolves with true or false
await verifyWithFallback("mysecret", eventPayloadString, "sha256=486d27...", ["oldsecret", ...]);
// resolves with true or false
sign()
await sign(secret, eventPayloadString);
await sign({ secret, algorithm }, eventPayloadString);
secret
(String)
| Required. Secret as configured in GitHub Settings. |
algorithm
(String)
|
Algorithm to calculate signature. Can be set to Learn more at Validating payloads from GitHub |
eventPayloadString
(String)
|
Required.
Webhook request payload as received from GitHub. If you have only access to an already parsed object, stringify it with JSON.stringify(payload)
|
Resolves with a signature
string. Throws an error if an argument is missing.
verify()
await verify(secret, eventPayloadString, signature);
secret
(String)
| Required. Secret as configured in GitHub Settings. |
eventPayloadString
(String)
|
Required.
Webhook request payload as received from GitHub. If you have only access to an already parsed object, stringify it with JSON.stringify(payload)
|
signature
(String)
|
Required.
Signature string as calculated by sign() .
|
Resolves with true
or false
. Throws error if an argument is missing.
verifyWithFallback()
await verifyWithFallback(
secret,
eventPayloadString,
signature,
additionalSecrets,
);
secret
(String)
| Required. Secret as configured in GitHub Settings. |
eventPayloadString
(String)
|
Required.
Webhook request payload as received from GitHub. If you have only access to an already parsed object, stringify it with JSON.stringify(payload)
|
signature
(String)
|
Required.
Signature string as calculated by sign() .
|
additionalSecrets
(Array of String)
| If given, each additional secret will be tried in turn. |
This is a thin wrapper around verify()
that is intended to ease callers' support for key rotation.
Resolves with true
or false
. Throws error if a required argument is missing.
See CONTRIBUTING.md
FAQs
Methods to handle GitHub Webhook requests
The npm package @octokit/webhooks-methods receives a total of 741,053 weekly downloads. As such, @octokit/webhooks-methods popularity was classified as popular.
We found that @octokit/webhooks-methods demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.