Code Monkey home page Code Monkey logo

Comments (4)

fforootd avatar fforootd commented on May 29, 2024 1

Ahhhh, i missed that one 😁

For reference, for others https://discord.com/channels/927474939156643850/1031827610902204458

from oidc.

braginini avatar braginini commented on May 29, 2024

The solution was as described here:
#140 (comment)

Quick and dirty:

func (s *Storage) GetKeySet(ctx context.Context) (*jose.JSONWebKeySet, error) {
	cert, err := testCert(s.signingKey.Key)
	if err != nil {
		return nil, err
	}
	sha := sha256.New()
	sha.Write(cert.Raw)
	s1 := sha.Sum(nil)
	sha11 := sha1.New()
	sha11.Write(cert.Raw)
	s2 := sha11.Sum(nil)
	// as mentioned above, this example only has a single signing key without key rotation,
	// so it will directly use its public key
	//
	// when using key rotation you typically would store the public keys alongside the private keys in your database
	// and give both of them an expiration date, with the public key having a longer lifetime (e.g. rotate private key every
	return &jose.JSONWebKeySet{
		Keys: []jose.JSONWebKey{
			{
				Certificates:                []*x509.Certificate{cert},
				CertificateThumbprintSHA1:   s2,
				CertificateThumbprintSHA256: s1,
				KeyID:                       s.signingKey.ID,
				Algorithm:                   s.signingKey.Algorithm,
				Use:                         oidc.KeyUseSignature,
				Key:                         &s.signingKey.Key.PublicKey,
			},
		},
	}, nil
}

from oidc.

fforootd avatar fforootd commented on May 29, 2024

Hey @braginini sorry for not responding in time 😢 we where quiet in a rush to get some stuff done.

from oidc.

braginini avatar braginini commented on May 29, 2024

Hey @braginini sorry for not responding in time cry we where quiet in a rush to get some stuff done.

You did great, I used Discord and your folks helped there.

from oidc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.