Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 13:43
    straight-shoota review_requested #11646
  • 13:40
    straight-shoota synchronize #11884
  • 13:39
    straight-shoota synchronize #12057
  • 10:39
    straight-shoota closed #12067
  • 10:36
    straight-shoota closed #11984
  • 10:36
    straight-shoota closed #11947
  • 10:16
    straight-shoota closed #12059
  • 10:10
    straight-shoota unlabeled #12066
  • 10:10
    straight-shoota unlabeled #12066
  • 10:10
    straight-shoota labeled #12066
  • 02:52
    ftarulla edited #12068
  • 02:51
    ftarulla opened #12069
  • 02:11
    ftarulla synchronize #12068
  • 00:03
    Blacksmoke16 labeled #12068
  • 00:03
    Blacksmoke16 labeled #12068
  • May 24 23:25
    ftarulla edited #12068
  • May 24 23:24
    ftarulla opened #12068
  • May 24 12:34
    straight-shoota labeled #12067
  • May 24 12:34
    straight-shoota labeled #12067
  • May 24 12:33
    straight-shoota milestoned #12067
George Dietrich
@Blacksmoke16
No tuples are fixed suze by design
Size
Chris Watson
@watzon
Is there a good thread safe queue yet?
Or am I going to have to implement one quickly?
George Dietrich
@Blacksmoke16
Rabbit?
Chris Watson
@watzon
Rabbit would probably be a good idea actually, but this is a smaller project and I'd rather avoid external deps like that if I can. I really just need a deque that is thread safe.
George Dietrich
@Blacksmoke16
That's fair
There's one in the stdlib, but idk if it's thread safe or not
Chris Watson
@watzon
Yeah iirc it isn't
From IRC (bridge bot)
@FromIRC
<yxhuvud> @watzon: can you use a channel?
Quinton Miller
@HertzDevil
is there a design reason that x.as?(T) isn't equivalent to x if x.is_a?(T)
(the difference is that the former returns a T? and the latter returns a (typeof(x) & T)?)
From IRC (bridge bot)
@FromIRC
<yxhuvud> subclasses?
Quinton Miller
@HertzDevil
why do you think so
From IRC (bridge bot)
@FromIRC
<yxhuvud> no good reason.
From IRC (bridge bot)
@FromIRC
<yxhuvud> looking at the documentation for as, I guess the upcast possibility to union type could be responsible?
From IRC (bridge bot)
@FromIRC
<yxhuvud> ie it allows you to do things like [1.as?(Int32|String)] << "hello" which is not possible using 1 if 1.is_a?(Int32|String) instead
Quinton Miller
@HertzDevil
oh yeah upcasts
what about x.as?(T) versus x.as(T) if x.is_a?(T)
Lance Dillon
@riffraff169
as a not quite rabbit expert, running rabbit in a container is very simple, so not much required to use it...it would be simple to use for your app
Lance Dillon
@riffraff169
could even have a script that starts the rabbit container, runs your app, then when app quits, rabbit quits
George Dietrich
@Blacksmoke16
GC Warning: Finalization cycle involving 0x7f8dc9e7eea0
nice, thats a new one
From IRC (bridge bot)
@FromIRC
<postmodern> what is IO::ARGF ?
From IRC (bridge bot)
@FromIRC
<postmodern> ah ha. hmm now to figure out why it's showing up in my specs when i am clearly calling IO::Memory#gets
George Dietrich
@Blacksmoke16
:thinking:
Jonathan Silverman
@mixflame
my site has gotten even better. now features a shared video player in rooms (+ video/audio calls + collaborative text editor + collaborative painting + html chat)
:D
crystal + amber + websockets + mediaelement.js
From IRC (bridge bot)
@FromIRC
<kevinsjoberg> Do we have some guidelines for the Crystal tooling repositories? I've been contributing to the Crystal TextMate bundle fairly frequently and just noticed I have merge rights (I'm part of Crystal Tooling). I just submitted a PR but not sure who would be suitable for review. Would people be okay with me just merging the fix?
<kevinsjoberg> See crystal-lang-tools/Crystal.tmbundle#22 for details.
George Dietrich
@Blacksmoke16
for simple stuff like this id prob just merge it
From IRC (bridge bot)
@FromIRC
<kevinsjoberg> @Blacksmoke16, alright. Sweet. 🙂
George Dietrich
@Blacksmoke16
it looks good to me fwiw ;P
mrx
@perfecto25
hello, Im on crystal 1.0.0, running basic logger output,
require "logger"

log = Logger.new(STDOUT)
log.level = Logger::WARN

log.debug("Created logger")
log.info("Program started")
log.warn("Nothing to do!")

getting

require "logger"
^
Error: can't find file 'logger'

running on linux mint 20.1
George Dietrich
@Blacksmoke16
It's require log
Logger was the old version
mrx
@perfecto25
thx, was looking at old docs
George Dietrich
@Blacksmoke16
https://crystal-lang.org/api/Log.html is the one you want to use now. One you're using atm is the legacy one
:thumbsup:
Rishav Sharan
@rishavs

I am trying to verify google/AWS jwts using their public keys but not succeeding. Would anyone know how to do so?
For eg.
the google sign ins key is at;

