/go-twilio-compute

A simple command line utility to compute X-Twilio-Signatures

Primary LanguageGo

Twilio Signature Calculator ๐Ÿ› ๏ธ

Golang

Build Build Build Go Report Card

Overview ๐ŸŒ

This command-line tool is designed to compute the signature for Twilio API requests. It helps ensure the integrity and authenticity of the requests coming from Twilio by using HMAC-SHA1 hashing algorithm.

Features โœจ

  • Compute the HMAC-SHA1 hash for Twilio API requests.
  • Easy to use command-line interface.
  • Supports different URL structures and parameter combinations.

Installation ๐Ÿ“ฅ

To use this tool, you need to have Go installed on your system. Follow these steps to set it up:

go install github.com/kmesiab/go-twilio-compute@latest

or

  1. Clone the repository:

    git clone https://github.com/kmesiab/go-twilio-compute.git
  2. Navigate to the project directory:

    cd go-twilio-compute
  3. Build the project:

    go build

Usage ๐Ÿš€

Run the tool with the required flags:

./go-twilio-compute

--url <url Twilio will call> 
--key <your Twilio API key>
--params <URL encoded body of the message>

Example:

./go-twilio-compute --url "https://example.com/api" --key "mysecretkey"
--params "Body=sample%20message%3F&From=%2B12533"

Command-Line Switches ๐ŸŽš๏ธ

  • --url: The URL Twilio will call.
  • --key: Your Twilio API key used to hash the message.
  • --params: The URL-encoded body of the message.

Example Outputs ๐Ÿ“

./go-twilio-compute --url http://foo.com --key MyFakeKey --params foo=bar

Computed Signature: w6A4pOIG/hOAQsWqwnZRblmo7vo=

Running Tests ๐Ÿงช

To run the unit tests:

go test

Contributing ๐Ÿค

Contributions are welcome! Feel free to submit pull requests or open issues to improve the tool or add new features.

License ๐Ÿ“œ

This project is licensed under the MIT License - see the LICENSE file for details.

What This Is Not ๐Ÿšซ

This is not a replacement for Twilio validation. This tool enables you to generate valid signatures for testing your Twilio applications.

Twilio Documentation ๐Ÿ”—

Validating Signatures from Twilio