Swiftpack.co - svyatoynick/GAuthSwiftParser as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by svyatoynick.
svyatoynick/GAuthSwiftParser 1.0.2
Get all the data from the Google Authenticator export data link in one line in Swift.
⭐️ 0
🕓 1 week ago
iOS watchOS tvOS
.package(url: "https://github.com/svyatoynick/GAuthSwiftParser.git", from: "1.0.2")

Google Authenticator Export Swift Parser

Get all the data from the Google Authenticator export data link otpauth-migration://offline?data= in one line in Swift.



Swift Package Manager

You can use Swift Package Manager and specify dependency in Package.swift by adding this:

dependencies: [
    .package(url: "https://github.com/svyatoynick/GAuthSwiftParser.git", .upToNextMajor(from: "1.0.0"))


To install through CocoaPods, simply add the following line to your Podfile:

pod 'GAuthSwiftParser'

Then run pod install in the project directory to install.


Before you start, you need to get the link from the QR code to export Google Authenticator data in format: otpauth-migration://offline?data=YourData

After that we get the data from this link through the getAccounts(code: String) function:

// This is an example code, replace it with your own
let code = "otpauth-migration://offline?data=CiAKCkhlbGxvQp6tvu8SBEFsZXgaBkFtYXpvbiABKAEwAgogCgocIRIITUedUv2HEgRNYXJ5GgZHb29nbGUgASgBMAIKHwoKGekSCE1H3VL9hxIFRGFyeWEaBExvdmUgASgBMAIQARgBIAA%3D"
let data = GAuthSwiftParser.getAccounts(code: code)

After that you can work with data, an array of the class AccountModel that contains 3 parameters: name, issuer andsecret. Also available is the getLink() function, through which you can get an OTP link from the received data.


GAuthSwiftParser is available under the MIT license. See the LICENSE file for more info.


GAuthSwiftParser depends on the following open-source projects:


Stars: 0
Last commit: 1 week ago
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

1 week ago

Fixed access level.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics