-
-
Notifications
You must be signed in to change notification settings - Fork 115
Separate additional fields by ":" instead of ": " #707
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
base: master
Are you sure you want to change the base?
Separate additional fields by ":" instead of ": " #707
Conversation
SimplyDanny
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your reasoning makes sense to me.
Looks like this can be changed without breaking existing password files. However, you need to make sure that splitting only happens on the first colon (subsequent ones might be parts of values).
passKit/Parser/Parser.swift
Outdated
| var key: String? | ||
| var value = "" | ||
| if items.count == 1 || (items[0].isEmpty && items[1].isEmpty) { | ||
| // No ': ' found, or empty on both sides of ': '. | ||
| value = line | ||
| // "otpauth" special case | ||
| if value.hasPrefix(Constants.OTPAUTH_URL_START) { | ||
| key = Constants.OTPAUTH | ||
| } | ||
| } else { | ||
| if !items[0].isEmpty { | ||
| key = items[0] | ||
| } | ||
| value = items[1] | ||
| } | ||
| return (key, value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This parts needs adaptions as well. otpauth is now already covered by the initial split. We'd also need test cases.
fff40a4 to
a610a4f
Compare
a610a4f to
849f4f5
Compare
|
Pushed an update that only splits on the first occurrence of |
|
Tests are failing. Please check them out. |
In a pass file, additional key-value pairs are supposed to be stored separated by a single semicolon
:.This is to allow simple command line interoperability, like in the following case:
The OTP authorization key is already working as intended, as it can be seen from the screenshot below. All additional fields should be recognized with the simpler

:separator, instead of the current:one containing a whitespace.