Add filename and time properties to message (#85)

* Add filename and time properties to message

* Message time defaults to current time
This commit is contained in:
wussler 2020-10-12 18:45:57 +02:00 committed by GitHub
parent 7de8833ff6
commit a4d89bce32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 134 additions and 51 deletions

View file

@ -42,9 +42,9 @@ func TestAttachmentSetKey(t *testing.T) {
func TestAttachmentEncryptDecrypt(t *testing.T) {
var testAttachmentCleartext = "cc,\ndille."
var message = NewPlainMessage([]byte(testAttachmentCleartext))
var message = NewPlainMessageFromFile([]byte(testAttachmentCleartext), "test.txt", 1602518992)
encSplit, err := keyRingTestPrivate.EncryptAttachment(message, "s.txt")
encSplit, err := keyRingTestPrivate.EncryptAttachment(message, "")
if err != nil {
t.Fatal("Expected no error while encrypting attachment, got:", err)
}
@ -59,9 +59,9 @@ func TestAttachmentEncryptDecrypt(t *testing.T) {
func TestAttachmentEncrypt(t *testing.T) {
var testAttachmentCleartext = "cc,\ndille."
var message = NewPlainMessage([]byte(testAttachmentCleartext))
var message = NewPlainMessageFromFile([]byte(testAttachmentCleartext), "test.txt", 1602518992)
encSplit, err := keyRingTestPrivate.EncryptAttachment(message, "s.txt")
encSplit, err := keyRingTestPrivate.EncryptAttachment(message, "")
if err != nil {
t.Fatal("Expected no error while encrypting attachment, got:", err)
}
@ -78,7 +78,7 @@ func TestAttachmentEncrypt(t *testing.T) {
func TestAttachmentDecrypt(t *testing.T) {
var testAttachmentCleartext = "cc,\ndille."
var message = NewPlainMessage([]byte(testAttachmentCleartext))
var message = NewPlainMessageFromFile([]byte(testAttachmentCleartext), "test.txt", 1602518992)
encrypted, err := keyRingTestPrivate.Encrypt(message, nil)
if err != nil {