diff --git a/.eslintrc.json b/.eslintrc.json index 7dc4755..db3c450 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -34,8 +34,17 @@ "prettier/prettier": "error", "no-console": "error", "valid-typeof": "error", - "eqeqeq": ["error", "always", {"null": "ignore"}], - "strict": ["error", "global"], + "eqeqeq": [ + "error", + "always", + { + "null": "ignore" + } + ], + "strict": [ + "error", + "global" + ], "no-restricted-syntax": [ "error", { @@ -66,6 +75,19 @@ "no-console": "off", "no-restricted-syntax": "off" } + }, + { + "files": [ + "**/*.ts" + ], + "extends": [ + "plugin:@typescript-eslint/eslint-recommended", + "plugin:@typescript-eslint/recommended" + ], + "plugins": [ + "prettier", + "@typescript-eslint" + ] } ] -} +} \ No newline at end of file diff --git a/README.md b/README.md index 6dc0cd5..4092473 100644 --- a/README.md +++ b/README.md @@ -123,6 +123,35 @@ NOTE: The test suite requires an active kerberos deployment.
+## Constants + +
+
GSS_C_DELEG_FLAG
+
+
GSS_C_MUTUAL_FLAG
+
+
GSS_C_REPLAY_FLAG
+
+
GSS_C_SEQUENCE_FLAG
+
+
GSS_C_CONF_FLAG
+
+
GSS_C_INTEG_FLAG
+
+
GSS_C_ANON_FLAG
+
+
GSS_C_PROT_READY_FLAG
+
+
GSS_C_TRANS_FLAG
+
+
GSS_C_NO_OID
+
+
GSS_MECH_OID_KRB5
+
+
GSS_MECH_OID_SPNEGO
+
+
+ ## Functions
@@ -230,6 +259,42 @@ Perform the client side kerberos unwrap step Processes a single kerberos server-side step using the supplied client data. + + +## GSS_C_DELEG_FLAG + + +## GSS_C_MUTUAL_FLAG + + +## GSS_C_REPLAY_FLAG + + +## GSS_C_SEQUENCE_FLAG + + +## GSS_C_CONF_FLAG + + +## GSS_C_INTEG_FLAG + + +## GSS_C_ANON_FLAG + + +## GSS_C_PROT_READY_FLAG + + +## GSS_C_TRANS_FLAG + + +## GSS_C_NO_OID + + +## GSS_MECH_OID_KRB5 + + +## GSS_MECH_OID_SPNEGO ## checkPassword(username, password, service, [defaultRealm]) @@ -283,6 +348,8 @@ Details are looked up via the `/etc/keytab` file. | [options.principal] | string | Optional string containing the client principal in the form 'user@realm' (e.g. 'jdoe@example.com'). | | [options.flags] | number | Optional integer used to set GSS flags. (e.g. `GSS_C_DELEG_FLAG\|GSS_C_MUTUAL_FLAG\|GSS_C_SEQUENCE_FLAG` will allow for forwarding credentials to the remote host) | | [options.mechOID] | number | Optional GSS mech OID. Defaults to None (GSS_C_NO_OID). Other possible values are `GSS_MECH_OID_KRB5`, `GSS_MECH_OID_SPNEGO`. | +| [options.user] | string | The username with which to authenticate. Only used on Windows. | +| [options.pass] | string | The password with which to authenticate. Only used on Windows. | Initializes a context for client-side authentication with the given service principal. diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..c125219 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,185 @@ +export const GSS_C_DELEG_FLAG: number; +export const GSS_C_MUTUAL_FLAG: number; +export const GSS_C_REPLAY_FLAG: number; +export const GSS_C_SEQUENCE_FLAG: number; +export const GSS_C_CONF_FLAG: number; +export const GSS_C_INTEG_FLAG: number; +export const GSS_C_ANON_FLAG: number; +export const GSS_C_PROT_READY_FLAG: number; +export const GSS_C_TRANS_FLAG: number; + +export const GSS_C_NO_OID: number; +export const GSS_MECH_OID_KRB5: number; +export const GSS_MECH_OID_SPNEGO: number; + +/** + * Optional settings for *KerberosClient.wrap* method. + */ +export interface WrapOptions { + /** + * The user to authorize. + */ + user?: string; + + /** + * Indicates if the wrap should request message confidentiality. + */ + protect?: boolean; +} + +/** + * Options for `initializeClient()`. + */ +export interface InitializeClientOptions { + /** + * Optional string containing the client principal in the form 'user@realm' (e.g. 'jdoe@example.com'). + */ + principal?: string; + /** + * Optional integer used to set GSS flags. (e.g. `GSS_C_DELEG_FLAG|GSS_C_MUTUAL_FLAG|GSS_C_SEQUENCE_FLAG` will allow for forwarding credentials to the remote host). + */ + gssFlag?: number; + /** + * Optional GSS mech OID. Defaults to None (GSS_C_NO_OID). Other possible values are `GSS_MECH_OID_KRB5`, `GSS_MECH_OID_SPNEGO`. + */ + mechOID?: number; + + /** + * The username with which to authenticate. Only used on Windows. + */ + user?: string; + + /** + * The password with which to authenticate. Only used on Windows. + */ + pass?: string; +} + +export class KerberosClient { + /** + * The username used for authentication. + */ + username: string; + /** + * The last response received during authentication steps. + */ + response: string; + /** + * Indicates whether confidentiality was applied or not (GSSAPI only). + */ + responseConf: string; + /** + * Indicates that authentication has successfully completed or not. + */ + contextComplete: boolean; + + /** + * Processes a single kerberos client-side step using the supplied server challenge. + * + * @param challenge A string containing the base64-encoded server data (which may be empty for the first step) + */ + step(challenge: string): Promise; + + /** + * Perform the client side kerberos wrap step. + * + * @param challenge The response returned after calling `unwrap` + * @param options Optional settings + */ + wrap(challenge: string, options?: WrapOptions): Promise; + + /** + * Perform the client side kerberos unwrap step + * + * @param challenge A string containing the base64-encoded server data + */ + unwrap(challenge: string): Promise; +} + +export class KerberosServer { + /** + * The username used for authentication + */ + username: string; + /** + * @description The last response received during authentication steps + */ + response: string; + /** + * @description The target used for authentication + */ + targetName: string; + /** + * @description Indicates that authentication has successfully completed or not + */ + contextComplete: boolean; + + /** + * Processes a single kerberos server-side step using the supplied client data. + * + * @param challenge A string containing the base64-encoded client data + */ + step(challenge: string): Promise; +} + +/** + * This function provides a simple way to verify that a user name and password + * match those normally used for Kerberos authentication. + * It does this by checking that the supplied user name and password can be + * used to get a ticket for the supplied service. + * If the user name does not contain a realm, then the default realm supplied + * is used. + * + * For this to work properly the Kerberos must be configured properly on this + * machine. + * That will likely mean ensuring that the edu.mit.Kerberos preference file + * has the correct realms and KDCs listed. + * + * IMPORTANT: This method is vulnerable to KDC spoofing attacks and it should + * only be used for testing. Do not use this in any production system - your + * security could be compromised if you do. + * + * @param username The Kerberos user name. If no realm is supplied, then the `defaultRealm` will be used. + * @param password The password for the user. + * @param service The Kerberos service to check access for. + * @param defaultRealm The default realm to use if one is not supplied in the user argument. + */ +export function checkPassword( + name: string, + password: string, + service: string, + defaultRealm?: string +): Promise; + +/** + * This function returns the service principal for the server given a service type and hostname. + * + * Details are looked up via the `/etc/keytab` file. + * + * @param service The Kerberos service type for the server. + * @param hostname The hostname of the server. + */ +export function principalDetails(service: string, hostname: string): Promise; + +/** + * Initializes a context for client-side authentication with the given service principal. + * + * @param service A string containing the service principal in the form '`type@fqdn`'. + * @param [options] Optional settings + */ +export function initializeClient( + service: string, + options?: InitializeClientOptions +): Promise; + +/** + * Initializes a context for server-side authentication with the given service principal. + * + * @param service A string containing the service principal in the form 'type@fqdn' (e.g. 'imap@mail.apple.com'). + */ +export function initializeServer(service: string): Promise; + +/** + * The version of the Kerberos package. + */ +export const version: string; diff --git a/lib/kerberos.js b/lib/kerberos.js index c69105a..316f013 100644 --- a/lib/kerberos.js +++ b/lib/kerberos.js @@ -8,19 +8,31 @@ const KerberosClient = kerberos.KerberosClient; const KerberosServer = kerberos.KerberosServer; // GSS Flags +/** @kind constant */ const GSS_C_DELEG_FLAG = 1; +/** @kind constant */ const GSS_C_MUTUAL_FLAG = 2; +/** @kind constant */ const GSS_C_REPLAY_FLAG = 4; +/** @kind constant */ const GSS_C_SEQUENCE_FLAG = 8; +/** @kind constant */ const GSS_C_CONF_FLAG = 16; +/** @kind constant */ const GSS_C_INTEG_FLAG = 32; +/** @kind constant */ const GSS_C_ANON_FLAG = 64; +/** @kind constant */ const GSS_C_PROT_READY_FLAG = 128; +/** @kind constant */ const GSS_C_TRANS_FLAG = 256; // GSS_OID +/** @kind constant */ const GSS_C_NO_OID = 0; +/** @kind constant */ const GSS_MECH_OID_KRB5 = 9; +/** @kind constant */ const GSS_MECH_OID_SPNEGO = 6; /** @@ -182,6 +194,8 @@ const promisifiedInitializeClient = promisify(kerberos.initializeClient); * @param {string} [options.principal] Optional string containing the client principal in the form 'user@realm' (e.g. 'jdoe@example.com'). * @param {number} [options.flags] Optional integer used to set GSS flags. (e.g. `GSS_C_DELEG_FLAG\|GSS_C_MUTUAL_FLAG\|GSS_C_SEQUENCE_FLAG` will allow for forwarding credentials to the remote host) * @param {number} [options.mechOID] Optional GSS mech OID. Defaults to None (GSS_C_NO_OID). Other possible values are `GSS_MECH_OID_KRB5`, `GSS_MECH_OID_SPNEGO`. + * @param {string} [options.user] The username with which to authenticate. Only used on Windows. + * @param {string} [options.pass] The password with which to authenticate. Only used on Windows. * @return {Promise} returns Promise */ async function initializeClient(service, options = { mechOID: GSS_C_NO_OID }) { diff --git a/package-lock.json b/package-lock.json index 69337e7..45a4a27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,6 +15,7 @@ }, "devDependencies": { "@types/node": "^24.2.1", + "@typescript-eslint/eslint-plugin": "^8.31.1", "chai": "^4.4.1", "chai-string": "^1.6.0", "chalk": "^4.1.2", @@ -93,16 +94,20 @@ } }, "node_modules/@eslint-community/eslint-utils": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", - "integrity": "sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==", + "version": "4.9.0", + "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.9.0.tgz", + "integrity": "sha512-ayVFHdtZ+hsq1t2Dy24wCmGXGe4q9Gu3smhLYALJrr473ZH27MsnSL+LKUlimp4BWJqMDMLmPpx/Q9R3OAlL4g==", "dev": true, + "license": "MIT", "dependencies": { - "eslint-visitor-keys": "^3.3.0" + "eslint-visitor-keys": "^3.4.3" }, "engines": { "node": "^12.22.0 || ^14.17.0 || >=16.0.0" }, + "funding": { + "url": "https://opencollective.com/eslint" + }, "peerDependencies": { "eslint": "^6.0.0 || ^7.0.0 || >=8.0.0" } @@ -531,6 +536,291 @@ "undici-types": "~7.10.0" } }, + "node_modules/@typescript-eslint/eslint-plugin": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-8.44.0.tgz", + "integrity": "sha512-EGDAOGX+uwwekcS0iyxVDmRV9HX6FLSM5kzrAToLTsr9OWCIKG/y3lQheCq18yZ5Xh78rRKJiEpP0ZaCs4ryOQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "8.44.0", + "@typescript-eslint/type-utils": "8.44.0", + "@typescript-eslint/utils": "8.44.0", + "@typescript-eslint/visitor-keys": "8.44.0", + "graphemer": "^1.4.0", + "ignore": "^7.0.0", + "natural-compare": "^1.4.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "@typescript-eslint/parser": "^8.44.0", + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/ignore": { + "version": "7.0.5", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-7.0.5.tgz", + "integrity": "sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, + "node_modules/@typescript-eslint/parser": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-8.44.0.tgz", + "integrity": "sha512-VGMpFQGUQWYT9LfnPcX8ouFojyrZ/2w3K5BucvxL/spdNehccKhB4jUyB1yBCXpr2XFm0jkECxgrpXBW2ipoAw==", + "dev": true, + "license": "MIT", + "peer": true, + "dependencies": { + "@typescript-eslint/scope-manager": "8.44.0", + "@typescript-eslint/types": "8.44.0", + "@typescript-eslint/typescript-estree": "8.44.0", + "@typescript-eslint/visitor-keys": "8.44.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/project-service": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/project-service/-/project-service-8.44.0.tgz", + "integrity": "sha512-ZeaGNraRsq10GuEohKTo4295Z/SuGcSq2LzfGlqiuEvfArzo/VRrT0ZaJsVPuKZ55lVbNk8U6FcL+ZMH8CoyVA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/tsconfig-utils": "^8.44.0", + "@typescript-eslint/types": "^8.44.0", + "debug": "^4.3.4" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/scope-manager": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-8.44.0.tgz", + "integrity": "sha512-87Jv3E+al8wpD+rIdVJm/ItDBe/Im09zXIjFoipOjr5gHUhJmTzfFLuTJ/nPTMc2Srsroy4IBXwcTCHyRR7KzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.44.0", + "@typescript-eslint/visitor-keys": "8.44.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/tsconfig-utils": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/tsconfig-utils/-/tsconfig-utils-8.44.0.tgz", + "integrity": "sha512-x5Y0+AuEPqAInc6yd0n5DAcvtoQ/vyaGwuX5HE9n6qAefk1GaedqrLQF8kQGylLUb9pnZyLf+iEiL9fr8APDtQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-8.44.0.tgz", + "integrity": "sha512-9cwsoSxJ8Sak67Be/hD2RNt/fsqmWnNE1iHohG8lxqLSNY8xNfyY7wloo5zpW3Nu9hxVgURevqfcH6vvKCt6yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.44.0", + "@typescript-eslint/typescript-estree": "8.44.0", + "@typescript-eslint/utils": "8.44.0", + "debug": "^4.3.4", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/types": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-8.44.0.tgz", + "integrity": "sha512-ZSl2efn44VsYM0MfDQe68RKzBz75NPgLQXuGypmym6QVOWL5kegTZuZ02xRAT9T+onqvM6T8CdQk0OwYMB6ZvA==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/typescript-estree": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-8.44.0.tgz", + "integrity": "sha512-lqNj6SgnGcQZwL4/SBJ3xdPEfcBuhCG8zdcwCPgYcmiPLgokiNDKlbPzCwEwu7m279J/lBYWtDYL+87OEfn8Jw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/project-service": "8.44.0", + "@typescript-eslint/tsconfig-utils": "8.44.0", + "@typescript-eslint/types": "8.44.0", + "@typescript-eslint/visitor-keys": "8.44.0", + "debug": "^4.3.4", + "fast-glob": "^3.3.2", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^2.1.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/brace-expansion": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", + "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/typescript-estree/node_modules/semver": { + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/@typescript-eslint/utils": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-8.44.0.tgz", + "integrity": "sha512-nktOlVcg3ALo0mYlV+L7sWUD58KG4CMj1rb2HUVOO4aL3K/6wcD+NERqd0rrA5Vg06b42YhF6cFxeixsp9Riqg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.7.0", + "@typescript-eslint/scope-manager": "8.44.0", + "@typescript-eslint/types": "8.44.0", + "@typescript-eslint/typescript-estree": "8.44.0" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.57.0 || ^9.0.0", + "typescript": ">=4.8.4 <6.0.0" + } + }, + "node_modules/@typescript-eslint/visitor-keys": { + "version": "8.44.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-8.44.0.tgz", + "integrity": "sha512-zaz9u8EJ4GBmnehlrpoKvj/E3dNbuQ7q0ucyZImm3cLqJ8INTc970B1qEqDX/Rzq65r3TvVTN7kHWPBoyW7DWw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "8.44.0", + "eslint-visitor-keys": "^4.2.1" + }, + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/visitor-keys/node_modules/eslint-visitor-keys": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-4.2.1.tgz", + "integrity": "sha512-Uhdk5sfqcee/9H/rCOJikYz67o0a2Tw2hGRPOG2Y1R2dg7brRe1uG0yaNQDHu+TO/uQPF/5eCapvYSmHUjt7JQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": "^18.18.0 || ^20.9.0 || >=21.1.0" + }, + "funding": { + "url": "https://opencollective.com/eslint" + } + }, "node_modules/abbrev": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -2616,6 +2906,13 @@ "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", "dev": true }, + "node_modules/graphemer": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", + "integrity": "sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==", + "dev": true, + "license": "MIT" + }, "node_modules/handlebars": { "version": "4.7.8", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.7.8.tgz", @@ -5681,6 +5978,19 @@ "node": ">=0.8" } }, + "node_modules/ts-api-utils": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-2.1.0.tgz", + "integrity": "sha512-CUgTZL1irw8u29bzrOD/nH85jqyc74D6SshFgujOIA7osm2Rz7dYH77agkx7H4FBNxDq7Cjf+IjaX/8zwFW+ZQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18.12" + }, + "peerDependencies": { + "typescript": ">=4.8.4" + } + }, "node_modules/tunnel-agent": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", @@ -5725,6 +6035,21 @@ "node": ">=4" } }, + "node_modules/typescript": { + "version": "5.9.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", + "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", + "dev": true, + "license": "Apache-2.0", + "peer": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/typical": { "version": "7.3.0", "resolved": "https://registry.npmjs.org/typical/-/typical-7.3.0.tgz", diff --git a/package.json b/package.json index 6ab5950..9af360e 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,10 @@ "src", "binding.gyp", "HISTORY.md", - "README.md" + "README.md", + "index.d.ts" ], + "types": "index.d.ts", "repository": { "type": "git", "url": "https://github.com/mongodb-js/kerberos.git" @@ -32,6 +34,7 @@ }, "devDependencies": { "@types/node": "^24.2.1", + "@typescript-eslint/eslint-plugin": "^8.31.1", "chai": "^4.4.1", "chai-string": "^1.6.0", "chalk": "^4.1.2", @@ -55,7 +58,7 @@ "install": "prebuild-install --runtime napi || node-gyp rebuild", "format-cxx": "clang-format -i 'src/**/*'", "format-js": "ESLINT_USE_FLAT_CONFIG=false eslint lib test --fix", - "check:lint": "ESLINT_USE_FLAT_CONFIG=false eslint lib test", + "check:lint": "ESLINT_USE_FLAT_CONFIG=false eslint lib test index.d.ts", "precommit": "check-clang-format", "docs": "jsdoc2md --template etc/README.hbs --plugin dmd-clear --files lib/kerberos.js > README.md", "test": "mocha 'test/*_tests.js'",