-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import Google Authenticator exports - otpauth-migration string Use nuget packages to parse data and to create the plugin Parse otpauth-migration also when doing drag&drop
- Loading branch information
1 parent
c9295fa
commit 29f34b0
Showing
10 changed files
with
394 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,11 @@ | ||
@echo off | ||
set plgxnet=%1 | ||
set plgxkp=%2 | ||
set plgxos=%3 | ||
|
||
cls | ||
cd %~dp0 | ||
|
||
for %%* in (.) do set CurrDirName=%%~nx* | ||
echo Processing %CurrDirName% | ||
|
||
echo Deleting existing PlgX folder | ||
rmdir /s /q plgx | ||
|
||
echo Creating PlgX folder | ||
mkdir plgx | ||
|
||
echo Copying files | ||
xcopy src plgx /s /e /exclude:plgxexclude.txt > nul | ||
|
||
echo Compiling PlgX | ||
cd.. | ||
cd _KeePass_Release | ||
KeePass.exe --plgx-create "%~dp0plgx" plgx-prereq-net:%plgxnet% -plgx-prereq-kp:%plgxkp% -plgx-prereq-os:%plgxos% | ||
cd .. | ||
cd %CurrDirName% | ||
|
||
echo Copying PlgX to KeePass plugin folder | ||
copy plgx.plgx "..\_KeePass_Release\Plugins\%CurrDirName%.plgx" | ||
copy "src\bin\Release\%CurrDirName%.plgx" "..\_KeePass_Release\Plugins\%CurrDirName%.plgx" | ||
|
||
echo Releasing PlgX | ||
move /y plgx.plgx "..\_Releases\%CurrDirName%.plgx" | ||
|
||
echo Cleaning up | ||
rmdir /s /q plgx | ||
|
||
echo Compiled with following minimum requirements: | ||
echo .NET = %plgxnet% | ||
echo KeePass = %plgxkp% | ||
echo OS = %plgxos% | ||
move /y "src\bin\Release\%CurrDirName%.plgx" "..\_Releases\%CurrDirName%.plgx" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
syntax = "proto3"; | ||
package KeePassOTP; | ||
|
||
message GoogleAuthenticatorImport { | ||
enum Algorithm { | ||
ALGORITHM_UNSPECIFIED = 0; | ||
ALGORITHM_SHA1 = 1; | ||
ALGORITHM_SHA256 = 2; | ||
ALGORITHM_SHA512 = 3; | ||
ALGORITHM_MD5 = 4; | ||
} | ||
enum DigitCount { | ||
DIGIT_COUNT_UNSPECIFIED = 0; | ||
DIGIT_COUNT_SIX = 1; | ||
DIGIT_COUNT_EIGHT = 2; | ||
} | ||
enum OtpType { | ||
OTP_TYPE_UNSPECIFIED = 0; | ||
OTP_TYPE_HOTP = 1; | ||
OTP_TYPE_TOTP = 2; | ||
} | ||
message OtpParameters { | ||
bytes secret = 1; | ||
string name = 2; | ||
string issuer = 3; | ||
Algorithm algorithm = 4; | ||
DigitCount digits = 5; | ||
OtpType type = 6; | ||
int64 counter = 7; | ||
} | ||
repeated OtpParameters otp_parameters = 1; | ||
int32 version = 2; | ||
int32 batch_size = 3; | ||
int32 batch_index = 4; | ||
int32 batch_id = 5; | ||
} |
127 changes: 127 additions & 0 deletions
127
src/GoogleAuthenticatorImport/GoogleAuthenticatorImport.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
// <auto-generated> | ||
// This file was generated by a tool; you should avoid making direct changes. | ||
// Consider using 'partial classes' to extend these types | ||
// Input: my.proto | ||
// </auto-generated> | ||
|
||
#region Designer generated code | ||
#pragma warning disable 0612, 0618, 1591, 3021 | ||
namespace KeePassOTP | ||
{ | ||
|
||
[global::ProtoBuf.ProtoContract()] | ||
public partial class GoogleAuthenticatorImport : global::ProtoBuf.IExtensible | ||
{ | ||
private global::ProtoBuf.IExtension __pbn__extensionData; | ||
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) | ||
{ | ||
return global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing); | ||
} | ||
public GoogleAuthenticatorImport() | ||
{ | ||
otp_parameters = new global::System.Collections.Generic.List<OtpParameters>(); | ||
OnConstructor(); | ||
} | ||
|
||
partial void OnConstructor(); | ||
|
||
[global::ProtoBuf.ProtoMember(1)] | ||
public global::System.Collections.Generic.List<OtpParameters> otp_parameters { get; set; } | ||
|
||
[global::ProtoBuf.ProtoMember(2, Name = @"version")] | ||
public int Version { get; set; } | ||
|
||
[global::ProtoBuf.ProtoMember(3, Name = @"batch_size")] | ||
public int BatchSize { get; set; } | ||
|
||
[global::ProtoBuf.ProtoMember(4, Name = @"batch_index")] | ||
public int BatchIndex { get; set; } | ||
|
||
[global::ProtoBuf.ProtoMember(5, Name = @"batch_id")] | ||
public int BatchId { get; set; } | ||
|
||
[global::ProtoBuf.ProtoContract()] | ||
public partial class OtpParameters : global::ProtoBuf.IExtensible | ||
{ | ||
private global::ProtoBuf.IExtension __pbn__extensionData; | ||
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing) | ||
{ | ||
return global::ProtoBuf.Extensible.GetExtensionObject(ref __pbn__extensionData, createIfMissing); | ||
} | ||
public OtpParameters() | ||
{ | ||
Name = ""; | ||
Issuer = ""; | ||
OnConstructor(); | ||
} | ||
|
||
partial void OnConstructor(); | ||
|
||
[global::ProtoBuf.ProtoMember(1, Name = @"secret")] | ||
public byte[] Secret { get; set; } | ||
|
||
[global::ProtoBuf.ProtoMember(2, Name = @"name")] | ||
[global::System.ComponentModel.DefaultValue("")] | ||
public string Name { get; set; } | ||
|
||
[global::ProtoBuf.ProtoMember(3, Name = @"issuer")] | ||
[global::System.ComponentModel.DefaultValue("")] | ||
public string Issuer { get; set; } | ||
|
||
[global::ProtoBuf.ProtoMember(4, Name = @"algorithm")] | ||
public GoogleAuthenticatorImport.Algorithm Algorithm { get; set; } | ||
|
||
[global::ProtoBuf.ProtoMember(5, Name = @"digits")] | ||
public GoogleAuthenticatorImport.DigitCount Digits { get; set; } | ||
|
||
[global::ProtoBuf.ProtoMember(6, Name = @"type")] | ||
public GoogleAuthenticatorImport.OtpType Type { get; set; } | ||
|
||
[global::ProtoBuf.ProtoMember(7, Name = @"counter")] | ||
public long Counter { get; set; } | ||
|
||
} | ||
|
||
[global::ProtoBuf.ProtoContract()] | ||
public enum Algorithm | ||
{ | ||
[global::ProtoBuf.ProtoEnum(Name = @"ALGORITHM_UNSPECIFIED")] | ||
AlgorithmUnspecified = 0, | ||
[global::ProtoBuf.ProtoEnum(Name = @"ALGORITHM_SHA1")] | ||
AlgorithmSha1 = 1, | ||
[global::ProtoBuf.ProtoEnum(Name = @"ALGORITHM_SHA256")] | ||
AlgorithmSha256 = 2, | ||
[global::ProtoBuf.ProtoEnum(Name = @"ALGORITHM_SHA512")] | ||
AlgorithmSha512 = 3, | ||
[global::ProtoBuf.ProtoEnum(Name = @"ALGORITHM_MD5")] | ||
AlgorithmMd5 = 4, | ||
} | ||
|
||
[global::ProtoBuf.ProtoContract()] | ||
public enum DigitCount | ||
{ | ||
[global::ProtoBuf.ProtoEnum(Name = @"DIGIT_COUNT_UNSPECIFIED")] | ||
DigitCountUnspecified = 0, | ||
[global::ProtoBuf.ProtoEnum(Name = @"DIGIT_COUNT_SIX")] | ||
DigitCountSix = 1, | ||
[global::ProtoBuf.ProtoEnum(Name = @"DIGIT_COUNT_EIGHT")] | ||
DigitCountEight = 2, | ||
} | ||
|
||
[global::ProtoBuf.ProtoContract()] | ||
public enum OtpType | ||
{ | ||
[global::ProtoBuf.ProtoEnum(Name = @"OTP_TYPE_UNSPECIFIED")] | ||
OtpTypeUnspecified = 0, | ||
[global::ProtoBuf.ProtoEnum(Name = @"OTP_TYPE_HOTP")] | ||
OtpTypeHotp = 1, | ||
[global::ProtoBuf.ProtoEnum(Name = @"OTP_TYPE_TOTP")] | ||
OtpTypeTotp = 2, | ||
} | ||
|
||
} | ||
|
||
} | ||
|
||
#pragma warning restore 0612, 0618, 1591, 3021 | ||
#endregion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.