Coder Social home page Coder Social logo

Comments (5)

MicahParks avatar MicahParks commented on June 1, 2024 2

I've fixed the identified bug in v0.5.5. Please let me know if I identified the bug you were expecting @joshkaplinsky and if the fix is to your expectations.

Thank you again for reporting this issue 🎉

from jwkset.

joshkaplinsky avatar joshkaplinsky commented on June 1, 2024 1

Thanks for the fast turnaround! Yes, this addresses my issue. Much appreciated!

from jwkset.

MicahParks avatar MicahParks commented on June 1, 2024

This is due to the updated JWK Set package being used. Are you able to provide the JWK Set you are working with? Ensure there is no private key material in it before passing it along.

from jwkset.

MicahParks avatar MicahParks commented on June 1, 2024

Thank you for making this issue.

I think this feature branch commit will likely solve the problem. I'll make a test, then confirm that it matches your original problem. Could get a release out tonight.

from jwkset.

MicahParks avatar MicahParks commented on June 1, 2024

I think this program would reproduce the error experienced. The upcoming changes should fix that.

package main

import (
	"encoding/json"
	"log/slog"
	"os"

	"github.com/MicahParks/jwkset"
)

const (
	logErr = "error"
)

func main() {
	l := slog.Default()
	const rawJWKSet = `{"keys":[{"kty":"OKP","alg":"EdDSA","kid":"my-key-id","x5c":["MIIB8TCCAaOgAwIBAgIUa/7hf5yVjhXwYLaT38DE5+y06PkwBQYDK2VwMG4xCzAJBgNVBAYTAlVTMREwDwYDVQQIDAhWaXJnaW5pYTERMA8GA1UEBwwIUmljaG1vbmQxFDASBgNVBAoMC01pY2FoIFBhcmtzMQ0wCwYDVQQLDARTZWxmMRQwEgYDVQQDDAtleGFtcGxlLmNvbTAeFw0yNDAxMDQwMDE2MDVaFw0yNDAyMDMwMDE2MDVaMG4xCzAJBgNVBAYTAlVTMREwDwYDVQQIDAhWaXJnaW5pYTERMA8GA1UEBwwIUmljaG1vbmQxFDASBgNVBAoMC01pY2FoIFBhcmtzMQ0wCwYDVQQLDARTZWxmMRQwEgYDVQQDDAtleGFtcGxlLmNvbTAqMAUGAytlcAMhAKD0un1323TTlTlFUs5VWb+JvlToR5hMAWPfqLi4Wybpo1MwUTAdBgNVHQ4EFgQUOcvkrHIL2s+C+jq+y2V04rn1D3swHwYDVR0jBBgwFoAUOcvkrHIL2s+C+jq+y2V04rn1D3swDwYDVR0TAQH/BAUwAwEB/zAFBgMrZXADQQAHgsrxSTTK/K4hOeEldhsXooONdLR49kM/TtBqJEScxskFo51MEBRzydjwkiI7isPRgyy838Mvv9VS+nij1EAI"],"x5t":"RTwmBuuqX7XB6UlVXVck9scuJSM","x5t#S256":"bRkXmcs_Kvo6nQrYE7ZWpvDtyoI5Hj_82ASr4eauTV8","crv":"Ed25519","x":"oPS6fXfbdNOVOUVSzlVZv4m-VOhHmEwBY9-ouLhbJuk"}]}`

	var marshal jwkset.JWKSMarshal
	err := json.Unmarshal([]byte(rawJWKSet), &marshal)
	if err != nil {
		l.Error("Failed to unmarshal JWK set.",
			logErr, err,
		)
		os.Exit(1)
	}

	marshal.Keys[0].X5TS256 = ""

	jwk, err := jwkset.NewJWKFromMarshal(marshal.Keys[0], jwkset.JWKMarshalOptions{}, jwkset.JWKValidateOptions{})
	if err != nil {
		l.Error("Failed to create JWK.",
			logErr, err,
		)
		os.Exit(1)
	}

	println(jwk.Marshal().KID)
}

from jwkset.

Related Issues (11)

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.