Skip to content

Commit

Permalink
Merge pull request #7 from exonet/laravel-meta-fix
Browse files Browse the repository at this point in the history
Fix ‘getMeta’ keys
  • Loading branch information
petervmeijgaard authored Oct 3, 2018
2 parents 19f09e7 + ecadf43 commit 719bfb4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ All notable changes to `securemessage` will be documented in this file.
Updates should follow the [Keep a CHANGELOG](http://keepachangelog.com/) principles.

## Unreleased
[Compare v0.1.1 - Unreleased](https://github.com/exonet/securemessage/compare/v0.1.1...develop)
[Compare v0.1.2 - Unreleased](https://github.com/exonet/securemessage/compare/v0.1.2...develop)

## [v0.1.2](https://github.com/exonet/securemessage/releases/tag/v0.1.2) - 2018-10-03
[Compare v0.1.1 - v0.1.2](https://github.com/exonet/securemessage/compare/v0.1.1...v0.1.2)

### Fixed
- When using the 'getMeta' function of the Laravel adapter the keys are now set correctly.

## [v0.1.1](https://github.com/exonet/securemessage/releases/tag/v0.1.1) - 2018-07-25
[Compare v0.1.0 - v0.1.1](https://github.com/exonet/securemessage/compare/v0.1.0...v0.1.1)
Expand Down
9 changes: 9 additions & 0 deletions src/Laravel/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,17 @@ public function getMeta(string $secureMessageId) : SecureMessage
// Build the SecureMessage as required by the Crypto utility, but only with the data for decrypting the meta.
$secureMessage = new SecureMessage();
$secureMessage->setId($record->id);
$secureMessage->setDatabaseKey($this->laravelEncryption->decrypt($record->key));
$secureMessage->setEncryptedMeta($this->laravelEncryption->decrypt($record->meta));

// Check if the storage key file exists.
if (!$this->storage->exists($record->id)) {
throw new DecryptException('Can not find key file.');
}

// Read and set the storage key.
$secureMessage->setStorageKey($this->laravelEncryption->decrypt($this->storage->get($record->id)));

// Decrypt the meta data.
$meta = $this->secureMessageFactory->decryptMeta($secureMessage);

Expand Down

0 comments on commit 719bfb4

Please sign in to comment.