diff options
Diffstat (limited to 'apps/files_encryption/lib/session.php')
-rw-r--r-- | apps/files_encryption/lib/session.php | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/apps/files_encryption/lib/session.php b/apps/files_encryption/lib/session.php index 85d533fde7a..769a40b359f 100644 --- a/apps/files_encryption/lib/session.php +++ b/apps/files_encryption/lib/session.php @@ -29,11 +29,11 @@ namespace OCA\Encryption; class Session { /** - * @brief Sets user id for session and triggers emit + * @brief Sets user private key to session * @return bool * */ - public function setPrivateKey( $privateKey, $userId ) { + public function setPrivateKey( $privateKey ) { $_SESSION['privateKey'] = $privateKey; @@ -42,15 +42,15 @@ class Session { } /** - * @brief Gets user id for session and triggers emit + * @brief Gets user private key from session * @returns string $privateKey The user's plaintext private key * */ - public function getPrivateKey( $userId ) { + public function getPrivateKey() { if ( - isset( $_SESSION['privateKey'] ) - && !empty( $_SESSION['privateKey'] ) + isset( $_SESSION['privateKey'] ) + && !empty( $_SESSION['privateKey'] ) ) { return $_SESSION['privateKey']; @@ -62,5 +62,42 @@ class Session { } } + + /** + * @brief Sets user legacy key to session + * @return bool + * + */ + public function setLegacyKey( $legacyKey ) { + + if ( $_SESSION['legacyKey'] = $legacyKey ) { + + return true; + + } + + } + + /** + * @brief Gets user legacy key from session + * @returns string $legacyKey The user's plaintext legacy key + * + */ + public function getLegacyKey() { + + if ( + isset( $_SESSION['legacyKey'] ) + && !empty( $_SESSION['legacyKey'] ) + ) { + + return $_SESSION['legacyKey']; + + } else { + + return false; + + } + + } }
\ No newline at end of file |