{"_id":"playwright-client-certificate-login","_rev":"2-d75e7ec424e9276543b6ac088298f9eb","name":"playwright-client-certificate-login","dist-tags":{"latest":"0.0.3"},"versions":{"0.0.1":{"name":"playwright-client-certificate-login","version":"0.0.1","keywords":["sap","btp","authentication","playwright","wdio","webdriverio","client-certificate"],"author":{"name":"Marian Zeis"},"license":"MIT","_id":"playwright-client-certificate-login@0.0.1","maintainers":[{"name":"marianfoo","email":"marianbsp@gmail.com"}],"dist":{"shasum":"b60bf5ed8e032383b1cc7e47cc4876653ec5f20a","tarball":"https://registry.npmjs.org/playwright-client-certificate-login/-/playwright-client-certificate-login-0.0.1.tgz","fileCount":3,"integrity":"sha512-uZMvDRjWX3CDVUjBfK4t+otypBCoNYkby93mCjHkYE7KggYNfm1RA+WITT/PCvSvow4zbDpmhXwP5+N8ptQibA==","signatures":[{"sig":"MEUCIG8R23qeTP56YSoVrc5oDAqWCQnaZM7d2+yc/0qIyM97AiEA/UdgTNsGoOWNnfcyvM6phTo/cHMeSQETZEZI+dydJpw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9331},"main":"index.js","gitHead":"0d94655ce91201996a664cbd93deadc9eb0f514c","scripts":{"test":"echo \"No tests specified\" && exit 0"},"_npmUser":{"name":"marianfoo","email":"marianbsp@gmail.com"},"_npmVersion":"10.3.0","description":"A playwright script to login using client certificates","directories":{},"_nodeVersion":"20.14.0","dependencies":{"@playwright/test":"1.48.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/playwright-client-certificate-login_0.0.1_1730890019466_0.36292352850121823","host":"s3://npm-registry-packages"}},"0.0.2":{"name":"playwright-client-certificate-login","version":"0.0.2","keywords":["sap","btp","authentication","playwright","wdio","webdriverio","client-certificate"],"author":{"name":"Marian Zeis"},"license":"MIT","_id":"playwright-client-certificate-login@0.0.2","maintainers":[{"name":"marianfoo","email":"marianbsp@gmail.com"}],"dist":{"shasum":"43916c3f3ab0fed4ae6b13a850282124f39def0e","tarball":"https://registry.npmjs.org/playwright-client-certificate-login/-/playwright-client-certificate-login-0.0.2.tgz","fileCount":3,"integrity":"sha512-Sf8fE7Khw8PEn6iKhTLGoa6GWmvBFp9l/htT80hBvfuYbFTPKToDyMe37/CQJVx2TDzazY/eGbNJnPv/vlG94g==","signatures":[{"sig":"MEUCIQCryAqR1cOQzWPZpm1W5TdDfblOIIhUD6t3MpNdCHSYEgIgTK+XjLyJ/uo2rie9ENl1k4pvJO5RS6Zde1IOEEaZRTQ=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":10093},"main":"index.js","gitHead":"a6c5e88ed379764be137208279add1457ce10b98","scripts":{"test":"echo \"No tests specified\" && exit 0"},"_npmUser":{"name":"marianfoo","email":"marianbsp@gmail.com"},"_npmVersion":"10.3.0","description":"A playwright script to login using client certificates","directories":{},"_nodeVersion":"20.14.0","dependencies":{"@playwright/test":"1.48.2"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/playwright-client-certificate-login_0.0.2_1730891947613_0.8007674940249372","host":"s3://npm-registry-packages"}},"0.0.3":{"name":"playwright-client-certificate-login","version":"0.0.3","description":"A playwright script to login using client certificates","main":"index.js","scripts":{"test":"echo \"No tests specified\" && exit 0"},"keywords":["sap","btp","authentication","playwright","wdio","webdriverio","client-certificate"],"author":{"name":"Marian Zeis"},"license":"MIT","dependencies":{"@playwright/test":"1"},"_id":"playwright-client-certificate-login@0.0.3","gitHead":"a6c5e88ed379764be137208279add1457ce10b98","_nodeVersion":"20.14.0","_npmVersion":"10.3.0","dist":{"integrity":"sha512-nbaqeio741V5Qyp/gt4RyMwib0Bp3ISIV7NwsNFMYJzVHidNUwU4t2NOEh1iaZBIyd9M0cAroG4stMCfkAWIOw==","shasum":"a6c53d23a837bccbe9ce7b6a2d293712e4d607ab","tarball":"https://registry.npmjs.org/playwright-client-certificate-login/-/playwright-client-certificate-login-0.0.3.tgz","fileCount":3,"unpackedSize":10088,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHe9OMRsz+qLZRFSoYR198VntrE3hBYOkZcLs/ivgpIAAiA2x3znriZcFArDphIgi4qtbHXlRqXKYD9T+RaVl8UPHQ=="}]},"_npmUser":{"name":"marianfoo","email":"marianbsp@gmail.com"},"directories":{},"maintainers":[{"name":"marianfoo","email":"marianbsp@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/playwright-client-certificate-login_0.0.3_1738749399559_0.019610280674137615"},"_hasShrinkwrap":false}},"time":{"created":"2024-11-06T10:46:59.466Z","modified":"2025-02-05T09:56:39.882Z","0.0.1":"2024-11-06T10:46:59.631Z","0.0.2":"2024-11-06T11:19:07.770Z","0.0.3":"2025-02-05T09:56:39.704Z"},"author":{"name":"Marian Zeis"},"license":"MIT","keywords":["sap","btp","authentication","playwright","wdio","webdriverio","client-certificate"],"description":"A playwright script to login using client certificates","maintainers":[{"name":"marianfoo","email":"marianbsp@gmail.com"}],"readme":"# Playwright Client Certificate Authentication\n\nA Node.js utility for authenticating using client certificates via Playwright.\n\n## Installation\n\n```bash\nnpm install playwright-client-certificate-login\n```\n\n## Usage\n\n```javascript\nconst { CertificateAuthSession } = require('playwright-client-certificate-login');\n\n// Using PFX/PKCS12 certificate\nconst options = {\n  origin: 'https://your-domain.com',\n  url: 'https://your-domain.com/path',\n  pfxPath: '/path/to/your/certificate.pfx',\n  passphrase: 'your-certificate-passphrase'\n};\n\n// Or using separate cert and key files\nconst options = {\n  origin: 'https://your-domain.com',\n  url: 'https://your-domain.com/path',\n  certPath: '/path/to/your/certificate.pem',\n  keyPath: '/path/to/your/private-key.pem',\n  passphrase: 'your-key-passphrase'\n};\n\nasync function authenticate() {\n  const session = new CertificateAuthSession(options);\n  try {\n    await session.authenticate();\n    \n    // Access authenticated session data\n    const cookies = session.getCookies();\n    const headers = session.getHeaders();\n    const browser = session.getBrowser();\n    const context = session.getContext();\n    const page = session.getPage();\n    \n    console.log('Authentication successful:', cookies);\n    \n    // Don't forget to close the session\n    await session.close();\n  } catch (error) {\n    console.error('Authentication failed:', error);\n  }\n}\n```\n\n## API Reference\n\n### Class: CertificateAuthSession\n\n#### Constructor Options\n\n| Parameter | Type | Required | Description |\n|-----------|------|----------|-------------|\n| `origin` | string | Yes | The exact origin that the certificate is valid for |\n| `url` | string | Yes | The URL to navigate to after authentication |\n| `certPath` | string | No* | Path to the certificate file in PEM format |\n| `keyPath` | string | No* | Path to the private key file in PEM format |\n| `pfxPath` | string | No* | Path to the PFX/PKCS12 certificate file |\n| `passphrase` | string | No | Passphrase for the private key |\n| `pfxBuffer` | Buffer | No* | Direct value of the PFX/PKCS12 certificate |\n| `certBuffer` | Buffer | No* | Direct value of the certificate in PEM format |\n| `keyBuffer` | Buffer | No* | Direct value of the private key in PEM format |\n| `timeout` | number | No | Timeout in milliseconds for page load (default: 30000) |\n\n\\* You must provide either:\n- `pfxPath` or `pfxBuffer`, OR\n- Both `certPath` and `keyPath`, OR\n- Both `certBuffer` and `keyBuffer`\n\n#### Methods\n\n| Method | Returns | Description |\n|--------|---------|-------------|\n| `authenticate()` | Promise<void> | Authenticates using the provided client certificate |\n| `getCookies()` | Array<Object> | Returns the cookies obtained after authentication |\n| `getHeaders()` | Object | Returns the headers prepared for API calls |\n| `getBrowser()` | Browser | Returns the Playwright browser instance |\n| `getContext()` | BrowserContext | Returns the Playwright browser context |\n| `getPage()` | Page | Returns the Playwright page instance |\n| `close()` | Promise<void> | Closes the browser instance |\n\n## Error Handling\n\nThe class will throw an error if:\n- Required options are missing\n- Certificate files cannot be read\n- Authentication process fails\n- Page load timeout is exceeded","readmeFilename":"README.md"}