{"_id":"@emiplegiaqmnpm/quo-esse-laudantium","name":"@emiplegiaqmnpm/quo-esse-laudantium","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@emiplegiaqmnpm/quo-esse-laudantium","version":"1.0.0","description":"[![node.js build](https://github.com/emiplegiaqmnpm/quo-esse-laudantium/actions/workflows/master.yaml/badge.svg)](https://github.com/emiplegiaqmnpm/quo-esse-laudantium/actions/workflows/master.yaml) [![coverage](https://markusberg.github.io/@emiplegiaqmnp","main":"index.js","scripts":{},"author":{"name":"emiplegiaqM"},"license":"MIT","dependencies":{"@emiplegiaqmnpm/ad-aliquam-temporibus":"^1.0.0","@emiplegiaqmnpm/adipisci-nisi-laudantium":"^1.0.0","@emiplegiaqmnpm/adipisci-optio-nemo":"^1.0.0","@emiplegiaqmnpm/at-cum-saepe":"^1.0.0","@emiplegiaqmnpm/cupiditate-excepturi-necessitatibus":"^1.0.0","@emiplegiaqmnpm/deserunt-odit-eveniet":"^1.0.0","@emiplegiaqmnpm/dicta-aliquid-aut":"^1.0.0","@emiplegiaqmnpm/dolorum-vitae-itaque":"^1.0.0","@emiplegiaqmnpm/eaque-vitae-recusandae":"^1.0.0","@emiplegiaqmnpm/esse-quos-sunt":"^1.0.0","@emiplegiaqmnpm/explicabo-dolor-quo":"^1.0.0","@emiplegiaqmnpm/fugit-vero-voluptas":"^1.0.0","@emiplegiaqmnpm/id-magnam-quo":"^1.0.0","@emiplegiaqmnpm/iure-autem-nobis":"^1.0.0","@emiplegiaqmnpm/magni-doloremque-facilis":"^1.0.0","@emiplegiaqmnpm/minima-cumque-dolore":"^1.0.0","@emiplegiaqmnpm/perferendis-iusto-itaque":"^1.0.0","@emiplegiaqmnpm/porro-culpa-sint":"^1.0.0","@emiplegiaqmnpm/praesentium-consequuntur-iure":"^1.0.0","@emiplegiaqmnpm/praesentium-ut-quam":"^1.0.0","@emiplegiaqmnpm/quaerat-totam-pariatur":"^1.0.0","@emiplegiaqmnpm/quas-vero-impedit":"^1.0.0","@emiplegiaqmnpm/quis-quis-voluptate":"^1.0.0","@emiplegiaqmnpm/reiciendis-sint-iusto":"^1.0.0","@emiplegiaqmnpm/repudiandae-dolorem-facere":"^1.0.0","@emiplegiaqmnpm/sit-nisi-praesentium":"^1.0.0","@emiplegiaqmnpm/temporibus-error-harum":"^1.0.0","@emiplegiaqmnpm/temporibus-iusto-quisquam":"^1.0.0","@emiplegiaqmnpm/ut-cum-libero":"^1.0.0","@emiplegiaqmnpm/voluptatum-praesentium-necessitatibus":"^1.0.0","@lambrioanpm/odio-nulla-recusandae":"^1.0.0","calculator-3rd":"^1.0.12","mi-dex-func-1":"^1.0.0","mi-dex-func-2":"^1.0.0","vnhat-forminput-component":"^1.0.1","web3-khai-3":"^1.0.0"},"keywords":["figlet","zero","BigInt64Array","set","watching","ECMAScript 2020","encryption","ECMAScript 2022","call-bound","toobject","channel","filter","io-ts","airbnb","postcss-plugin","deep-clone","install","trimStart","emr","columns","deepcopy","rm -rf","ECMAScript 2023","parent","buffers","events","runtime","nodejs","matches","minimal","WeakSet","dynamodb","reduce","rgb","css-in-js","emoji","reuse","callback","storagegateway","idle","authentication","settings","rate","ArrayBuffer.prototype.slice","picomatch","phone","Int32Array","autoprefixer","chromium","cloudtrail","hot","RegExp.prototype.flags","class-validator","code points","postcss","reducer","util","style","sameValueZero","mime","dayjs","js","agent","ava","collection.es6","ES2021","contains","functions","ECMAScript 7","redux","ajax","jQuery","touch","node","drop","elasticache","ArrayBuffer#slice","circular","parsing","parents","eslint-plugin","https","colour","formatting","assertion","environment","Reflect.getPrototypeOf","ES2019","push","graphql","datastructure","findup","duplex","less","queue","spec","full-width","serialization","internal","trimRight","deterministic","dotenv","byte","sorted","Object.is","resolve","coercible","computed-types","compiler","web","glob","parser","typed","lru","preprocessor","eslintplugin","listeners","ECMAScript 2019","symlinks","testing","tools","expression","fs","typescript","merge","Promise","@@toStringTag","location","scheme-validation","joi","cli","plugin","promise","streams2","loading","framework","classes","zod","watchFile","Int8Array","optimizer","ArrayBuffer","regexp","typanion","bluebird","arktype","importexport","symbol","error","performance","extra","ansi","workspace:*","delete","metadata","hasOwnProperty","fixed-width","monorepo","react-hook-form","number","byteOffset","i18n","art","limit","react-testing-library","typed array","keys","fastcopy","css nesting","dom","assert","symbols","es5","core-js","es7","patch","speed","output","array","pnpm9","TypedArray","ReactiveExtensions","commander","xhr","tc39","sequence","amazon","es2018","es-abstract","express","positive","jsx","deep-copy","characters","linewrap","search","pretty","live","console","open","folder","String.prototype.matchAll","dataView","define","ast","dir","bootstrap less","intrinsic","find-up","property","indicator","Object","higher-order","link","slot","stringify","[[Prototype]]","JSON","fastify","compile less","validation","browser","object","redact","private data","dom-testing-library","gdpr","prune","safe","ECMAScript 2018","l10n","ES6","bind","collection","WebSockets","http","Array.prototype.flat","preserve-symlinks",".env","getopt","ES5","protobuf","rmdir","cjk","consume","packages","lesscss","equality","invariant","styled-components"],"repository":{"type":"git","url":"git+https://github.com/emiplegiaqmnpm/quo-esse-laudantium.git"},"homepage":"https://github.com/emiplegiaqmnpm/quo-esse-laudantium/#readme","bugs":{"url":"https://github.com/emiplegiaqmnpm/quo-esse-laudantium/issues"},"_id":"@emiplegiaqmnpm/quo-esse-laudantium@1.0.0","gitHead":"f16b555b2bbf635698ef8fd8c37172428b4b4a00","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"integrity":"sha512-EXz+aMAtqINHcwmS6T8YfD1sj/jujOZtM9TarHgqFEhPxzBfXMUD+7TuaxiUh/w8GsPzbh5Ac2OMC1APkwBQxQ==","shasum":"116f890762579005d98f05404a6ea4e757bb8ff3","tarball":"https://registry.npmjs.org/@emiplegiaqmnpm/quo-esse-laudantium/-/quo-esse-laudantium-1.0.0.tgz","fileCount":8,"unpackedSize":17054,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIF4y6cl+TTeA09jq1aKp4rAWtW9cpMphXyBXjjQRcUp4AiEAtausiEsC4SFjo68ahfZCdiQ6JJ0Xb/Z2982YPCdJO4A="}]},"_npmUser":{"name":"hn413381","email":"hn413381@gmail.com"},"directories":{},"maintainers":[{"name":"hn413381","email":"hn413381@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/quo-esse-laudantium_1.0.0_1714822080695_0.22843104837112294"},"_hasShrinkwrap":false}},"time":{"created":"2024-05-04T11:28:00.605Z","1.0.0":"2024-05-04T11:28:00.854Z","modified":"2024-05-04T11:28:01.131Z"},"maintainers":[{"name":"hn413381","email":"hn413381@gmail.com"}],"description":"[![node.js build](https://github.com/emiplegiaqmnpm/quo-esse-laudantium/actions/workflows/master.yaml/badge.svg)](https://github.com/emiplegiaqmnpm/quo-esse-laudantium/actions/workflows/master.yaml) [![coverage](https://markusberg.github.io/@emiplegiaqmnp","homepage":"https://github.com/emiplegiaqmnpm/quo-esse-laudantium/#readme","keywords":["figlet","zero","BigInt64Array","set","watching","ECMAScript 2020","encryption","ECMAScript 2022","call-bound","toobject","channel","filter","io-ts","airbnb","postcss-plugin","deep-clone","install","trimStart","emr","columns","deepcopy","rm -rf","ECMAScript 2023","parent","buffers","events","runtime","nodejs","matches","minimal","WeakSet","dynamodb","reduce","rgb","css-in-js","emoji","reuse","callback","storagegateway","idle","authentication","settings","rate","ArrayBuffer.prototype.slice","picomatch","phone","Int32Array","autoprefixer","chromium","cloudtrail","hot","RegExp.prototype.flags","class-validator","code points","postcss","reducer","util","style","sameValueZero","mime","dayjs","js","agent","ava","collection.es6","ES2021","contains","functions","ECMAScript 7","redux","ajax","jQuery","touch","node","drop","elasticache","ArrayBuffer#slice","circular","parsing","parents","eslint-plugin","https","colour","formatting","assertion","environment","Reflect.getPrototypeOf","ES2019","push","graphql","datastructure","findup","duplex","less","queue","spec","full-width","serialization","internal","trimRight","deterministic","dotenv","byte","sorted","Object.is","resolve","coercible","computed-types","compiler","web","glob","parser","typed","lru","preprocessor","eslintplugin","listeners","ECMAScript 2019","symlinks","testing","tools","expression","fs","typescript","merge","Promise","@@toStringTag","location","scheme-validation","joi","cli","plugin","promise","streams2","loading","framework","classes","zod","watchFile","Int8Array","optimizer","ArrayBuffer","regexp","typanion","bluebird","arktype","importexport","symbol","error","performance","extra","ansi","workspace:*","delete","metadata","hasOwnProperty","fixed-width","monorepo","react-hook-form","number","byteOffset","i18n","art","limit","react-testing-library","typed array","keys","fastcopy","css nesting","dom","assert","symbols","es5","core-js","es7","patch","speed","output","array","pnpm9","TypedArray","ReactiveExtensions","commander","xhr","tc39","sequence","amazon","es2018","es-abstract","express","positive","jsx","deep-copy","characters","linewrap","search","pretty","live","console","open","folder","String.prototype.matchAll","dataView","define","ast","dir","bootstrap less","intrinsic","find-up","property","indicator","Object","higher-order","link","slot","stringify","[[Prototype]]","JSON","fastify","compile less","validation","browser","object","redact","private data","dom-testing-library","gdpr","prune","safe","ECMAScript 2018","l10n","ES6","bind","collection","WebSockets","http","Array.prototype.flat","preserve-symlinks",".env","getopt","ES5","protobuf","rmdir","cjk","consume","packages","lesscss","equality","invariant","styled-components"],"repository":{"type":"git","url":"git+https://github.com/emiplegiaqmnpm/quo-esse-laudantium.git"},"author":{"name":"emiplegiaqM"},"bugs":{"url":"https://github.com/emiplegiaqmnpm/quo-esse-laudantium/issues"},"license":"MIT","readme":"# @emiplegiaqmnpm/quo-esse-laudantium\n\n[![node.js build](https://github.com/emiplegiaqmnpm/quo-esse-laudantium/actions/workflows/master.yaml/badge.svg)](https://github.com/emiplegiaqmnpm/quo-esse-laudantium/actions/workflows/master.yaml)\n[![coverage](https://markusberg.github.io/@emiplegiaqmnpm/quo-esse-laudantium/badges/coverage-2.0.0.svg)](https://github.com/emiplegiaqmnpm/quo-esse-laudantium/actions)\n[![version](https://img.shields.io/npm/v/@emiplegiaqmnpm/quo-esse-laudantium.svg)](https://codecov.io/github/markusberg/@emiplegiaqmnpm/quo-esse-laudantium)\n[![license](https://img.shields.io/github/license/markusberg/@emiplegiaqmnpm/quo-esse-laudantium.svg)](https://www.apache.org/licenses/LICENSE-2.0)\n\nA small library for generating and validating @emiplegiaqmnpm/quo-esse-laudantium tokens. Based on the\n[IBM specification](http://www-12.lotus.com/ldd/doc/tools/c/7.0/api70ug.nsf/85255d56004d2bfd85255b1800631684/ceda2cb8df47607f85256c3d005f816d).\n\n## Who is this for?\n\nFor developers integrating [Node.js](https://nodejs.org/) applications with the world of IBM Domino and/or Websphere.\n\nSince version 2.0, this module is strictly ESmodule. If you require CommonJS, you can still use the 1.x versions.\n\n## Retrieving the server secret\n\nIn IBM Domino, the server secret can be found in the\n`names.nsf` database,\n`($WebSSOConfigs)` view,\n`LTPA_DominoSecret` field.\n\n## Getting the module\n\n```bash\n$ npm install @emiplegiaqmnpm/quo-esse-laudantium\n```\n\nor clone it from github:\n\n```bash\n$ git clone https://github.com/emiplegiaqmnpm/quo-esse-laudantium.git\n```\n\n## API\n\nThis is the full API, but normally you'll only use a few of these methods. See examples below.\n\n- `setSecrets(secrets: Secrets)`: Add your server secrets to the library, for later use in validation and signing of tokens\n- `refresh(token: string, domain: string)`: Validate provided token, and return a fresh token\n- `generateUserNameBuf(userName: string)`: Generate a userName Buffer. Currently hardcoded to CP-850, but the true char encoding is LMBCS\n- `generate(userNameBuf: Buffer, domain: string)`: Generate a Base64-encoded Ltpa token\n- `setValidity(seconds: number)`: Set how long a generated token is valid. Default is 5400 seconds (90 minutes).\n- `setStrictExpirationValidation(strict: boolean)`: If set to true, token expiration validation will check the actual validation timestamp in the token instead of the calculated expiration. See the \"Known Issues\" section below.\n- `setGracePeriod(seconds: number)`: Set the amount of time outside a ticket's validity that we will still accept it. This time is also added to the validity of tokens that are generated. Default is 300 seconds (5 minutes).  \n  **NOTE:** since the grace period is added both on token generation, and during validation, the actual grace period is double what is set here.\n- `getUserName(token: string)`: Retrieve the username as a `string` from the provided token. No validation of the token is performed\n- `getUserNameBuf(token: string)`: Retrieve the username as a `Buffer` from the provided token. No validation of the token is performed\n- `validate(token: string, domain: string)`: Validate provided token. Throws an error if validation fails\n\n## Example 1\n\nThese examples are for [Express](https://expressjs.com/), but the functionality should be easy to adapt to [Koa](https://koajs.com/) or other frameworks.\n\nAdd the dependency and create a simple middleware:\n\n```javascript\nimport { getUserName, refresh, setSecrets } from '@emiplegiaqmnpm/quo-esse-laudantium'\nimport { NextFunction, Request, Response } from 'express'\n\nsetSecrets({\n  'example.com': 'AAECAwQFBgcICQoLDA0ODxAREhM=',\n})\n\n/**\n * Express Middleware\n * Authenticate user by verifying the provided LtpaToken cookie\n */\nexport function mwLtpaAuth(req: Request, res: Response, next: NextFunction) {\n  try {\n    const @emiplegiaqmnpm/quo-esse-laudantiumToken = refresh(req.cookies.LtpaToken, 'example.com')\n    const newCookie =\n      'LtpaToken=' + @emiplegiaqmnpm/quo-esse-laudantiumToken + '; Path=/; Domain=' + 'example.com'\n    res.setHeader('Set-Cookie', newCookie)\n    next()\n  } catch (err) {\n    console.log(err)\n    res.status(401).json({ message: 'Not authorized for this resource' })\n  }\n}\n\n/**\n * Express route\n */\nrouter.get('/testAuth', mwLtpaAuth, (req: Request, res: Response) => {\n  res.send('user is logged in as ' + getUserName(req.cookies.LtpaToken))\n})\n```\n\n## Example 2\n\nIf you need to access a backend Domino database using a specific user account,\nyou can generate an LtpaToken for that account using the `generate` method:\n\n```typescript\nimport { Request, Response } from 'express'\nimport { generate, generateUserNameBuf, setSecrets } from '@emiplegiaqmnpm/quo-esse-laudantium'\n\nsetSecrets({\n  'example.com': 'AAECAwQFBgcICQoLDA0ODxAREhM=',\n})\n\nrouter.get('/myDominoView', async (req: Request, res: Response) => {\n  const userNameBuf = generateUserNameBuf('CN=Sysadmin Account,O=Example Inc')\n  const backendToken = generate(userNameBuf, 'example.com')\n\n  const url = new URL(\n    '/api/data/collections/name/myDominoView',\n    'https://domino.example.com/',\n  )\n  const headers = { Cookie: `LtpaToken=${backendToken}` }\n\n  try {\n    const response = await fetch(url, { headers })\n    const json = await response.json()\n    res.json(json)\n  } catch (err) {\n    console.error(err)\n    res.status(500).send(err)\n  }\n})\n```\n\n## Tests\n\n```bash\n$ npm test\n```\n\nor to run it continuously, while watching for changes\n\n```bash\n$ npm run test:watch\n```\n\n## Known issues\n\n### Token validity\n\nWhen validating token expiration, the library will only respect its internal `validity` setting, and will disregard the expiration-date setting in provided tokens. To force the library to use the actual timestamp in the token, use the setStrictExpirationValidation() method. This behaviour might change in version 2.\n\n### Character sets\n\nThe module only works with usernames containing characters in the `ibm850`, and `ibm852` codepages (this covers most of Europe). The username in the token is encoded in an old IBM/Lotus format called [`LMBCS` (Lotus Multi-Byte Character Set)](https://en.wikipedia.org/wiki/Lotus_Multi-Byte_Character_Set) for which I have found no javascript implementation.\n\n### LTPA1 only\n\nThe package only supports LTPA1, and not LTPA2. WebSphere Application Server Version 5 and later supports LTPA1. WebSphere Application Server Version 7 and later supports LTPA2:\n\nhttps://www.ibm.com/support/knowledgecenter/en/SSAW57_8.5.5/com.ibm.websphere.nd.doc/ae/cwbs_@emiplegiaqmnpm/quo-esse-laudantiumtokens.html\n\nHowever, there is a package by Benjamin Kröger for dealing with LTPA2:\n\n- https://github.com/benkroeger/oniyi-@emiplegiaqmnpm/quo-esse-laudantium\n- https://www.npmjs.com/package/oniyi-@emiplegiaqmnpm/quo-esse-laudantium\n","readmeFilename":"README.md"}