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

Parsing License --> errno: -4058 or License file corrupted #10

Open
luquezsantiago86 opened this issue Feb 16, 2021 · 1 comment
Open

Comments

@luquezsantiago86
Copy link

Hi, I am new in this. I followed the this steps:

  1. Generate an RSA 2048 bit private key
  2. Extract the public key from an RSA keypair
  3. Generating license file

But when I try to parse the file I get this error.

  1. If I copy the license text into the JS file, I get : errno: -4058
  2. If I use the license file in the licenseFilePath, I get: License file corrupted

This is my code for parsing the license:

const licenseFile = require('nodejs-license-file');
const template = [
'====BEGIN LICENSE====',
'{{&licenseVersion}}',
'{{&applicationVersion}}',
'{{&firstName}}',
'{{&lastName}}',
'{{&email}}',
'{{&expirationDate}}',
'{{&serial}}',
'=====END LICENSE====='
].join('\n');
const licence = ====BEGIN LICENSE==== 1 1.0.0 First Try [email protected] 20/02/2021 DMx0WOLc3oKiNpnGYzQUk5BDJaT4jBeABzTkpp0AoldXGXhUih8X+HILBbDV4MVtWDUMnOPR52xF5XnLpiLzzIVnv7jkvEk1AXXUKRjPH1bdOybPKmjJKan25hrbKZmYrWcFqS+U3X5fi2FL/1lwKjJ7TwexlG1Chj2rVBBsWbCjJYmYRWUsytPk/QP96w4/dbe0itPYgUHp2so70sRnUFPlasMl9UzR1BQF5QLbNABXL3Hy3sdoQEMXIdit35s1vxrWeVQ5AYujaVqwqI5a4BxyHFgBcKeXlrPu2sAsXxhsRC9tr/lbdc3so7CVTexcOnDJrBx5N3zQh3nqSZcQ6w== =====END LICENSE=====;

try {

const data = licenseFile.parse({
    publicKeyPath: 'C:/Users/Usuario/Desktop/Santiago/Apps/RT/public_key.pem',
    licenseFilePath: licence,
    template
});

console.log(data);

} catch (err) {

console.log(err);

}

Is there any documentation how to use this module? it looks really good, but I cant figure it out how to use it.

@dguber-axle
Copy link

dguber-axle commented Feb 15, 2023

You can try changing licenseFilePath: licence, to licenseFile: licence,.
I think that should work by looking at lines 116 and 120 of lib/index.js file.

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

No branches or pull requests

2 participants