diff options
author | Lukas Reschke <lukas@statuscode.ch> | 2016-11-17 17:35:14 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-11-21 11:30:00 +0100 |
commit | 6f4cb12be2d026c45237359e2b0eea2266b86bdf (patch) | |
tree | a8832d88f2f4a7c47ed3411bb90023c0168e28c0 /lib | |
parent | 53c8391e9691ac9eb92adf5b80436f5065944a1f (diff) | |
download | nextcloud-server-6f4cb12be2d026c45237359e2b0eea2266b86bdf.tar.gz nextcloud-server-6f4cb12be2d026c45237359e2b0eea2266b86bdf.zip |
Add identity proof
Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Security/IdentityProof/Manager.php | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/private/Security/IdentityProof/Manager.php b/lib/private/Security/IdentityProof/Manager.php index b3dba5f278f..223af05410b 100644 --- a/lib/private/Security/IdentityProof/Manager.php +++ b/lib/private/Security/IdentityProof/Manager.php @@ -22,13 +22,12 @@ namespace OC\Security\IdentityProof; use OCP\Files\IAppData; -use OCP\Files\SimpleFS\ISimpleFolder; use OCP\IUser; use OCP\Security\ICrypto; class Manager { - /** @var ISimpleFolder */ - private $folder; + /** @var IAppData */ + private $appData; /** @var ICrypto */ private $crypto; @@ -38,7 +37,7 @@ class Manager { */ public function __construct(IAppData $appData, ICrypto $crypto) { - $this->folder = $appData->getFolder('identityproof'); + $this->appData = $appData; $this->crypto = $crypto; } @@ -64,9 +63,9 @@ class Manager { $publicKey = $publicKey['key']; // Write the private and public key to the disk - $this->folder->newFile($user->getUID() . '.private') + $this->appData->getFolder($user->getUID())->newFile('private') ->putContent($this->crypto->encrypt($privateKey)); - $this->folder->newFile($user->getUID() . '.public') + $this->appData->getFolder($user->getUID())->newFile('public') ->putContent($publicKey); return new Key($publicKey, $privateKey); @@ -80,8 +79,8 @@ class Manager { */ public function getKey(IUser $user) { try { - $privateKey = $this->crypto->decrypt($this->folder->getFile($user->getUID() . '.private')->getContent()); - $publicKey = $this->folder->getFile($user->getUID() . '.public')->getContent(); + $privateKey = $this->crypto->decrypt($this->appData->getFolder($user->getUID())->getFile('private')->getContent()); + $publicKey = $this->appData->getFolder($user->getUID())->getFile('public')->getContent(); return new Key($publicKey, $privateKey); } catch (\Exception $e) { return $this->generateKey($user); |