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

Remove ref and unused method #136

Merged
merged 1 commit into from
Apr 25, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 1 addition & 21 deletions KeeTrayTOTP/Libraries/TOTPProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public int Length
/// <summary>
/// Instantiate a new TOTP_Generator.
/// </summary>
public TOTPProvider(string[] settings, ref TimeCorrectionCollection tcc)
public TOTPProvider(string[] settings, TimeCorrectionCollection tcc)
{
this._duration = Convert.ToInt16(settings[0]);

Expand Down Expand Up @@ -138,26 +138,6 @@ public long Counter
}
}

/// <summary>
/// Converts an unsigned integer to binary data.
/// </summary>
/// <param name="n">Unsigned Integer.</param>
/// <returns>Binary data.</returns>
private byte[] GetBytes(ulong n)
{
byte[] b = new byte[8];
b[0] = (byte)(n >> 56);
b[1] = (byte)(n >> 48);
b[2] = (byte)(n >> 40);
b[3] = (byte)(n >> 32);
b[4] = (byte)(n >> 24);
b[5] = (byte)(n >> 16);
b[6] = (byte)(n >> 8);
b[7] = (byte)n;

return b;
}

/// <summary>
/// Generate a TOTP using provided binary data.
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion KeeTrayTOTP/TrayTOTP_ColumnProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ private static string GetInnerValueStatus(PwEntry entry)
private string GetInnerValueCode(PwEntry entry)
{
string[] settings = _plugin.SettingsGet(entry);
var totpGenerator = new TOTPProvider(settings, ref _plugin.TimeCorrections);
var totpGenerator = new TOTPProvider(settings, _plugin.TimeCorrections);
return totpGenerator.GenerateByByte(Base32.Decode(_plugin.SeedGet(entry).ReadString().ExtWithoutSpaces())) + (_plugin.PluginHost.CustomConfig.GetBool(KeeTrayTOTPExt.setname_bool_TOTPColumnTimer_Visible, true) ? totpGenerator.Timer.ToString().ExtWithParenthesis().ExtWithSpaceBefore() : string.Empty);
}

Expand Down
4 changes: 2 additions & 2 deletions KeeTrayTOTP/TrayTOTP_Plugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ private void SprEngine_FilterCompile(object sender, SprEventArgs e)
{
string[] settings = SettingsGet(e.Context.Entry);

TOTPProvider totpGenerator = new TOTPProvider(settings, ref this.TimeCorrections);
TOTPProvider totpGenerator = new TOTPProvider(settings, this.TimeCorrections);

string invalidCharacters;

Expand Down Expand Up @@ -841,7 +841,7 @@ internal void TOTPCopyToClipboard(PwEntry pe)
{
string[] settings = SettingsGet(pe);

TOTPProvider totpGenerator = new TOTPProvider(settings, ref this.TimeCorrections);
TOTPProvider totpGenerator = new TOTPProvider(settings, this.TimeCorrections);

string invalidCharacters;
if (SeedValidate(pe, out invalidCharacters))
Expand Down