Coject.Core.Helper
1.0.36
See the version list below for details.
dotnet add package Coject.Core.Helper --version 1.0.36
NuGet\Install-Package Coject.Core.Helper -Version 1.0.36
<PackageReference Include="Coject.Core.Helper" Version="1.0.36" />
<PackageVersion Include="Coject.Core.Helper" Version="1.0.36" />
<PackageReference Include="Coject.Core.Helper" />
paket add Coject.Core.Helper --version 1.0.36
#r "nuget: Coject.Core.Helper, 1.0.36"
#:package Coject.Core.Helper@1.0.36
#addin nuget:?package=Coject.Core.Helper&version=1.0.36
#tool nuget:?package=Coject.Core.Helper&version=1.0.36
Coject.Core.Helper
A comprehensive .NET helper library providing essential utilities for file management, email operations, SMS services, data handling, encryption, and integration with cloud services.
Overview
Coject.Core.Helper is a production-ready utility library designed to streamline common development tasks in .NET applications. It offers robust implementations for file operations, email services, SMS integration, data manipulation, security features, and multiple storage provider support.
Features
📁 File Management
- Multiple Storage Providers: Support for AWS S3, FTP, and local file systems
- File Operations: Upload, download, delete, and manage files across different storage backends
- Digital Signatures: Generate and validate file signatures
- Format Support: Handle various file formats with dedicated helpers
- Shared Links: Generate temporary shared links with configurable expiry times
📧 Email Services
- SMTP Integration: Send emails using MailKit with advanced configuration
- Template Support: Professional email signature generation
- Attachment Handling: Easy attachment management
- HTML/Plain Text: Support for both email formats
📱 SMS Integration
- Multi-Provider Support: Configurable SMS provider integration
- OTP Messages: Built-in support for one-time password delivery
- Flexible Response Handling: JSON or string-based success/error detection
- Custom Parameters: Configurable parameter names for different SMS gateways
- URL Encoding: Optional parameter encoding for compatibility
🔐 Security & Encryption
- Data Encryption: Secure encryption and decryption utilities with IV key support
- JWT Tokens: Token generation and validation
- Barcode Generation: Create barcodes using ZXing.Net
- Shared Link Security: Time-based expiry for secure file sharing
📊 Data Utilities
- JSON Processing: Advanced JSON serialization and deserialization helpers
- Date Handling: Comprehensive date and time utilities
- String Operations: String manipulation and formatting tools
- Image Processing: Image handling and conversion utilities
- Map Data: Geographic data processing helpers
☁️ Cloud Integration
- AWS S3: Full support for Amazon S3 operations
- FTP: Traditional FTP server integration
- Configurable: Easy configuration for different storage providers
Installation
Install via NuGet Package Manager:
dotnet add package Coject.Core.Helper
Or via Package Manager Console:
Install-Package Coject.Core.Helper
Requirements
- .NET 8.0 or higher
- Dependencies are automatically installed via NuGet
Configuration
Application Settings Structure
Add the following configuration to your appsettings.json:
{
"AttachmentSettings": {
"StorageType": "FTP",
"SharedLinkExpiryMinutes": 60,
"EXPIRY_IV_KEY": "ByDz579cdbMMZq8cbzMhtA==",
"AWS": {
"Key": "your-aws-access-key",
"SecretKey": "your-aws-secret-key",
"BucketName": "your-bucket-name"
},
"FTP": {
"Server": "ftp://your-ftp-server.com",
"Username": "ftp-username",
"Password": "ftp-password"
},
"SmsSettings": {
"Provider": "sms-provider-name",
"BaseUrl": "https://sms-gateway.com/",
"SendPath": "api/send",
"UsernameParameter": "username",
"PasswordParameter": "password",
"SenderParameter": "Sender",
"TextParameter": "Text",
"NumberParameter": "number",
"Username": "your-sms-username",
"Password": "your-sms-password",
"Sender": "YourAppName",
"TimeoutSeconds": 30,
"UrlEncodeParameters": true,
"SuccessString": "",
"SuccessCriteria": {
"Type": "json",
"SuccessProperty": "Status",
"SuccessValue": "0"
},
"ErrorCriteria": {
"Type": "string",
"ErrorKeyword": "Error Code"
},
"OTPMessage": "Use the code {0} to log in."
}
}
}
Configuration Parameters
Storage Settings
| Parameter | Type | Description |
|---|---|---|
StorageType |
string | Storage provider to use: "AWS", "FTP", or "Local" |
SharedLinkExpiryMinutes |
integer | Duration in minutes before shared links expire |
EXPIRY_IV_KEY |
string | Base64 encoded initialization vector for encryption |
AWS S3 Settings
| Parameter | Type | Description |
|---|---|---|
Key |
string | AWS access key ID |
SecretKey |
string | AWS secret access key |
BucketName |
string | S3 bucket name for file storage |
FTP Settings
| Parameter | Type | Description |
|---|---|---|
Server |
string | FTP server URL (include ftp:// or ftps://) |
Username |
string | FTP account username |
Password |
string | FTP account password |
SMS Settings
| Parameter | Type | Description |
|---|---|---|
Provider |
string | Name/identifier of the SMS provider |
BaseUrl |
string | Base URL of the SMS gateway API |
SendPath |
string | API endpoint path for sending SMS |
UsernameParameter |
string | Parameter name for username in API request |
PasswordParameter |
string | Parameter name for password in API request |
SenderParameter |
string | Parameter name for sender ID in API request |
TextParameter |
string | Parameter name for message text in API request |
NumberParameter |
string | Parameter name for recipient number in API request |
Username |
string | Your SMS gateway account username |
Password |
string | Your SMS gateway account password |
Sender |
string | Default sender name/ID for outgoing messages |
TimeoutSeconds |
integer | Request timeout duration (default: 30) |
UrlEncodeParameters |
boolean | Whether to URL encode parameters (default: true) |
SuccessString |
string | Optional string to match for success (legacy) |
OTPMessage |
string | Template for OTP messages. Use {0} for code placeholder |
SMS Success Criteria
| Parameter | Type | Description |
|---|---|---|
Type |
string | Response format: "json" or "string" |
SuccessProperty |
string | JSON property name to check for success (json type only) |
SuccessValue |
string | Expected value indicating success |
SMS Error Criteria
| Parameter | Type | Description |
|---|---|---|
Type |
string | Error detection format: "json" or "string" |
ErrorKeyword |
string | Keyword/property indicating an error occurred |
Configuration Examples
Using AWS S3 Storage
{
"AttachmentSettings": {
"StorageType": "AWS",
"AWS": {
"Key": "AKIAIOSFODNN7EXAMPLE",
"SecretKey": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY",
"BucketName": "my-application-files"
}
}
}
Using FTP Storage
{
"AttachmentSettings": {
"StorageType": "FTP",
"FTP": {
"Server": "ftp://files.company.com",
"Username": "fileadmin",
"Password": "SecureP@ssw0rd"
}
}
}
SMS with JSON Response
{
"AttachmentSettings": {
"SmsSettings": {
"SuccessCriteria": {
"Type": "json",
"SuccessProperty": "Status",
"SuccessValue": "0"
}
}
}
}
Expected API response:
{
"Status": "0",
"Message": "SMS sent successfully"
}
SMS with String Response
{
"AttachmentSettings": {
"SmsSettings": {
"SuccessCriteria": {
"Type": "string",
"SuccessValue": "SUCCESS"
},
"ErrorCriteria": {
"Type": "string",
"ErrorKeyword": "ERROR"
}
}
}
}
Expected API response: "SUCCESS: Message delivered"
Usage Scenarios
File Storage Operations
The library automatically uses the configured storage provider based on the StorageType setting:
Upload a file: Files are automatically routed to AWS S3, FTP, or local storage based on configuration
Download a file: Retrieve files from the configured storage provider
Generate shared link: Create temporary links with automatic expiry based on SharedLinkExpiryMinutes
Delete a file: Remove files from the configured storage backend
SMS Operations
Send OTP: The library uses the OTPMessage template to format one-time passwords
Send notifications: Send SMS messages through the configured provider
Custom parameters: The library maps your provider's parameter names using the configuration settings
Response validation: Automatically validates success/failure based on SuccessCriteria and ErrorCriteria
Email Operations
Send emails: SMTP integration with attachment support
Generate signatures: Professional email signature generation
HTML/Plain text: Support for both formats with template support
Encryption & Security
Encrypt data: Uses the configured EXPIRY_IV_KEY for secure encryption
Generate tokens: JWT token generation with configurable expiry
Shared links: Time-based security for temporary file access
Project Structure
CojectCore.Helper/
├── API/
│ └── APIHelper.cs
├── EmailManager/
│ ├── Entity/
│ ├── Interface/
│ └── Service/
├── FileSignatures/
│ ├── Abstract/
│ ├── Formats/
│ ├── Interface/
│ └── Service/
├── FilesManager/
│ ├── Entity/
│ ├── Interface/
│ └── Service/
│ ├── CojectFileControllerHelper.cs
│ ├── CojectFileManager.cs
│ ├── CojectFileManagerAWS.cs
│ ├── CojectFileManagerFTP.cs
│ └── CojectFileManagerHelper.cs
├── BarcodeHelper.cs
├── DateHelper.cs
├── EncryptionHelper.cs
├── FileHelper.cs
├── ImageHelper.cs
├── JsonHelper.cs
├── MapDataHelper.cs
├── SmsHelper.cs
└── StringHelper.cs
Dependencies
This package includes the following key dependencies:
- AWSSDK.S3 (v3.7.406.2) - Amazon S3 integration
- MailKit (v4.8.0) - Email operations
- MimeKit (v4.8.0) - MIME message handling
- Newtonsoft.Json (v13.0.3) - JSON serialization
- System.IdentityModel.Tokens.Jwt (v8.2.1) - JWT token handling
- ZXing.Net.Mobile (v2.4.1) - Barcode generation
- System.Drawing.Common (v9.0.0) - Image processing
- System.Data.SQLite (v1.0.119) - Database operations
- Coject.Core.Controller - Core controller functionality
- Coject.Core.Model - Data models
Best Practices
Security
- Never hardcode credentials: Always use configuration files or environment variables
- Secure configuration: Encrypt sensitive sections in production using .NET configuration encryption
- IV Key rotation: Regularly rotate the
EXPIRY_IV_KEYfor enhanced security - Shared link expiry: Set appropriate
SharedLinkExpiryMinutesbased on your security requirements
Storage Configuration
- Choose the right provider: AWS S3 for scalability, FTP for legacy systems, Local for development
- Test connectivity: Verify storage provider credentials before deployment
- Backup strategy: Implement proper backup procedures for your chosen storage type
SMS Configuration
- Provider compatibility: Ensure parameter names match your SMS gateway's API
- Response validation: Test both success and error scenarios with your provider
- URL encoding: Enable
UrlEncodeParametersif your provider requires encoded values - Timeout settings: Adjust
TimeoutSecondsbased on provider response times - Message templates: Customize
OTPMessageto match your application's branding
Performance
- Async operations: The library uses async methods for all I/O operations
- Connection pooling: Reuse connections when possible
- Error handling: Implement proper try-catch blocks for network operations
- Resource disposal: Ensure proper disposal of streams and connections
Troubleshooting
Storage Issues
AWS S3 Connection Fails
- Verify
KeyandSecretKeyare correct - Ensure bucket exists and has proper permissions
- Check IAM policies for S3 access
FTP Connection Fails
- Verify server URL includes protocol (ftp:// or ftps://)
- Check username and password
- Ensure firewall allows FTP connections
SMS Issues
Messages Not Sending
- Verify
BaseUrlandSendPathare correct - Check SMS provider credentials
- Ensure parameter names match provider's API
Success/Error Not Detected
- Review provider's response format
- Adjust
SuccessCriteria.Typeto match response (json/string) - Verify property names and values are correct
Shared Link Issues
Links Expire Too Quickly
- Increase
SharedLinkExpiryMinutesvalue - Check server time synchronization
Encryption Errors
- Ensure
EXPIRY_IV_KEYis valid Base64 string - Verify key hasn't been modified or corrupted
Versioning
This package follows Semantic Versioning (SemVer). Current version: 1.0.36
Support
For issues, feature requests, or contributions, please contact the development team at Akwad Arabia.
License
Copyright © Akwad Al-Arabia 2024. All rights reserved.
See LICENSE.txt for detailed license information.
Authors
Developed and maintained by Akwad Arabia
Part of the Coject Core ecosystem
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- AWSSDK.Core (>= 3.7.400.53)
- AWSSDK.S3 (>= 3.7.406.2)
- Coject.Core.Controller (>= 1.1.19)
- Coject.Core.Model (>= 1.0.31)
- MailKit (>= 4.8.0)
- Microsoft.AspNetCore.Mvc (>= 2.2.0)
- Microsoft.Extensions.Caching.Memory (>= 9.0.0)
- Microsoft.IdentityModel.Tokens (>= 8.2.1)
- MimeKit (>= 4.8.0)
- Newtonsoft.Json (>= 13.0.3)
- OpenMcdf (>= 2.4.0)
- System.Data.SQLite (>= 1.0.119)
- System.Data.SQLite.Core (>= 1.0.119)
- System.Data.SQLite.EF6 (>= 1.0.119)
- System.Drawing.Common (>= 9.0.0)
- System.IdentityModel.Tokens.Jwt (>= 8.2.1)
- System.Net.Http (>= 4.3.4)
- System.Security.Cryptography.Xml (>= 9.0.0)
- System.Text.Encodings.Web (>= 9.0.0)
- System.Text.Json (>= 9.0.0)
- System.Text.RegularExpressions (>= 4.3.1)
- ZXing.Net.Mobile (>= 2.4.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.40 | 180 | 12/21/2025 |
| 1.0.39 | 132 | 12/13/2025 |
| 1.0.38 | 102 | 12/13/2025 |
| 1.0.37 | 411 | 12/11/2025 |
| 1.0.36 | 416 | 12/11/2025 |
| 1.0.35 | 428 | 12/9/2025 |
| 1.0.34 | 432 | 12/9/2025 |
| 1.0.33 | 424 | 12/9/2025 |
| 1.0.32 | 425 | 12/9/2025 |
| 1.0.31 | 344 | 12/8/2025 |
| 1.0.30 | 332 | 12/8/2025 |
| 1.0.29 | 349 | 12/8/2025 |
| 1.0.28 | 344 | 12/8/2025 |
| 1.0.27 | 332 | 12/8/2025 |
| 1.0.26 | 345 | 12/8/2025 |
| 1.0.25 | 210 | 12/7/2025 |
| 1.0.24 | 208 | 12/7/2025 |
| 1.0.23 | 207 | 12/7/2025 |
| 1.0.22 | 207 | 12/7/2025 |
| 1.0.21 | 209 | 12/7/2025 |
| 1.0.20 | 206 | 12/7/2025 |
| 1.0.19 | 199 | 12/4/2025 |
| 1.0.17 | 190 | 12/4/2025 |
| 1.0.16 | 192 | 12/4/2025 |
| 1.0.15 | 656 | 12/3/2025 |
| 1.0.14 | 659 | 12/3/2025 |
| 1.0.13 | 668 | 12/3/2025 |
| 1.0.12 | 667 | 12/3/2025 |
| 1.0.11 | 654 | 12/3/2025 |
| 1.0.10 | 662 | 12/3/2025 |
| 1.0.8 | 218 | 4/8/2025 |
| 1.0.7 | 145 | 12/3/2024 |
| 1.0.6 | 170 | 11/18/2024 |
| 1.0.5 | 155 | 11/18/2024 |
| 1.0.4 | 157 | 11/18/2024 |