- Notifications
You must be signed in to change notification settings - Fork11
Socket SDK for JavaScript / TypeScript
License
SocketDev/socket-sdk-js
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
JavaScript SDK forSocket.dev API - Security analysis, vulnerability scanning, and compliance monitoring for software supply chains.
| Feature | Description |
|---|---|
| Package Analysis | Quick security checks for npm packages |
| Full Scans | Deep analysis with SBOM support |
| Batch Operations | Analyze multiple packages efficiently |
| Policy Management | Configure security & license rules |
| Quota Utilities | Cost calculation & planning helpers |
| TypeScript | Full type safety with auto-generated types |
Requirements: Node.js 18+ ·ESM only (v2.0+)
pnpm add @socketsecurity/sdk
Note: Version 2.0+ is ESM-only. For CommonJS support, use version 1.x.
import{SocketSdk}from'@socketsecurity/sdk'constclient=newSocketSdk('your-api-key',{retries:3,// Retry failed requests up to 3 timesretryDelay:1000,// Start with 1s delay, exponential backofftimeout:30000,// 30 second timeout})// Check your quotaconstquota=awaitclient.getQuota()if(quota.success){console.log(`Available quota:${quota.data.quota} units`)}// Analyze a packageconstresult=awaitclient.getScoreByNpmPackage('express','4.18.0')if(result.success){console.log(`Security Score:${result.data.score}/100`)}// Batch analyze multiple packagesconstbatchResult=awaitclient.batchPackageFetch({components:[{purl:'pkg:npm/express@4.18.0'},{purl:'pkg:npm/react@18.0.0'}]})
Quick security checks:batchPackageFetch() ·batchPackageStream() ·getIssuesByNpmPackage() ·getScoreByNpmPackage()
Project scanning:createDependenciesSnapshot() ·createOrgFullScan() ·createScanFromFilepaths() ·getScan() ·getScanList() ·getSupportedScanFiles()
Organizations and repositories:getOrganizations() ·createOrgRepo() ·getOrgRepo() ·getOrgRepoList() ·updateOrgRepo() ·deleteOrgRepo()
Security configuration:getOrgSecurityPolicy() ·updateOrgSecurityPolicy() ·getOrgLicensePolicy() ·updateOrgLicensePolicy() ·postSettings()
Deep analysis:getOrgFullScanList() ·getOrgFullScanMetadata() ·getOrgFullScanBuffered() ·streamOrgFullScan() ·deleteOrgFullScan()
Scan comparison:createOrgDiffScanFromIds() ·getDiffScanById() ·listOrgDiffScans() ·deleteOrgDiffScan()
Security fixes:streamPatchesFromScan() ·viewPatch()
Alert management:getOrgTriage() ·updateOrgAlertTriage()
SBOM export:exportCDX() ·exportSPDX() ·searchDependencies() ·uploadManifestFiles()
Categorization:createOrgRepoLabel() ·getOrgRepoLabel() ·getOrgRepoLabelList() ·updateOrgRepoLabel() ·deleteOrgRepoLabel()
Usage metrics:getQuota() ·getOrgAnalytics() ·getRepoAnalytics() ·getAuditLogEvents()
API tokens:getAPITokens() ·postAPIToken() ·postAPITokensRotate() ·postAPITokensRevoke() ·postAPITokenUpdate()
Feature access:getEnabledEntitlements() ·getEntitlements()
Cost helpers:getQuotaCost() ·getRequiredPermissions() ·calculateTotalQuotaCost() ·hasQuotaForMethods() ·getMethodsByQuotaCost() ·getMethodsByPermissions() ·getQuotaUsageSummary() ·getAllMethodRequirements()
Raw API access:getApi() ·sendApi()
| Guide | Description |
|---|---|
| Getting Started | Quick start for contributors (5 min setup) |
| API Reference | Complete API method documentation |
| Usage Examples | Real-world patterns and code samples |
| Quota Management | Cost tiers (0/10/100) and utilities |
| Testing Guide | Test helpers, fixtures, and patterns |
| Method Reference | Quick method selection guide |
Seeusage-examples.md for complete examples including:
- Package security analysis
- Batch operations
- Full scans with SBOM
- Policy management
- Quota planning
| Project | Description |
|---|---|
| Socket.dev API | Official REST API documentation |
| Socket CLI | Command-line interface |
| Socket GitHub App | Automated GitHub integration |
MIT
About
Socket SDK for JavaScript / TypeScript
Topics
Resources
License
Code of conduct
Contributing
Security policy
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors15
Uh oh!
There was an error while loading.Please reload this page.