Installation

Complete installation guide for Agent-Pass across different environments and package managers.

Quick Install

Install with npmbash
npm install agent-pass

Complete Installation

For production use, install all recommended dependencies:

TypeScript Project Setupbash
# Install core package
npm install agent-pass

# Install TypeScript dependencies
npm install --save-dev typescript @types/node

# Install crypto polyfill for browser environments (optional)
npm install crypto-browserify

# Verify installation
npx tsc --version

Environment Setup

Node.js
Server-side applications
Requirements:
  • Node.js 18.0.0 or higher
  • npm 9.0.0 or higher
  • Built-in crypto module
// No additional setup required
import { AgentPass } from 'agent-pass';

const agentPass = new AgentPass();
Browser
Client-side applications
Requirements:
  • Modern browser with WebCrypto
  • Crypto polyfill
  • Bundler configuration
// Install polyfill
npm install crypto-browserify

// Configure webpack/vite
module.exports = {
  resolve: {
    fallback: {
      crypto: require.resolve('crypto-browserify')
    }
  }
};
Deno/Bun
Alternative runtimes
Status:
  • Deno: Experimental support
  • Bun: Full compatibility
  • Edge functions: Limited
# Bun installation
bun add agent-pass

# Deno usage (experimental)
import { AgentPass } from "npm:agent-pass";

TypeScript Configuration

Recommended TypeScript configuration for optimal compatibility:

tsconfig.jsonjson
{
  "compilerOptions": {
    "target": "ES2020",
    "lib": ["ES2020", "DOM"],
    "module": "ESNext",
    "moduleResolution": "node",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true,
    "types": ["node"]
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

Verify Installation

Test your installation with this simple verification script:

verify-installation.jsjavascript
import { AgentPass } from 'agent-pass';

async function verifyInstallation() {
  try {
    console.log('πŸ” Verifying Agent-Pass installation...');
    
    // Test basic initialization
    const agentPass = new AgentPass({
      keyType: 'Ed25519',
      didMethod: 'did:key'
    });
    console.log('βœ… AgentPass initialized successfully');
    
    // Test agent creation
    const agent = await agentPass.createAgent({
      name: 'TestAgent',
      version: '1.0.0',
      capabilities: ['test:verify']
    });
    console.log('βœ… Agent created:', agent.did);
    
    // Test basic signing
    const testData = { message: 'Hello Agent-Pass!' };
    const signature = await agent.sign(testData);
    console.log('βœ… Signing works:', signature.length > 0);
    
    console.log('πŸŽ‰ Installation verified successfully!');
    console.log('πŸš€ Ready to build with Agent-Pass');
    
  } catch (error) {
    console.error('❌ Installation verification failed:', error.message);
    console.error('πŸ’‘ Please check the troubleshooting section');
  }
}

verifyInstallation();
Run verificationbash
# Save the script as verify-installation.js and run:
node verify-installation.js

# Or with Bun:
bun verify-installation.js

Troubleshooting

Common Solutions

Clear package manager cache:

# npm
npm cache clean --force

# yarn
yarn cache clean

# pnpm
pnpm store prune

Reinstall dependencies:

rm -rf node_modules package-lock.json
npm install

Check Node.js version:

node --version
# Should be 18.0.0 or higher

Next Steps