pp! pub_key_jwk = HTTP::Client.get "https://www.googleapis.com/oauth2/v3/certs"
pp! pub_key_pem = HTTP::Client.get "https://www.googleapis.com/oauth2/v1/certs"

and I would want to decode like this;
payload, header = JWT.decode(token, pub_key_pem , JWT::Algorithm::HS256)
But I couldn't find a way to do this using https://github.com/crystal-community/jwt#usage

Ary Borenszweig
@asterite
I was also thinking that x.as?(T) could be rewritten as an if with is_a?... It's simpler for the compiler, no need to have extra logic
jhass
@jhass:m.aeshna.de
[m]
@rishavs: neither endpoint returns the expect PEM encoded key directly, the first returns a list of JWKs, the second returns a list of PEM encoded keys (certificates actually). the jwt's shard key argument expects the PEM encoded key directly, so you need to some parsing and extraction first. Second I don't know how you arrived at HS256 as algorithm, it's RSA keys so you'll want RS256, RS384 or RS512 respectively, whichever one the JWT actually uses. Admittedly the shard could be more helpful here and extract the right algorithm from the JWT header
Rishav Sharan
@rishavs

@jhass:m.aeshna.de , I did try to extract the keys and then use it in JWT decode, but that didn't work;


            # Fetch the Google public key
            pp! pub_key_jwk = HTTP::Client.get "https://www.googleapis.com/oauth2/v3/certs"
            pp! pub_key_pem = HTTP::Client.get "https://www.googleapis.com/oauth2/v1/certs"
            # pub_key.status_code      # => 200

            pp! parsed = JSON.parse(pub_key_jwk.body)
            pp! key1 = parsed["keys"][0]["kid"].to_s
            pp! key2 = parsed["keys"][1]["kid"].to_s

            payload1, header1 = JWT.decode(id_token, key1, JWT::Algorithm::RS256)
            pp! payload1
            pp! header1

would throw;

2021-07-05T09:51:34.441087Z  ERROR - Neither PUB or PRIV key: error:0D06B08E:asn1 encoding routines:asn1_d2i_read_bio:not enough data
Neither PUB or PRIV key: error:0D06B08E:asn1 encoding routines:asn1_d2i_read_bio:not enough data (OpenSSL::PKey::RsaError)
From IRC (bridge bot)
@FromIRC
<jhass[m]> Well yes, a JWK's kid field is not a PEM encoded public key. https://datatracker.ietf.org/doc/html/rfc7517#section-4.5
Rishav Sharan
@rishavs

Is this bit of string

"-----BEGIN CERTIFICATE-----\nMIIDJjCCAg6gAwIBAgIIRAoQks63w4EwDQYJKoZIhvcNAQEFBQAwNjE0MDIGA1UE\nAxMrZmVkZXJhdGVkLXNpZ25vbi5zeXN0ZW0uZ3NlcnZpY2VhY2NvdW50LmNvbTAe\nFw0yMTA2MjAwNDI5NTdaFw0yMTA3MDYxNjQ0NTdaMDYxNDAyBgNVBAMTK2ZlZGVy\nYXRlZC1zaWdub24uc3lzdGVtLmdzZXJ2aWNlYWNjb3VudC5jb20wggEiMA0GCSqG\nSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsf17gul45G1GRC6jm8ov5yws+cmbJZT+o\neI6pbJdWyg/KZQoiY2w+Vps5y+RhiU9+VYT6qa1AIf4AIOPHMKHIiS2v7nN4IRmJ\n2WfylYSYOr5H5peL+xCAlSv7sf9jr2EPxxHQrcvILzpBFumKDFbwXqFRT1qP/1Va\n5XCwy8uJCdtvNLgJa+L9bMhb2IbSA62GyyV99r/quqhCkdzQZ+wS7d73vVBlwnIz\nGvqm1j9u9PAhirBG/2m3G0pMyqi9XpgE3mf8uEIOaTWAEuZJ6PqZ8dJbaKjpNdlp\nXc9rIvZRO17qqu8CQX9FdS1V64PGbixxR7VF1/5N2wBcWbUo82rjAgMBAAGjODA2\nMAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsG\nAQUFBwMCMA0GCSqGSIb3DQEBBQUAA4IBAQCGOTPITDKeIsTJhueXYtp9t3u0L8Id\nO58xb5dDbNGbi9E/C0cdDq8SfdFBHvOL8eJJSjzCRefRi1NhMlWaWsT471GgXdUV\nHR0CSV87Gj6BvMcAq9WFQu9k6LFtN2qp8CsFFEbjgPW3GFSXriy0W/VRzmb4aUbz\nVjo+EOTAiQP05qQ0bahaXWxXyftctMqpmM/EjFKZZwSH2fuFRNiq+0prIG8xRUYp\nakyr4D+GC0RrUpCa2SfGoojSYQPlQfkZGyeGLBi1UQImCKBJ8wYVaSIaVlLHYZik\nu/lQUGTPW3NLCn0id4AKAx3Ojf0t2jhsPy9u7kW5mPQA/CeRWjsPZ2uX\n-----END CERTIFICATE-----\n"

what I need in my JWT.decode(id_token, key_pem, JWT::Algorithm::RS256)?