Skip to content

Commit

Permalink
Remove ref and unused method (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinvanpoppel committed Apr 25, 2020
1 parent 892f231 commit a99b776
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 24 deletions.
22 changes: 1 addition & 21 deletions KeeTrayTOTP/Libraries/TOTPProvider.cs
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
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
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

0 comments on commit a99b776

Please sign in to comment.