import VerifyHeader from '@mux/mux-node/src/webhooks/resources/verify_header.js'
VerifyHeader
Static Method Summary
Static Public Methods | ||
public static |
computeSignature(payload: *, secret: *): * |
|
public static |
parseHeader(header: *, scheme: *): * |
|
public static |
|
Static Public Methods
public static computeSignature(payload: *, secret: *): * source
Params:
Name | Type | Attribute | Description |
payload | * | ||
secret | * |
Return:
* |
public static parseHeader(header: *, scheme: *): * source
Params:
Name | Type | Attribute | Description |
header | * | ||
scheme | * |
|
Return:
* |
public static verify(_payload: *, _header: *, secret: *, tolerance: *): boolean source
Params:
Name | Type | Attribute | Description |
_payload | * | ||
_header | * | ||
secret | * | ||
tolerance | * |
|
Test:
- Unit::VerifyHeader VerifyHeader verify
- Unit::VerifyHeader VerifyHeader verify with a malformatted header value
- Unit::VerifyHeader VerifyHeader verify with a header value that has the wrong scheme
- Unit::VerifyHeader VerifyHeader verify with a header value that is valid expect that it is outside the tolerated time range
- Unit::VerifyHeader VerifyHeader verify with a header value that is actually valid
- Unit::VerifyHeader VerifyHeader verify with a malformatted header value will throw an unable to extract timestamp and signatures error
- Unit::VerifyHeader VerifyHeader verify with a header value that has the wrong scheme will throw a no signatures found with expected scheme error
- Unit::VerifyHeader VerifyHeader verify with a header value that is valid expect that it is outside the tolerated time range will throw a timestamp outside the tolerance zone error
- Unit::VerifyHeader VerifyHeader verify with a header value that is actually valid will return true when the payload is a string
- Unit::VerifyHeader VerifyHeader verify with a header value that is actually valid will return true when the payload is a buffer