Skip to content
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

[ENHANCEMENT]: missing static for some fields #483

Open
sibelius opened this issue Jan 29, 2025 · 3 comments
Open

[ENHANCEMENT]: missing static for some fields #483

sibelius opened this issue Jan 29, 2025 · 3 comments

Comments

@sibelius
Copy link

Is your feature request related to a problem? Please describe...

in the .d.ts it is marked as static

static CanonicalizationAlgorithms: { [uri: string]: new() => TransformationAlgorithm };
static HashAlgorithms: { [uri: string]: new() => HashAlgorithm };
static SignatureAlgorithms: { [uri: string]: new() => SignatureAlgorithm };

but I can't access them without creating a SignedXml instance

example

SignedXml.CanonicalizationAlgorithms: breaks

but

const signedXml = new SignedXml();
signedXml.CanonicalizationAlgorithms works

Describe teh solution you'd like...

add missing static property

Describe the alternatives you've considered...

creating an instance

@srd90
Copy link

srd90 commented Jan 30, 2025

in the .d.ts it is marked as static

static CanonicalizationAlgorithms: { [uri: string]: new() => TransformationAlgorithm };
static HashAlgorithms: { [uri: string]: new() => HashAlgorithm };
static SignatureAlgorithms: { [uri: string]: new() => SignatureAlgorithm };

Which .d.ts file you are referring because e.g. lib/signed-xml.d.ts from 6.0.0 ( https://www.npmjs.com/package/xml-crypto/v/6.0.0?activeTab=code ) doesn't have such declarations.

Update: After scratching head for a while...maybe you are using types from DefinitelyTyped:
https://github.com/DefinitelyTyped/DefinitelyTyped/blob/7a60f900be610b2a31ce5ba37bb89c75027f6fbc/types/xml-crypto/index.d.ts#L30-L33
(link points to latest version of DefinitelyTyped repo at the time of writing).
Note: types were updated at DT about 2 years ago. There has been lot of changes since then to xml-crypto's SignedXml.

If you want to keep using types from DefinitelyTyped for xml-crypto consider a PR to DefinitelyTyped repo to update its xml-crypto types to match xml-crypto's current implementation or migrate to xml-crypto's own types.

@sibelius
Copy link
Author

should we move to static in code ?

does not make sense to instance SignedXml to get the algorithms

@srd90
Copy link

srd90 commented Jan 30, 2025

If you are looking something like this

i.e. to be able to use those algorithms easily in your own code I would suggest you to help maintainer(s) to finish pending stuff for next release version.

AFAIK maintainer(s) are needing help to finish #464 (based on content at #328 (comment))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants