Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Encrypt/Decrypt Messages Throughout Conversations #74

Merged
merged 13 commits into from
Dec 4, 2016
Merged

Conversation

torch2424
Copy link
Member

@torch2424 torch2424 commented Dec 4, 2016

closes #27
closes #28
closes #64

However, this opens #72 and #73

This is the final PR to finish up the functionality of the app. This Allows users to Encrypt Messages when creating new conversations, encrypt messages when replying to a conversation, and Decrypt Messages On viewing a conversation. This is all done in observables. Also, this does tweak the backend a bit, it allows the schema for messages to work a bit better with encryption. the routes affected are conversation POST and conversation PUT. Requests and responses are tweaked to match the following schema:

Conversation POST Request Schema

Old

{
	"access_token": "EAAaib9ZAEbpUBAEUNGKjhpSQAp2BW3TJ9BleM73YXaD7YofkJxvEY1iZAzvEv6KzkgDEl565YJ6n1mjpNZBkGXGPCrHAjvZC89TipZAi8QFvfzQmUDh3NjnONIVD1prrwVxzazx1Vg5ZAgoa4GWyFobAT5lEdW9JnUiEYOmx633AZDZD",
	"message": "Hey, I can send a message to the server :^)!!",
	"members": ["5840b911de8fe11352d23869"],
	"messageKey": { 
		"5840b911de8fe11352d23869" : "312bdfjg2Efh241", 
		"5840b926de8fe11352d2386a" : "443j2h4jl13kkfH"
	}
}

New

{
	"access_token": "EAAaib9ZAEbpUBAEUNGKjhpSQAp2BW3TJ9BleM73YXaD7YofkJxvEY1iZAzvEv6KzkgDEl565YJ6n1mjpNZBkGXGPCrHAjvZC89TipZAi8QFvfzQmUDh3NjnONIVD1prrwVxzazx1Vg5ZAgoa4GWyFobAT5lEdW9JnUiEYOmx633AZDZD",
        "members": ["5840b911de8fe11352d23869"],
	"messages": {
            "5840b911de8fe11352d23869":    {
                      "message": "ENCRYPTED_AES_MESSAGE_AND_HMAC_JSON_STRINGYIFIED--jahljASLHDASLHfjasdhfoieur23ouro32jwf...",
                      "messageKey": "ENCRYPTED_AES_KEYS_WITH_PGP---BEGIN PGP MESSAGE---..."
            },
            "5840b926de8fe11352d2386a":    {
                      "message": "ENCRYPTED_AES_MESSAGE_AND_HMAC_JSON_STRINGYIFIED--j2345y65e4woieur23ouro32jwf...",
                     "messageKey": "ENCRYPTED_AES_KEYS_WITH_PGP---BEGIN PGP MESSAGE---..."
            }
        }
}

Conversation PUT Request Schema

Old

{
	"access_token": "EAAaib9ZAEbpUBAHgYpFEUZCxt3knvFqBWZAUV3cJAiDZBCRg8VxD95UNZCfqIFODPESp6EHcgJyXiQyspkZAYlby2XGgvBq2MKC5CdkStbXgZCIBDe7qHin7yu7szB14mSjSseDH0hajF9iBTjRpzrkrWekq3wlHn4ZD",
	"message": "This is a new message!",
	"messageKey": { 
		"5840b911de8fe11352d23869" : "312bdfjg2Efh241", 
		"5840b926de8fe11352d2386a" : "443j2h4jl13kkfH"
	},
	"conversationID" : "5840b911de8fe11352d23869_5840b926de8fe11352d2386a"
}

New

{
	"access_token": "EAAaib9ZAEbpUBAEUNGKjhpSQAp2BW3TJ9BleM73YXaD7YofkJxvEY1iZAzvEv6KzkgDEl565YJ6n1mjpNZBkGXGPCrHAjvZC89TipZAi8QFvfzQmUDh3NjnONIVD1prrwVxzazx1Vg5ZAgoa4GWyFobAT5lEdW9JnUiEYOmx633AZDZD",
        "members": ["5840b911de8fe11352d23869"],
        "conversationID" : "5840b911de8fe11352d23869_5840b926de8fe11352d2386a",
	"messages": {
            "5840b911de8fe11352d23869":    {
                      "message": "ENCRYPTED_AES_MESSAGE_AND_HMAC_JSON_STRINGYIFIED--jahljASLHDASLHfjasdhfoieur23ouro32jwf...",
                      "messageKey": "ENCRYPTED_AES_KEYS_WITH_PGP---BEGIN PGP MESSAGE---..."
            },
            "5840b926de8fe11352d2386a":    {
                      "message": "ENCRYPTED_AES_MESSAGE_AND_HMAC_JSON_STRINGYIFIED--j2345y65e4woieur23ouro32jwf...",
                      "messageKey": "ENCRYPTED_AES_KEYS_WITH_PGP---BEGIN PGP MESSAGE---..."
            }
        }
}

Example Gif of everything working:

untitled recording 30

@kuminin kuminin merged commit 417263d into master Dec 4, 2016
@kuminin kuminin deleted the cryptMessage branch December 4, 2016 05:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ignore Status 304 for conversations from the server Decrypt messages on recieve Encrypt Messages on send
2 participants