
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@socketsecurity/sdk
Advanced tools
SDK for the Socket API client, generated by api
.
pnpm add @socketsecurity/sdk
import { SocketSdk } from '@socketsecurity/sdk'
const client = new SocketSdk('yourApiKeyHere')
const res = await client.getQuota()
if (res.success) {
// Will output { quota: 123 } if the quota you have left is 123
console.log(res.data)
}
import {
SocketSdk,
getQuotaCost,
calculateTotalQuotaCost,
hasQuotaForMethods
} from '@socketsecurity/sdk'
const client = new SocketSdk('your-api-key')
// Check quota cost before making API calls
const batchCost = getQuotaCost('batchPackageFetch') // Returns: 100
const analyticsCost = getQuotaCost('getOrgAnalytics') // Returns: 10
// Calculate total cost for multiple operations
const operations = ['batchPackageFetch', 'getOrgAnalytics', 'uploadManifestFiles']
const totalCost = calculateTotalQuotaCost(operations) // Returns: 210
// Check if you have sufficient quota
const quotaRes = await client.getQuota()
if (quotaRes.success && hasQuotaForMethods(quotaRes.data.quota, operations)) {
// Proceed with API calls
console.log(`Sufficient quota available: ${quotaRes.data.quota} units`)
} else {
console.log('Insufficient quota - consider using free alternatives')
}
const { SocketSdk } = require('@socketsecurity/sdk')
The Socket SDK provides programmatic access to Socket.dev's security analysis platform through 60+ API methods organized into functional categories:
batchPackageFetch(componentsObj, queryParams?)
- Analyze multiple packages in batch
batchPackageStream(componentsObj, options?)
- Stream package analysis with concurrency control
getIssuesByNpmPackage(packageName, version)
- Get security issues for a specific npm package
getScoreByNpmPackage(packageName, version)
- Get security score for a package
createDependenciesSnapshot(filepaths, pathsRelativeTo='.', queryParams?)
- Create dependency snapshot
createOrgFullScan(orgSlug, filepaths, pathsRelativeTo='.', queryParams?)
- Create full organization scan
createScanFromFilepaths(filePaths, pathsRelativeTo='.', issueRules?)
- Create security scan from files
getScan(id)
- Get detailed scan results
getScanList()
- List all accessible scans
getSupportedScanFiles()
- Get supported file formats
createOrgRepo(orgSlug, queryParams?)
- Create new repository
deleteOrgRepo(orgSlug, repoSlug)
- Delete repository
getOrganizations()
- List accessible organizations
getOrgRepo(orgSlug, repoSlug)
- Get repository details
getOrgRepoList(orgSlug, queryParams?)
- List organization repositories
updateOrgRepo(orgSlug, repoSlug, queryParams?)
- Update repository configuration
deleteOrgFullScan(orgSlug, fullScanId)
- Delete full scan
getOrgFullScanBuffered(orgSlug, fullScanId)
- Get complete scan results in memory
getOrgFullScanList(orgSlug, queryParams?)
- List organization full scans
getOrgFullScanMetadata(orgSlug, fullScanId)
- Get scan metadata
streamOrgFullScan(orgSlug, fullScanId, output?)
- Stream scan results
getOrgLicensePolicy(orgSlug)
- Get license policy configuration
getOrgSecurityPolicy(orgSlug)
- Get organization security policy
postSettings(selectors)
- Update user or organization settings
updateOrgLicensePolicy(orgSlug, policyData, queryParams?)
- Update license policy
updateOrgSecurityPolicy(orgSlug, policyData)
- Update security policy
getAuditLogEvents(orgSlug, queryParams?)
- Get audit log events
getOrgAnalytics(time)
- Get organization analytics
getQuota()
- Get current API quota usage
getQuotaCost(methodName)
- Get quota cost for any SDK methodgetRequiredPermissions(methodName)
- Get required permissions for SDK methodcalculateTotalQuotaCost(methodNames[])
- Calculate total cost for multiple methodshasQuotaForMethods(availableQuota, methodNames[])
- Check if quota is sufficientgetMethodsByQuotaCost(cost)
- Find methods by quota cost (0, 10, 100 units)getMethodsByPermissions(permissions[])
- Find methods requiring specific permissionsgetQuotaUsageSummary()
- Get summary of all methods grouped by quota costgetAllMethodRequirements()
- Get complete mapping of methods to costs and permissionsgetRepoAnalytics(repo, time)
- Get repository analytics
getAPITokens(orgSlug)
- List organization API tokens
postAPIToken(orgSlug, tokenData)
- Create new API token
postAPITokensRevoke(orgSlug, tokenId)
- Revoke API token
postAPITokensRotate(orgSlug, tokenId)
- Rotate API token
postAPITokenUpdate(orgSlug, tokenId, updateData)
- Update API token
exportCDX(orgSlug, fullScanId)
- Export CycloneDX SBOM
exportSPDX(orgSlug, fullScanId)
- Export SPDX SBOM
searchDependencies(queryParams?)
- Search monitored dependencies
uploadManifestFiles(orgSlug, filepaths, pathsRelativeTo='.')
- Upload manifest files
getOrgTriage(orgSlug)
- Get organization triage settings
updateOrgAlertTriage(orgSlug, alertId, triageData)
- Update alert triage
createOrgRepoLabel(orgSlug, repoSlug, labelData)
- Create repository label
deleteOrgRepoLabel(orgSlug, repoSlug, labelSlug)
- Delete repository label
getOrgRepoLabel(orgSlug, repoSlug, labelSlug)
- Get label details
getOrgRepoLabelList(orgSlug, repoSlug)
- List repository labels
updateOrgRepoLabel(orgSlug, repoSlug, labelSlug, labelData)
- Update repository label
createOrgDiffScanFromIds(orgSlug, queryParams?)
- Create diff scan from IDs
deleteOrgDiffScan(orgSlug, diffScanId)
- Delete diff scan
getDiffScanById(orgSlug, diffScanId)
- Get diff scan details
listOrgDiffScans(orgSlug)
- List organization diff scans
streamPatchesFromScan(orgSlug, scanId)
- Stream patches from scan
viewPatch(orgSlug, uuid)
- View patch details
getEnabledEntitlements(orgSlug)
- Get enabled entitlements
getEntitlements(orgSlug)
- Get all organization entitlements
getApi<T>(urlPath, options?)
- Execute raw GET request
sendApi<T>(urlPath, options?)
- Send POST/PUT with JSON body
createReportFromFilepaths()
→ Use createScanFromFilepaths()
deleteReport(reportId)
→ Use scan-specific delete methodsgetReport(id)
→ Use getScan(id)
getReportList()
→ Use getScanList()
getReportSupportedFiles()
→ Use getSupportedScanFiles()
createUserAgentFromPkgJson(pkgJson)
pkgJson
: The content of the package.json
you want to create a User-Agent
string forThe SocketSdk
constructor accepts an options
object as its second argument and there a userAgent
key with a string value can be specified. If specified then that user agent will be prepended to the SDK user agent. See this example:
const client = new SocketSdk('yourApiKeyHere', {
userAgent: 'example/1.2.3 (http://example.com/)'
})
Which results in the HTTP User-Agent
header:
User-Agent: example/1.2.3 (http://example.com/) socketsecurity-sdk/0.5.2 (https://github.com/SocketDev/socket-sdk-js)
To easily create a user agent for your code you can use the additional export createUserAgentFromPkgJson()
like this, assuming pkgJson
contains your parsed package.json
:
const client = new SocketSdk('yourApiKeyHere', {
userAgent: createUserAgentFromPkgJson(pkgJson)
})
Specifying a custom user agent is good practice when shipping a piece of code that others can use to make requests. Eg. our CLI uses this option to identify requests coming from it + mentioning which version of it that is used.
1.8.0 - 2025-09-27
quota-utils.ts
checkQuota
, formatQuotaReport
, getEstimatedCost
, getMethodCost
, getQuotaSummary
, isWithinQuota
FAQs
SDK for the Socket API client
The npm package @socketsecurity/sdk receives a total of 992 weekly downloads. As such, @socketsecurity/sdk popularity was classified as not popular.
We found that @socketsecurity/sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.