Skip to content

v6.1.0 computeSignature() causes DeprecationWarning #497

Description

@strawberrycz

Issue Description
v6.0.1 is OK, but in v6.1.0 I am getting DeprecationWarning when computeSignature() is called.

Code Snippet

private signXml(xml: string) {
    const sig = new SignedXml({
        privateKey: ERP_PRIV_KEY,
        getKeyInfoContent: () => {
            const certContent = ERP_CERT.toString()
                .match(/-----BEGIN CERTIFICATE-----([\s\S]*?)-----END CERTIFICATE-----/)?.
                ?.replace(/\n/g, '') || '';

            return `<X509Data><X509Certificate>${certContent}</X509Certificate></X509Data>`;
        },
        signatureAlgorithm: 'http://www.w3.org/2001/04/xmldsig-more#rsa-sha256',
        canonicalizationAlgorithm: 'http://www.w3.org/2001/10/xml-exc-c14n#',
    });

    sig.addReference({
        xpath: "//*[local-name()='ZalozeniPredpisuDotaz']",
        transforms: ['http://www.w3.org/2001/10/xml-exc-c14n#'],
        digestAlgorithm: 'http://www.w3.org/2001/04/xmlenc#sha256',
        uri: '',
        isEmptyUri: true,
    });

    sig.computeSignature(xml, {
        location: {
            reference: "//*[local-name()='ZalozeniPredpisuDotaz']",
            action: 'append',
        },
    });

    return sig.getSignedXml();
}

Additional Context

  • Library version: xml-crypto@6.1.0
  • Error messages:
(node:720) DeprecationWarning: getReferences() is deprecated. Use `.getSignedReferences()` instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions