Upgrade to Pro — share decks privately, control downloads, hide ads and more …

My first Rust crate: jwtinfo

My first Rust crate: jwtinfo

In this short talk, I will illustrate my first Rust crate jwtinfo (https://crates.io/crates/jwtinfo) which allows to easily debug a JSON Web Token. I will also explain what I learned while building this project and some of the pain points I had to face.

F3a6662b3cd161c3c2f13604965ed0f2?s=128

Luciano Mammino

April 06, 2021
Tweet

Transcript

  1. My first Rust crate: jwtinfo Luciano Mammino - @loige 06-04-2021

    loige.link/rust-jwt
  2. Let me introduce myself...

  3. Let me introduce myself... I'm Luciano ( 🍕🍝) 👋

  4. Let me introduce myself... I'm Luciano ( 🍕🍝) 👋 Senior

    Architect @ fourTheorem (Dublin )
  5. Let me introduce myself... I'm Luciano ( 🍕🍝) 👋 Senior

    Architect @ fourTheorem (Dublin ) nodejsdp.link Co-Author of Node.js Design Patterns 👉
  6. Let me introduce myself... I'm Luciano ( 🍕🍝) 👋 Senior

    Architect @ fourTheorem (Dublin ) nodejsdp.link Co-Author of Node.js Design Patterns 👉 Connect with me: (blog) (twitter) (github) loige.co @loige lmammino
  7. We are business focused technologists that deliver. | | Accelerated

    Serverless AI as a Service Platform Modernisation @loige Do you want to ? work with us
  8. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpX VCJ9.eyJoZWxsbyI6IlJ1c3QgRHVib GluIn0.EhyqhHxv1EPe2JAMzCIHZ0 blyZRN3nsoVHuhwF8DdM0 @loige Meet a Json Web Token

    (JWT) loige.co/whats-in-a-jwt
  9. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpX VCJ9.eyJoZWxsbyI6IlJ1c3QgRHVib GluIn0.EhyqhHxv1EPe2JAMzCIHZ0 blyZRN3nsoVHuhwF8DdM0 @loige

  10. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpX VCJ9.eyJoZWxsbyI6IlJ1c3QgRHVib GluIn0.EhyqhHxv1EPe2JAMzCIHZ0 blyZRN3nsoVHuhwF8DdM0 @loige

  11. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpX VCJ9.eyJoZWxsbyI6IlJ1c3QgRHVib GluIn0.EhyqhHxv1EPe2JAMzCIHZ0 blyZRN3nsoVHuhwF8DdM0 @loige Header: { "alg": "HS256", "typ":

    "JWT" } + JSON Base64Url
  12. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpX VCJ9.eyJoZWxsbyI6IlJ1c3QgRHVib GluIn0.EhyqhHxv1EPe2JAMzCIHZ0 blyZRN3nsoVHuhwF8DdM0 @loige Payload: { "hello": "Rust Dublin"

    } + JSON Base64Url
  13. eyJhbGciOiJIUzI1NiIsInR5cCI6IkpX VCJ9.eyJoZWxsbyI6IlJ1c3QgRHVib GluIn0.EhyqhHxv1EPe2JAMzCIHZ0 blyZRN3nsoVHuhwF8DdM0 @loige Signature: just some bytes™

  14. This lovely stuff is used to "transfer claims" which means

    "for security" ... which means "I want to look into these every time I see one!" @loige
  15. Meet jwtinfo cargo install jwtinfo @loige

  16. DEMO /me prays the demo gods 🙏 @loige eyJraWQiOiIxZTlnZGs3IiwiYWxnIjoiUlMyNTYifQ.ewogImlzcyI6ICJodHRwOi8vc2VydmVyLmV4YW1wbGUuY29tIiwKICJzd WIiOiAiMjQ4Mjg5NzYxMDAxIiwKICJhdWQiOiAiczZCaGRSa3F0MyIsCiAibm9uY2UiOiAibi0wUzZfV3pBMk1qIiwKICJleHAiO

    iAxMzExMjgxOTcwLAogImlhdCI6IDEzMTEyODA5NzAsCiAibmFtZSI6ICJKYW5lIERvZSIsCiAiZ2l2ZW5fbmFtZSI6ICJKYW5lI iwKICJmYW1pbHlfbmFtZSI6ICJEb2UiLAogImdlbmRlciI6ICJmZW1hbGUiLAogImJpcnRoZGF0ZSI6ICIwMDAwLTEwLTMxIiwKI CJlbWFpbCI6ICJqYW5lZG9lQGV4YW1wbGUuY29tIiwKICJwaWN0dXJlIjogImh0dHA6Ly9leGFtcGxlLmNvbS9qYW5lZG9lL21lL mpwZyIKfQ.rHQjEmBqn9Jre0OLykYNnspA10Qql2rvx4FsD00jwlB0Sym4NzpgvPKsDjn_wMkHxcp6CilPcoKrWHcipR2iAjzLvD NAReF97zoJqq880ZD1bwY82JDauCXELVR9O6_B0w3K-E7yM2macAAgNCUwtik6SjoSUZRcf- O5lygIyLENx882p6MtmwaL1hd6qn5RZOQ0TLrOYu0532g9Exxcm- ChymrB4xLykpDj3lUivJt63eEGGN6DH5K6o33TcxkIjNrCD4XB1CKKumZvCedgHHF3IAK4dVEDSUoGlH9z4pP_eWYNXvqQOjGs- rDaQzUHl6cQQWNiDpWOl_lxXjQEvQ
  17. Source code github.com/lmammino/jwtinfo @loige Give it a ⭐ , will

    ya?
  18. I got a review from 🤩 Tim McNamara loige.link/jwtinfo-review @loige

    So many things to fix here...
  19. ... and I learned a lot of cool stuff. For

    instance, if you want to accept "anything string-like" @loige ... yeah, I just wanted to put some actual Rust code in this talk!
  20. ... or convert a string to anything else! @loige ...

    yeah, some more Rust code in this talk!
  21. THANK YOU! 😋 @loige Special thanks to for starting the

    Rust learning journey and building jwtinfo with me! @StefanoAbalsamo loige.link/rust-jwt Cover Picture by on Silas Köhler Unsplash