KeeAnywhere icon indicating copy to clipboard operation
KeeAnywhere copied to clipboard

New storage provider: Google Cloud Storage

Open TheOpalium opened this issue 3 years ago • 3 comments

This PR adds Google Cloud Storage, Google's object storage solution (in their cloud platform), as a storage provider for KeeAnywhere.
I use GCS for my projects and would love to be able to use it for KeePass, so I figured I should chip-in and help make it happen! I tried my luck with the S3-compatible method first but it didn't seem to work, hence why I decided to just implement it 'natively'.

image image

A few things to note about this implementation:

  • Unlike S3 and Azure, GCS uses a different authentication mechanism. There's no ID and Secret; instead, there's a JSON key file that contains various information, including a private key and other secrets. Since this is not the format KeeAnywhere expects, I'm keeping the entire key file JSON string as the account secret. This is the simplest way to do it without having to change the entire format of AccountConfiguration.
  • During account creation, the user is requested to simply select the key file they downloaded from GCP, and the project ID (required by the lib). This is to make the process as simple as possible.
  • Google's .NET libs use IAsyncEnumerable for their async operations. This is fine since C# 5 supports it properly, but it did require a slightly uglier implementation since the 'luxury' of using await foreach is only for C# 8 and above.

I hope this will prove useful! Please let me know if there's anything you want me to add/change/remove.
😄

TheOpalium avatar Apr 02 '21 18:04 TheOpalium

Why this is marked as a draft:
Well... I actually need a hand with testing this.

I'm not entirely sure what happened, but during development I suddenly started running into a strange problem with the Google API packages failing to load the proper version. The ol' Assembly failed to load error because of a version mismatch. Due to this, I can't continue testing my additions. What's even more strange is that despite defining binding redirects in app.config, it still doesn't seem to work. It's as if the file is being completely ignored... I tried various other solutions but I can't get it to work.

I'm kinda stuck now, so I wonder if anyone can help me figure this one out.
Please let me know!

TheOpalium avatar Apr 02 '21 18:04 TheOpalium

app.config is not used for assembly redirection. In KeeAnywhereExt.cs a method called FixDependencyLoading tries to circumvent the problems. Please try to use this or report back. I'm willing to help with this for next v2.1 Release.

Kyrodan avatar May 18 '21 09:05 Kyrodan

app.config is not used for assembly redirection. In KeeAnywhereExt.cs a method called FixDependencyLoading tries to circumvent the problems.

Thank you! That did the trick 😄 Now that this is solved, I was able to finish testing my additions and make any necessary changes. Ready to review!

KeePass_QBJwxgOP7K

Please let me know if there are any further changes or fixes required.

TheOpalium avatar May 24 '21 16:05 TheOpalium