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

Add Options to export Token Secrets #4

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

OWL4C
Copy link

@OWL4C OWL4C commented Sep 14, 2024

This is an experimental pr to address #3
Currently, it just introduces the option to copy the token secret to clipboard:
Screenshot 2024-09-14 at 18 18 26

Until this can be implemented in production, there needs to be some access control, basically using the Apple "User Authentication" through Biometrics/Password.
I am not an Apple / Objective-C developer, so i have no idea how to properly implement this, however i have found the Apple Docs for the required functions:
https://developer.apple.com/documentation/localauthentication/logging-a-user-into-your-app-with-face-id-or-touch-id and
https://developer.apple.com/documentation/localauthentication/lapolicy/deviceownerauthentication specifically.
The proposed flow is: Upon clicking the extract function, the function is called, the User authenticates, and a flag is set to keep the user authenticated either until the app is closed, or a certain amount of time passes. I don't know if macos works natively with that function or some other way to authenticate is needed for the mac app.

I am not concerned with creating QR Codes, but technically that should be easy enough to implement, provided there is a function / library to create them, the data should be possible to recreate.

@OWL4C
Copy link
Author

OWL4C commented Sep 14, 2024

I actually got QR Codes working too, however since i have no experience with UI, it can currently only be copied to clipboard, either as image data, or as image file.
Also i moved the new options below the separator and the "Add to System" Option, to split it up more sensibly.

}

- (NSString *)qrString:(NSArray *)input {
return [NSString stringWithFormat: @"otpauth://totp/%@:%@?secret=%@&issuer=%@", input[0],input[1],self.secret,input[0]];
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is currently implemented in

return [self _urlForScheme:@"otpauth"];


@implementation OTQRCreatorService

+ (CIImage *)generateQRCodeImageFromString:(NSString *)string {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is implemented in

- (CIImage *)codeImageForData:(NSData *)data {

Copy link
Owner

@leptos-null leptos-null left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your thoughts and contributions on this!

Sorry for some of the overhead - some of the code in the second commit is already implemented in this repo.

@OWL4C
Copy link
Author

OWL4C commented Sep 16, 2024

Probably for the best, as i said, i just hacked together what i found in docs / web.
As i see it, only a popup for the qr code and the authentication are missing, the rest i could adapt to the current implementation.

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