0.7.2 • Published 5 months ago

@yourrentals/util-signature v0.7.2

Weekly downloads
-
License
-
Repository
-
Last release
5 months ago

@yourrentals/util-signature

A library that defines the base classes for signing and verifying webhook signatures.

The webhook signature is expected in this format:

t=${unixTimestampInMilliseconds}|v=1,alg=${hmac|rsa},sig=${signature}

Installation

yarn add @yourrentals/util-signature

Usage

import {WebhookSignatureVerifier, WebhookSignatureV1HmacPlugin} from '@yourrentals/util-signature';

const verifier = new WebhookSignatureVerifier([new WebhookSignatureV1HmacPlugin('secret')], 'x-signature');

const isValid = verifier.verifySignatureHeader(headers, rawBody)

Included algorithms

Included in this package are the following algorithms:

  • WebhookSignatureV1HmacPlugin: Sign and Verify using RSA public/private key pair, using the RS256 algorithm.
  • WebhookSignatureV1RsaVerifierPlugin and WebhookSignatureV1RsaSignerPlugin: Sign and Verify using a shared secret, using the HS256 algorithm.

Version 1 Signature

Version 1 signature payload is constructed as: ${unixTimestampInMilliseconds}.${rawBody}

0.7.2

5 months ago

0.7.1

5 months ago

0.6.1

7 months ago

0.6.0

7 months ago

0.5.2

7 months ago

0.5.1

7 months ago

0.5.0

7 months ago

0.4.3

7 months ago

0.4.2

7 months ago

0.4.1

7 months ago