@push.rocks/smartradius/client
📱 RADIUS Client Implementation - Connect to RADIUS servers with PAP, CHAP, and accounting support
Overview
This module provides a RADIUS client implementation for connecting to RADIUS servers. It supports PAP and CHAP authentication methods, accounting operations, and includes automatic retry with exponential backoff.
Features
- ✅ PAP Authentication - Password Authentication Protocol
- ✅ CHAP Authentication - Challenge-Handshake Authentication Protocol
- ✅ Accounting - Session start, stop, and interim updates
- ✅ Automatic Retries - Configurable retry count with exponential backoff
- ✅ Timeout Handling - Per-request timeouts
- ✅ Custom Attributes - Support for adding custom RADIUS attributes
- ✅ Response Validation - Authenticator verification for security
Exports
Classes
| Class |
Description |
RadiusClient |
Main client class for RADIUS operations |
Interfaces (Client-Specific)
| Interface |
Description |
IRadiusClientOptions |
Client configuration options |
IClientAuthRequest |
Authentication request parameters |
IClientAuthResponse |
Authentication response from server |
IClientAccountingRequest |
Accounting request parameters |
IClientAccountingResponse |
Accounting response from server |
Usage
Basic Authentication
Accounting
Custom Attributes
Client Options
| Option |
Type |
Default |
Description |
host |
string |
required |
RADIUS server address |
authPort |
number |
1812 |
Authentication port |
acctPort |
number |
1813 |
Accounting port |
secret |
string |
required |
Shared secret |
timeout |
number |
5000 |
Request timeout (ms) |
retries |
number |
3 |
Number of retries |
retryDelay |
number |
1000 |
Base delay between retries (ms) |
nasIpAddress |
string |
'0.0.0.0' |
NAS-IP-Address attribute |
nasIdentifier |
string |
'smartradius-client' |
NAS-Identifier attribute |
Response Properties
IClientAuthResponse
| Property |
Type |
Description |
code |
ERadiusCode |
Response packet code |
accepted |
boolean |
True if Access-Accept |
rejected |
boolean |
True if Access-Reject |
challenged |
boolean |
True if Access-Challenge |
replyMessage |
string |
Reply-Message attribute |
sessionTimeout |
number |
Session-Timeout in seconds |
framedIpAddress |
string |
Assigned IP address |
attributes |
IParsedAttribute[] |
All response attributes |
Re-exports
This module re-exports all types from ts_shared for convenience.