diff options
| author | Andrej Mihajlov <and@mullvad.net> | 2017-10-11 11:42:08 +0200 |
|---|---|---|
| committer | Erik Larkö <erik@mullvad.net> | 2017-10-12 16:13:00 +0200 |
| commit | d655a3b4647e61a75bfaf9efb25ad2314ec6b5c3 (patch) | |
| tree | 7858845d2e931e29a410802c2738ba5bd26480b1 /app/lib | |
| parent | 3f2942a9a1ce1733428d72ca0e65aea2a06aca0d (diff) | |
| download | mullvadvpn-d655a3b4647e61a75bfaf9efb25ad2314ec6b5c3.tar.xz mullvadvpn-d655a3b4647e61a75bfaf9efb25ad2314ec6b5c3.zip | |
Add IPC address parser helper
Diffstat (limited to 'app/lib')
| -rw-r--r-- | app/lib/backend.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js index e159ca51df..dbb807bd9f 100644 --- a/app/lib/backend.js +++ b/app/lib/backend.js @@ -66,6 +66,23 @@ export class BackendError extends Error { } +export type IpcCredentials = { + connectionString: string, + sharedSecret: string, +}; + +export function parseIpcCredentials(data: string): ?IpcCredentials { + const [connectionString, sharedSecret] = data.split('\n', 2); + if(connectionString && sharedSecret) { + return { + connectionString, + sharedSecret, + }; + } else { + return null; + } +} + /** * Backend implementation */ |
