
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@hsuite/client
Advanced tools
> 🌐 **Comprehensive NestJS client module for Web3 authentication and multi-ledger communication**
🌐 Comprehensive NestJS client module for Web3 authentication and multi-ledger communication
A powerful client service module that provides Web3-based authentication flow, dynamic node connection management, and network resilience with multi-chain support for HSuite applications.
npm install @hsuite/client
import { ClientModule } from '@hsuite/client';
import { ChainType, LedgerNetwork } from '@hsuite/smart-ledgers';
@Module({
imports: [
ClientModule.forRootAsync({
useFactory: () => ({
enabled: true,
baseUrl: 'https://api.yourapp.com',
ledgers: {
[ChainType.HASHGRAPH]: {
network: LedgerNetwork.HEDERA_TESTNET,
credentials: {
accountId: '0.0.123456',
privateKey: 'your-private-key',
publicKey: 'your-public-key'
}
}
}
})
})
]
})
export class AppModule {}
@Injectable()
export class YourService {
constructor(private clientService: ClientService) {}
async makeRequest() {
const response = await this.clientService.axios.get('/api/data');
return response.data;
}
}
src/
├── interfaces/ # TypeScript interfaces
├── client.service.ts # Core client service implementation
├── client.module.ts # Module configuration and setup
├── client.service.spec.ts # Unit tests
└── index.ts # Public API exports
forRootAsync(options: ClientModuleAsyncOptions): Promise<DynamicModule>
Configures the client module with async dependency injection and global scope.
interface ClientModuleAsyncOptions {
imports?: any[];
useFactory?: (...args: any[]) => Promise<IClient.IOptions> | IClient.IOptions;
inject?: any[];
useClass?: Type<any>;
}
Configuration Interface:
interface IClient.IOptions {
enabled: boolean;
baseUrl?: string;
ledgers: Record<ChainType, ILedgerConfig>;
}
login: Auth.Credentials.Web3.Response.Login
operator: ISmartNetwork.IOperator.IEntity
axios: AxiosInstance
onModuleInit(): Promise<void>
Error if authentication or connection failsConfigure Web3 authentication with wallet integration and signature verification. Set up blockchain-based authentication flows and credential management.
Set up support for multiple blockchain networks with failover capabilities. Configure Hedera Hashgraph, Ripple/XRP Ledger, and other supported networks.
Learn how to use the configured axios instance for authenticated API calls. Implement request interceptors, error handling, and retry logic.
import { ClientModule } from '@hsuite/client';
import { ConfigModule, ConfigService } from '@nestjs/config';
import { ChainType, LedgerNetwork } from '@hsuite/smart-ledgers';
@Module({
imports: [
ClientModule.forRootAsync({
imports: [ConfigModule],
useFactory: (configService: ConfigService) => ({
enabled: true,
baseUrl: configService.get('BASE_URL'),
ledgers: {
[ChainType.HASHGRAPH]: {
network: LedgerNetwork.HEDERA_TESTNET,
credentials: {
accountId: configService.get('OPERATOR_ID'),
privateKey: configService.get('OPERATOR_PRIVATE_KEY'),
publicKey: configService.get('OPERATOR_PUBLIC_KEY')
},
options: {
maxRetries: 3,
timeout: 30000
}
},
[ChainType.RIPPLE]: {
network: LedgerNetwork.RIPPLE_TESTNET,
credentials: {
wallet: configService.get('RIPPLE_WALLET'),
secret: configService.get('RIPPLE_SECRET')
}
}
}
}),
inject: [ConfigService]
})
]
})
export class AppModule {}
@Injectable()
export class BlockchainService {
constructor(private clientService: ClientService) {}
async getAccountInfo() {
// Access current operator details
const operator = this.clientService.operator;
console.log('Operator Account:', operator.accountId);
// Access login credentials
const login = this.clientService.login;
console.log('Wallet ID:', login.walletId);
return { operator, login };
}
async makeAuthenticatedRequest() {
try {
// Use configured axios instance
const response = await this.clientService.axios.get('/api/transactions');
return {
data: response.data,
status: response.status,
headers: response.headers
};
} catch (error) {
console.error('Request failed:', error.message);
throw error;
}
}
async postTransaction(transactionData: any) {
// POST requests with authentication
const response = await this.clientService.axios.post('/api/submit', {
transaction: transactionData,
signature: 'auto-generated'
});
return response.data;
}
}
// Custom configuration factory
@Injectable()
export class ClientConfigFactory {
constructor(private configService: ConfigService) {}
createClientOptions(): IClient.IOptions {
return {
enabled: this.configService.get('CLIENT_ENABLED', true),
baseUrl: this.configService.get('API_BASE_URL'),
ledgers: {
[ChainType.HASHGRAPH]: {
network: this.configService.get('HEDERA_NETWORK'),
credentials: {
accountId: this.configService.get('HEDERA_ACCOUNT_ID'),
privateKey: this.configService.get('HEDERA_PRIVATE_KEY'),
publicKey: this.configService.get('HEDERA_PUBLIC_KEY')
},
options: {
maxRetries: this.configService.get('MAX_RETRIES', 3),
timeout: this.configService.get('REQUEST_TIMEOUT', 30000)
}
}
}
};
}
}
// Usage in module
ClientModule.forRootAsync({
useClass: ClientConfigFactory
})
{
"@hsuite/smart-network-types": "^2.0.0",
"@hsuite/auth-types": "^2.1.2",
"@hsuite/smart-config": "^2.1.1",
"@hsuite/smart-ledgers": "^2.0.0"
}
# API Configuration
BASE_URL=https://api.yourapp.com
CLIENT_ENABLED=true
# Hedera Configuration
HEDERA_NETWORK=testnet
HEDERA_ACCOUNT_ID=0.0.123456
HEDERA_PRIVATE_KEY=302e020100300506032b657004220420...
HEDERA_PUBLIC_KEY=302a300506032b6570032100...
# Ripple Configuration (optional)
RIPPLE_NETWORK=testnet
RIPPLE_WALLET=rN7n7otQDd6FczFgLdSqtcsAUxDkw6fzRH
RIPPLE_SECRET=snGHtDdoRNJkL5dX...
# Request Settings
MAX_RETRIES=3
REQUEST_TIMEOUT=30000
@Injectable()
export class HealthService {
constructor(private clientService: ClientService) {}
async checkNetworkHealth() {
try {
// Test network connectivity
const response = await this.clientService.axios.get('/health');
return {
status: 'healthy',
operator: this.clientService.operator,
lastCheck: new Date(),
networkResponse: response.status
};
} catch (error) {
return {
status: 'unhealthy',
error: error.message,
lastCheck: new Date()
};
}
}
}
🔐 Security Note: Keep private keys and credentials secure. Use environment variables and never commit sensitive data to version control.
Built with ❤️ by the HSuite Team
Copyright © 2025 HSuite. All rights reserved.
FAQs
> 🌐 **Comprehensive NestJS client module for Web3 authentication and multi-ledger communication**
The npm package @hsuite/client receives a total of 0 weekly downloads. As such, @hsuite/client popularity was classified as not popular.
We found that @hsuite/client 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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.