-
-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Typescript JWK Key return type issues #67
Comments
The types can't possibly know the const key = jose.JWK.asKey({ kty: 'EC', x: 'foo', y: 'bar', d: 'foo', crv: 'P-256' })
key.crv Please come forth with a proposal for an improvement, otherwise i'm not seeing one other than - if you know the key type contained by the string, cast the value to e.g. const key = jose.JWK.asKey('EC KEY') as jose.JWK.ECKey
key.crv |
How about creating a mixed key type for the situation when they actual key type cannot be inferred:
And in asKey:
And in CompleteDecrypt
|
Well, i can do one of two things. Your UndefinedKeyType idea doesn't sit well with me. Easiest is to add this to [key: string]: any; or add all of these to crv?: ECCurve | OKPCurve;
d?: string;
dp?: string;
dq?: string;
e?: string;
k?: string;
n?: string;
p?: string;
q?: string;
qi?: string;
x?: string;
y?: string; |
Nice solution in the commit! This can be closed. Thanks! |
This branch will land with the next 13.x node release. Planned for the 18th |
Describe the bug
Currently all return values regarding Keys are typed under the Key interface.
This causes that no Key type specific parameters can be accessed (for example EC Key crv value) in the return values regarding keys.
*To Reproduce
Expected behaviour
Should return proper Key sub type, so parameters can be accessed
Environment:
jose
version: [e.g. v1.22.2]Additional context
The text was updated successfully, but these errors were encountered: