Registry / auth-security / opencode-copilot-auth

opencode-copilot-auth

JSON →
library0.0.12jsnpmunverified

Provides authentication utilities for OpenCode Copilot, an AI-powered code assistant. Version 0.0.12 is the latest. The package handles JWT token management and GitHub App authentication flows. It is designed for Node.js environments and supports both CommonJS and ESM. It simplifies the process of obtaining and validating access tokens for Copilot services.

npm install opencode-copilot-auth
INSTALL
IMPORT
SIG · OPENCODE-COPILOT-A
O
opencode-copilot-auth
auth-securityjavascriptv0.0.12
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AuthClient
import { AuthClient } from 'opencode-copilot-auth'
Default export also available.
getToken
import { getToken } from 'opencode-copilot-auth'
const getToken = require('opencode-copilot-auth').getToken
Package supports CJS require, but named imports are preferred.
verifyToken
import { verifyToken } from 'opencode-copilot-auth'
Used to validate JWT tokens.

Initializes an AuthClient with environment variables and retrieves a token for a GitHub App installation.

import { AuthClient, getToken } from 'opencode-copilot-auth'; const client = new AuthClient({ appId: process.env.APP_ID ?? '', privateKey: process.env.PRIVATE_KEY ?? '', }); const token = await getToken({ installationId: process.env.INSTALLATION_ID ?? '', client, }); console.log(token);
Debug
Known issues
gotchaRequires Node.js 14 or higher due to use of ES2020 features.
fix
Ensure Node version is >=14.
affects: >=0.0.1
gotchaPrivate key must be in PEM format with escaped newlines if passed as environment variable.
fix
Use `process.env.PRIVATE_KEY.replace(/\\n/g, '\n')` or store as base64.
affects: >=0.0.1
deprecatedThe `getInstallationToken` method is deprecated in favor of `getToken`.
fix
Use `getToken({ installationId, client })` instead.
affects: >=0.0.10
Errors
Common errors & fixes
Error: Unable to parse private key: openssl error
Private key is not in correct PEM format or has incorrect line endings.
fix
Ensure private key is a valid RSA private key in PEM format with proper \n characters.
TypeError: client.getToken is not a function
AuthClient instance not properly initialized or wrong import.
fix
Use `new AuthClient(opts)` and pass it as `client` parameter to `getToken`.
Error: Invalid JWT: jwt malformed
Token string is not a valid JWT or is undefined.
fix
Check that `getToken` returned a valid token and that it is passed correctly.
Upgrade
Version history
0.0.12latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
2
Resources
opencode-copilot-auth — npm install opencode-copilot-auth · libregistry