@anisrh/core-bootstrap
v1.1.0
Published
Device verification and bootstrap for authorized developers
Maintainers
Readme
Core Bootstrap
Device verification package for authorized developers.
How It Works
- Reads your developer ID from
developer-allowlist.json - Gets your device MAC address
- Sends both to verification API
- Returns whether you're authorized to work on the project
Installation
npm install @anisrh/core-bootstrapSetup for Developers
Step 1: Get Your MAC Address
First, get your device MAC address:
npx @anisrh/device-fingerprintSend this MAC address to your team lead.
Step 2: Receive Allowlist File
Your team lead will give you a developer-allowlist.json file containing your developer ID.
Step 3: Store the Allowlist File
Create the directory and save the file:
Windows:
mkdir %USERPROFILE%\.dev-allowlistMac/Linux:
mkdir -p ~/.dev-allowlistThen save developer-allowlist.json in this folder.
Step 4: Set API URL
Set the verification API URL as an environment variable:
Windows (PowerShell):
$env:DEV_VERIFY_API_URL="https://your-api.com/verify-device"Mac/Linux:
export DEV_VERIFY_API_URL="https://your-api.com/verify-device"Or add it to your project's .env file.
Step 5: Run Verification
npx @anisrh/core-bootstrapUsage in Your Project
Add to your project's startup script:
const { bootstrap } = require('@anisrh/core-bootstrap');
async function startApp() {
const result = await bootstrap({
allowlistPath: require('path').join(require('os').homedir(), '.dev-allowlist', 'developer-allowlist.json'),
apiUrl: process.env.DEV_VERIFY_API_URL
});
if (!result.allowed) {
console.error('Device not authorized!');
process.exit(1);
}
// Continue with your app...
}
startApp();CLI Options
# Use default paths
core-bootstrap
# Custom allowlist path
core-bootstrap --allowlist /path/to/developer-allowlist.json
# Custom API URL
core-bootstrap --api https://your-api.com/verify
# Show help
core-bootstrap --helpAPI Response Format
Your verification API should accept POST requests with:
{
"developerId": "dev-12345",
"deviceFingerprint": "AA:BB:CC:DD:EE:FF"
}And respond with:
{
"allowed": true,
"message": "Device authorized"
}Or:
{
"allowed": false,
"message": "Device not authorized"
}