Skip to content

Commit

Permalink
Package JSON fix (#30)
Browse files Browse the repository at this point in the history
* Change how version string is loaded from package.json
  • Loading branch information
mbish authored Mar 18, 2024
1 parent 544a3c6 commit d08d04d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"node": "^14.17.0 || ^16.13.0 || >=18.0.0"
},
"files": [
"package.json",
"dist"
],
"scripts": {
Expand Down
9 changes: 7 additions & 2 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
//
// SPDX-License-Identifier: MIT

import { version } from '../package.json';
import fs from 'fs';
import path from 'path';

const pkg = JSON.parse(
fs.readFileSync(path.join(__dirname, '../package.json'), { encoding: 'utf-8' })
);

export const CLIENT_ID_LENGTH = 20;
export const CLIENT_SECRET_LENGTH = 40;
Expand All @@ -14,7 +19,7 @@ export const JTI_LENGTH = 36;
export const JWT_EXPIRATION = 300;
export const JWT_LEEWAY = 60;

export const USER_AGENT = `duo_universal_node/${version}`;
export const USER_AGENT = `duo_universal_node/${pkg.version}`;
export const SIG_ALGORITHM = 'HS512';
export const GRANT_TYPE = 'authorization_code';
export const CLIENT_ASSERTION_TYPE = 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer';
Expand Down

0 comments on commit d08d04d

Please sign in to comment.