Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sinusinu committed Jan 23, 2025
0 parents commit f956484
Show file tree
Hide file tree
Showing 25 changed files with 2,699 additions and 0 deletions.
402 changes: 402 additions & 0 deletions .gitignore

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2025 Woohyun Shin (sinu)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Tenta

A WinForms OTP client because why not

![Tenta](images/scr.png)

## Features

- Add from QR code, `otpauth://` URI, or manually
- Double click to copy to clipboard

## Why use Tenta?

- I needed one
- Completely offline
- Kinda lightweight, no bullsh*t, almost-not-ugly interface
- Proudly not encrypting anything at all (might change later)

## Known Issues

- Only TOTP is supported
- Remaining Time counter is only for the first entry, entries with different period may not show up correctly
- Many lovely flickers but that's what I get for using WinForms

## Requirements

- .NET 9 Desktop Runtime

## License

Tenta is distributed under the MIT license. See [LICENSE](LICENSE) file for more information.
20 changes: 20 additions & 0 deletions Tenta.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net9.0-windows</TargetFramework>
<Version>0.1.0</Version>
<Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms>
<PublishSingleFile>true</PublishSingleFile>
<NoWarn>$(NoWarn);WFO5001</NoWarn>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Otp.NET" Version="1.4.0" />
<PackageReference Include="ZXing.Net" Version="0.16.9" />
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
</ItemGroup>

</Project>
22 changes: 22 additions & 0 deletions Tenta.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35707.178 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tenta", "Tenta.csproj", "{2443A9CA-50C4-4961-B3E5-40ED2C579FA4}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2443A9CA-50C4-4961-B3E5-40ED2C579FA4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2443A9CA-50C4-4961-B3E5-40ED2C579FA4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2443A9CA-50C4-4961-B3E5-40ED2C579FA4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2443A9CA-50C4-4961-B3E5-40ED2C579FA4}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Binary file added images/scr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
218 changes: 218 additions & 0 deletions src/AddManuallyForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions src/AddManuallyForm.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using OtpNet;
using System;
using System.Windows.Forms;

namespace Tenta {
public partial class AddManuallyForm : Form {
public IOTPEntity? otpEntry;

public AddManuallyForm() {
InitializeComponent();
}

private void AddManuallyForm_Load(object sender, EventArgs e) {
cbxAlgorithm.SelectedIndex = 0;
}

private void btnOK_Click(object sender, EventArgs e) {
if (tbxUsername.Text.Trim().Length == 0 || tbxSecret.Text.Trim().Length == 0) {
MessageBox.Show("Username and Secret are required!", "Tenta", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

int digits = 6;
int period = 30;

try {
digits = int.Parse(tbxDigits.Text);
period = int.Parse(tbxPeriod.Text);
} catch (Exception) {
MessageBox.Show("Digits and Period must be numbers only!", "Tenta", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

try {
Base32Encoding.ToBytes(tbxSecret.Text);
} catch (Exception) {
MessageBox.Show("Given Secret is invalid!", "Tenta", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}

var algorithm = "";
switch (cbxAlgorithm.SelectedIndex) {
case 0: algorithm = "sha1"; break;
case 1: algorithm = "sha256"; break;
case 2: algorithm = "sha512"; break;
}

otpEntry = new TOTPEntity(tbxUsername.Text, tbxIssuer.Text, tbxSecret.Text, algorithm, digits, period);
DialogResult = DialogResult.OK;
Close();
}
}
}
Loading

0 comments on commit f956484

Please sign in to comment.