Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generate SSH key on the device #962

Closed
wants to merge 9 commits into from
Closed

Generate SSH key on the device #962

wants to merge 9 commits into from

Conversation

amberin
Copy link
Contributor

@amberin amberin commented Aug 31, 2022

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