|
1 | 1 | <script setup lang="ts"> |
2 | 2 | definePageMeta({ layout: "website" }); |
| 3 | +
|
3 | 4 | useHead({ |
4 | | - title: "How to Add End-to-End Encryption to SMS Messages - httpSMS", |
| 5 | + title: "End-to-End Encryption to SMS Messages - httpSMS", |
5 | 6 | }); |
6 | 7 | </script> |
7 | 8 |
|
8 | 9 | <template> |
9 | 10 | <VContainer> |
10 | 11 | <VRow> |
11 | 12 | <VCol cols="12" md="8" offset-md="2"> |
12 | | - <h1 class="text-h3 mb-2"> |
13 | | - How to Add End-to-End Encryption to SMS Messages |
| 13 | + <h1 class="text-display-small mb-2"> |
| 14 | + End-to-End Encryption to SMS Messages |
14 | 15 | </h1> |
15 | | - <BlogInfo date="September 15, 2023" read-time="5 min read" /> |
| 16 | + <BlogInfo date="January 21, 2024" read-time="10 min read" /> |
16 | 17 | <VDivider class="my-6" /> |
17 | | - <p class="text-body-1 mb-4"> |
18 | | - Privacy is fundamental. With httpSMS, you can add end-to-end |
19 | | - encryption to your SMS messages using military-grade AES-256 |
20 | | - encryption. This ensures that only you and the intended recipient can |
21 | | - read the message content. |
| 18 | + |
| 19 | + <p class="text-body-large mb-6"> |
| 20 | + We have added support for end-to-end encryption for SMS messages so |
| 21 | + that no one can see the content of the messages you send using httpSMS |
| 22 | + except you. You setup an encryption key which you use to encrypt your |
| 23 | + messages before making an API request to httpSMS and you also use the |
| 24 | + same key to decrypt the messages you receive from httpSMS via our |
| 25 | + webhook events. We are using the AES 256 encryption algorithm to |
| 26 | + encrypt and decrypt the messages. |
22 | 27 | </p> |
23 | | - <h2 class="text-h5 mt-6 mb-3">How It Works</h2> |
24 | | - <p class="text-body-1 mb-4"> |
25 | | - When you enable encryption in the httpSMS Android app, all messages |
26 | | - are encrypted before being sent. The encryption key is derived from a |
27 | | - passphrase that you set in the app settings. Both sender and receiver |
28 | | - must use the same passphrase. |
| 28 | + |
| 29 | + <h2 class="text-headline-medium mb-4">Setup your encryption key</h2> |
| 30 | + <p class="text-body-large mb-6"> |
| 31 | + Download and install the httpSMS Android app on your phone and set |
| 32 | + your encryption key under the App Settings page of the app. |
| 33 | + <a |
| 34 | + href="https://github.com/NdoleStudio/httpsms/releases/latest/download/HttpSms.apk" |
| 35 | + target="_blank" |
| 36 | + rel="noopener" |
| 37 | + >Download the Android app</a |
| 38 | + >. |
| 39 | + </p> |
| 40 | + |
| 41 | + <h2 class="text-headline-medium mb-4">Encrypt your SMS message</h2> |
| 42 | + <p class="text-body-large mb-4"> |
| 43 | + We are using AES-256 to encrypt your SMS messages. The encryption key |
| 44 | + is hashed with SHA-256 before use and the initialization vector (IV) |
| 45 | + is generated for each message. The IV is appended to the encrypted |
| 46 | + payload before the final value is base64 encoded. |
29 | 47 | </p> |
30 | | - <h2 class="text-h5 mt-6 mb-3">Setup Steps</h2> |
31 | | - <ol class="ml-6 mb-4"> |
32 | | - <li class="mb-2">Open the httpSMS app on your Android phone</li> |
33 | | - <li class="mb-2">Go to Settings → Encryption</li> |
34 | | - <li class="mb-2">Enable encryption and set your passphrase</li> |
35 | | - <li class="mb-2">Share the passphrase securely with the recipient</li> |
36 | | - <li class="mb-2"> |
37 | | - The recipient enables encryption with the same passphrase |
38 | | - </li> |
39 | | - </ol> |
40 | | - <p class="text-body-1 mb-4"> |
41 | | - Messages are encrypted using AES-256 in CFB mode with a SHA-256 |
42 | | - derived key. The encryption happens on-device before the message is |
43 | | - sent to the httpSMS API. |
| 48 | + <pre |
| 49 | + class="pa-4 mb-6 rounded bg-surface-variant overflow-x-auto" |
| 50 | + ><code class="language-javascript text-body-medium">import HttpSms from "httpsms" |
| 51 | + |
| 52 | +const client = new HttpSms("" /* API Key from https://httpsms.com/settings */) |
| 53 | + |
| 54 | +const key = "Password123" |
| 55 | + |
| 56 | +const encryptedMessage = client.cipher.encrypt(key, "This is a sample text message") |
| 57 | + |
| 58 | +// The encrypted message looks like this |
| 59 | +// Qk3XGN5+Ax38Ig01m4AqaP6Y0b0wYpCXtx59sU23uVLWUU/c7axF7LozDg==</code></pre> |
| 60 | + |
| 61 | + <h2 class="text-headline-medium mb-4">Send an encrypted message</h2> |
| 62 | + <p class="text-body-large mb-4"> |
| 63 | + Once you have encrypted the content, send it to the API with |
| 64 | + <code>encrypted: true</code>. This flag tells the Android app to |
| 65 | + decrypt the message before sending it to the recipient. |
44 | 66 | </p> |
| 67 | + <pre |
| 68 | + class="pa-4 mb-6 rounded bg-surface-variant overflow-x-auto" |
| 69 | + ><code class="language-javascript text-body-medium">import HttpSms from "httpsms" |
| 70 | + |
| 71 | +client.messages.postSend({ |
| 72 | + content: encryptedMessage, |
| 73 | + from: '+18005550199', |
| 74 | + encrypted: true, |
| 75 | + to: '+18005550100', |
| 76 | +}) |
| 77 | +.then((message) => { |
| 78 | + console.log(message.id) // log the ID of the sent message |
| 79 | +})</code></pre> |
| 80 | + |
| 81 | + <h2 class="text-headline-medium mb-4"> |
| 82 | + Receiving an encrypted message |
| 83 | + </h2> |
| 84 | + <p class="text-body-large mb-4"> |
| 85 | + When your Android phone receives an SMS message, the app encrypts the |
| 86 | + message with the encryption key configured on the phone before |
| 87 | + delivering it to your webhook endpoint. |
| 88 | + </p> |
| 89 | + <pre |
| 90 | + class="pa-4 mb-6 rounded bg-surface-variant overflow-x-auto" |
| 91 | + ><code class="language-json text-body-medium">{ |
| 92 | + "event": "message.phone.received", |
| 93 | + "data": { |
| 94 | + "content": "bdmZ7n6JVf/ST+SoNlSaOGUL1DcL5705ETw8GAB4llYBgE9HOOL+Pu/h+w==", |
| 95 | + "encrypted": true, |
| 96 | + "from": "+18005550100", |
| 97 | + "id": "msg_123", |
| 98 | + "to": "+18005550199" |
| 99 | + } |
| 100 | +}</code></pre> |
| 101 | + <pre |
| 102 | + class="pa-4 mb-6 rounded bg-surface-variant overflow-x-auto" |
| 103 | + ><code class="language-javascript text-body-medium">import HttpSms from "httpsms" |
| 104 | + |
| 105 | +const client = new HttpSms("" /* API Key from https://httpsms.com/settings */) |
| 106 | + |
| 107 | +const encryptedMessage = "bdmZ7n6JVf/ST+SoNlSaOGUL1DcL5705ETw8GAB4llYBgE9HOOL+Pu/h+w==" |
| 108 | +const encryptionkey = "Password123" |
| 109 | +const decryptedMessage = client.cipher.decrypt(encryptionkey, encryptedMessage) |
| 110 | + |
| 111 | +// This is a test text message</code></pre> |
| 112 | + |
| 113 | + <p class="text-body-large mb-6"> |
| 114 | + Congratulations, you have successfully configured your Android phone |
| 115 | + to send and receive SMS messages with end-to-end encryption. Don't |
| 116 | + hesitate to contact us if you face any problems while following this |
| 117 | + guide. |
| 118 | + </p> |
| 119 | + |
45 | 120 | <BlogAuthorBio /> |
46 | 121 | </VCol> |
47 | 122 | </VRow> |
|
0 commit comments