
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.
sapo-client-sdk
Advanced tools
A TypeScript SDK for the Sapo API, providing easy-to-use methods for authentication and API operations.
npm install sapo-client-sdk
import { SapoClient } from 'sapo-client-sdk';
// Initialize the client
const client = new SapoClient({
apiKey: 'your-api-key',
secretKey: 'your-secret-key',
redirectUri: 'https://your-app.com/oauth/callback',
});
// Get OAuth authorization URL
const authUrl = client.getAuthorizationUrl({
store: 'your-store.mysapo.net',
scopes: ['read_products', 'write_products'],
});
// After OAuth callback, complete authentication
const token = await client.completeOAuth(
'your-store.mysapo.net',
'callback-url-with-code'
);
// Now you can make API calls
try {
const products = await client.get('/admin/products.json');
console.log(products);
} catch (error) {
console.error('API Error:', error);
}
The SDK handles the complete OAuth flow:
const authUrl = client.getAuthorizationUrl({
store: 'your-store.mysapo.net',
scopes: ['read_products', 'write_products'],
});
// Redirect user to authUrl
const token = await client.completeOAuth(
'your-store.mysapo.net',
'callback-url-with-code'
);
// Token is automatically set for future requests
Example of basic product operations:
import { SapoClient, Products } from 'sapo-client-sdk';
const client = new SapoClient({
apiKey: 'your-api-key',
secretKey: 'your-secret-key',
redirectUri: 'https://your-app.com/oauth/callback',
});
const products = new Products(client);
// List products
const productList = await products.list({
limit: 10,
page: 1,
vendor: 'Apple',
});
// Create a product
const newProduct = await products.create({
name: 'Test Product',
content: 'Product description',
variants: [
{
price: 99.99,
inventory_quantity: 10,
},
],
});
// Update a product
const updatedProduct = await products.update(newProduct.id, {
name: 'Updated Product Name',
});
// Delete a product
await products.delete(newProduct.id);
The SDK provides typed error classes for better error handling:
import { SapoError, RateLimitError } from 'sapo-client-sdk';
try {
await products.list();
} catch (error) {
if (error instanceof RateLimitError) {
console.log('Rate limit exceeded, retry after:', error.retryAfter);
} else if (error instanceof SapoError) {
console.log('API Error:', error.message, error.code);
}
}
The SDK automatically handles Sapo's rate limits:
You can check current rate limits:
const limits = client.getRateLimits();
console.log('Remaining requests:', limits.remaining);
Verify webhook signatures:
const isValid = client.verifyHmac(query, hmac);
if (isValid) {
// Process webhook
}
For detailed API documentation and examples, see:
MIT License - see LICENSE file for details.
FAQs
TypeScript SDK for Sapo API
The npm package sapo-client-sdk receives a total of 0 weekly downloads. As such, sapo-client-sdk popularity was classified as not popular.
We found that sapo-client-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.