Skip to content

Generate SSH key on the device - #962

Closed
amberin wants to merge 9 commits into
orgzly:masterfrom
amberin:ssh-key-generation-pr
Closed

Generate SSH key on the device#962
amberin wants to merge 9 commits into
orgzly:masterfrom
amberin:ssh-key-generation-pr

Conversation

@amberin

@amberin amberin commented Aug 31, 2022

Copy link
Copy Markdown
Contributor

N. B. This is built on top of #948.

Also contains some general minor polish of the Git-related code.

amberin and others added 9 commits August 31, 2022 07:24
N.B. Requires API >= 26.

Apache MINA SSHD is now the standard SSH transport library for JGit. It
supports more modern key algorithms than Jsch.

I have added a notification prompt to the user upon new or unexpected SSH
server host key. I have no idea what I'm doing, but it seems to work.
A generated key can optionally be protected by biometric auth or device
credential. This makes it harder to steal, but will obviously not play
well with auto-sync.

The default key type is EDCSA. ED25519 keys are faster, but not
supported natively by the Android key store. The methods currently
called when unlocking a ED25519 key do not respect the validity duration
setting, which means that the key needs to be unlocked before each use.
This may be twice during a sync, if we need to both fetch and push. RSA
and EDCSA keys respect the validity duration setting, meaning we leave
them unlocked for 15 seconds.

A way to speed up Git syncing while requiring auth upon each key use
would be to use SSH multiplexing and keep the SSH session open until we
push (or decide not to push).

N.B. Much of this code has been taken and re-worked from
https://github.com/android-password-store/Android-Password-Store. That
project is also GPL-3.0, but I don't know how to properly attribute
those authors in the Orgzly code base.
- Make "git push" run blocking. Mostly to make the "syncing in progress"
status information more reliable.
- Show more informative snackbar when "git push" goes wrong. The user
will now find out if pushing fails because of e.g. missing write
permission.
- Remove two unused methods and an unused return value.
- Tidy up some variables.
The TransportException class path was wrong, so the exception type was
not being recognized.

Make an attempt to find the cause if JGit throws the generic "remote
hung up unexpectedly" exception.
We were always ending up in RepoCloneTask.

Separate two different error cases, so that we can actually distinguish
between them.
Also, use more specific inputTypes.

Also, fix the branch name always showing as the default value
@amberin amberin closed this Aug 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants