You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A TypeScript-first client for seamless integration with the [SMS Gateway for Android](https://sms-gate.app) API. Programmatically send SMS messages through your Android devices with strict typing and modern JavaScript features.
10
+
A TypeScript-first client for seamless integration with the [SMSGate](https://sms-gate.app) API. Programmatically send SMS messages through your Android devices with strict typing and modern JavaScript features.
11
11
12
12
**Note**: The API doesn't provide CORS headers, so the library cannot be used in a browser environment directly.
13
13
14
14
## 📖 Table of Contents
15
15
16
-
-[📱 SMS Gateway for Android™ JS/TS API Client](#-sms-gateway-for-android-jsts-api-client)
16
+
-[📱 SMSGate JS/TS API Client](#-smsgate-jsts-api-client)
17
17
-[📖 Table of Contents](#-table-of-contents)
18
+
-[🔐 Authentication](#-authentication)
19
+
-[Basic Authentication](#basic-authentication)
20
+
-[JWT Authentication](#jwt-authentication)
18
21
-[✨ Features](#-features)
19
22
-[⚙️ Requirements](#️-requirements)
20
23
-[📦 Installation](#-installation)
@@ -28,6 +31,7 @@ A TypeScript-first client for seamless integration with the [SMS Gateway for And
@@ -37,6 +41,28 @@ A TypeScript-first client for seamless integration with the [SMS Gateway for And
37
41
-[Development Setup](#development-setup)
38
42
-[📄 License](#-license)
39
43
44
+
## 🔐 Authentication
45
+
46
+
The SMSGate client supports two authentication methods: **Basic Authentication** and **JWT (JSON Web Token) Authentication**. JWT is the recommended approach for production environments due to its enhanced security features and support for scoped permissions.
47
+
48
+
### Basic Authentication
49
+
50
+
Basic Authentication uses a username and password to access the API. This method is simple but less secure for production use.
51
+
52
+
**When to use:**
53
+
- Simple integrations
54
+
- Development and testing
55
+
- Legacy systems
56
+
57
+
### JWT Authentication
58
+
59
+
JWT Authentication uses bearer tokens with configurable scopes to access the API. This method provides enhanced security and fine-grained access control.
60
+
61
+
**When to use:**
62
+
- Production environments
63
+
- Applications requiring scoped permissions
64
+
- Systems with multiple components needing different access levels
65
+
40
66
## ✨ Features
41
67
42
68
-**TypeScript Ready**: Full type definitions out of the box
@@ -73,75 +99,80 @@ bun add android-sms-gateway
73
99
```typescript
74
100
importClientfrom'android-sms-gateway';
75
101
76
-
// Create a fetch-based HTTP client
77
-
const httpFetchClient = {
78
-
get: async (url, headers) => {
79
-
const response =awaitfetch(url, {
80
-
method: "GET",
81
-
headers
82
-
});
83
-
84
-
returnresponse.json();
85
-
},
86
-
post: async (url, body, headers) => {
87
-
const response =awaitfetch(url, {
88
-
method: "POST",
89
-
headers,
90
-
body: JSON.stringify(body)
91
-
});
92
-
93
-
returnresponse.json();
94
-
},
95
-
delete: async (url, headers) => {
96
-
const response =awaitfetch(url, {
97
-
method: "DELETE",
98
-
headers
99
-
});
100
-
101
-
returnresponse.json();
102
-
}
103
-
};
104
-
105
-
// Initialize client
106
-
const api =newClient(
102
+
// First, create a client with Basic Auth to generate a JWT token
0 commit comments