diff --git a/package.json b/package.json index bc3a06c..ee16856 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" }, "files": [ + "package.json", "dist" ], "scripts": { diff --git a/src/constants.ts b/src/constants.ts index 0c24aca..73d191c 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -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; @@ -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';