Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/jwt/eddsa/jwk/okp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module JWK
class OKP < ::JWT::JWK::KeyBase
KTY = "OKP"
KTYS = [KTY, JWT::EdDSA::JWK::OKP, Ed25519::SigningKey, Ed25519::VerifyKey].freeze
OKP_PUBLIC_KEY_ELEMENTS = %i[kty n x].freeze
OKP_PUBLIC_KEY_ELEMENTS = %i[crv kty x].freeze
OKP_PRIVATE_KEY_ELEMENTS = %i[d].freeze

def initialize(key, params = nil, options = {})
Expand Down
10 changes: 10 additions & 0 deletions spec/jwt/jwk/okp_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@
end
end

describe "#kid" do
# Test vector from RFC 8037 Appendix A.3 (JWK Thumbprint Canonicalization):
# https://www.rfc-editor.org/rfc/rfc8037#appendix-A.3
let(:key) { { kty: "OKP", crv: "Ed25519", x: "11qYAYKxCrfVS_7TyWQHOg7hcvPapiMlrwIaaPcHURo" } }

it "matches the RFC 7638 JWK thumbprint of the crv/kty/x members" do
expect(instance.kid).to eq("kPrK_qmxVWaYVA9wwBF6Iuo3vVzz7TxHCTwXBygrS4k")
end
end

describe "#export" do
let(:options) { {} }
subject { instance.export(options) }
Expand Down
Loading