question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Authentication with HMAC SHA256 (or MD5) hash

See original GitHub issue

Is your feature request related to a problem? Please describe. I want a shortcut to make some very personal stuff, so it has to be guaranteed secure. The only way I see how to implement it is to use HMAC SHA256 (or MD5) hash based authentication procedure, like most of crypto-exchanges do. The goal is to have a at least one secret key which is never-ever-ever sent but affects any outgoing request. So it will make requests invulnerable to attack MITM.

Describe the solution you’d like Example implementation:

  1. user provides a pair of keys, f.e. { api_key, passphrase }
  2. API-KEY header is set with api_key value
  3. API-EXPIRES header is set on request, f.e. 10 seconds from now in some format. request would be rejected if it will be processed after that time.
  4. API-SIGNATURE header is set with kinda hex(HMAC(passphrase).SHA256(api_key + expires + request.method + request.path + data))

Describe alternatives you’ve considered The alternative solution is to add MD5 and/or SHA256 hashing methods to the scripting engine.

Additional context HMAC on Wikipedia Detailed description of this method

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Waboodoocommented, Apr 7, 2021

In the upcoming version 2.3.0, I’m adding the hmac function, which can be used to compute the HMAC of a given message through scripting, e.g. hmac('sha-256', 'my-key', 'my message')

0reactions
bellerofontecommented, Apr 8, 2021

That is awesome! Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

What Is HMAC And How Does It Secure File Transfers?
HMAC stands for Keyed-Hashing for Message Authentication. ... hash function (like MD5, SHA1, and SHA256) over the data (to be authenticated) ...
Read more >
HMAC
In cryptography, an HMAC is a specific type of message authentication code (MAC) involving a cryptographic hash function and a secret cryptographic key....
Read more >
HMAC (Hash-Based Message Authentication Codes) ...
Hash -based message authentication code (or HMAC) is a cryptographic authentication technique that uses a hash function and a secret key.
Read more >
HMAC explained | keyed hash message authentication code
Keyed- Hash Message Authentication Code ( HMAC ). Vidder, Inc. Vidder, Inc. •.
Read more >
API HMAC Authentication
HMAC (hash-based message authentication code) is used to verify that a request is coming from an expected source and that the request has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found