TOTP for OS/2 Presentation Manager
==================================

A small Presentation Manager program that shows time-based one-time
passwords (TOTP, RFC 6238) - the codes that authenticator apps on
smartphones show. The secrets are kept in a plain text file.

Algorithms: SHA-1, SHA-256, SHA-512 (RFC 2104, RFC 4226, RFC 6238).


Usage
-----

    pmtotp.exe [file]

The program reads the entries from TOTP.TXT in the current directory, or
from the file named on the command line. Each entry is shown with its
name, its current code and a bar below it that counts down the remaining
validity. The bar and the code turn red during the last sixth of the
period. Press F5 to read the file again after you have edited it.


The entries file
----------------

One entry per line:

    Name:SECRET
    Name:SECRET;ALGORITHM,DIGITS,PERIOD

SECRET is the base32 secret that the service displays when you set up
two-factor authentication. Upper or lower case, blanks, dashes and
trailing "=" are accepted; any length is fine.

The options after the semicolon are optional and positional. An empty
field keeps its default:

    ALGORITHM   SHA1 (default), SHA256 or SHA512
    DIGITS      6 (default), 7 or 8
    PERIOD      seconds, 1 to 86400, default 30

Most services use the defaults. Use the options only if the service says
otherwise.

Example:

    # lines starting with # and empty lines are ignored
    GitHub:JBSWY3DPEHPK3PXP
    Bank:gezd gnbv gy3t qojq;SHA256,8
    Token:JBSWY3DPEHPK3PXP;,,60
    Other:JBSWY3DPEHPK3PXP;SHA512,7,45

The name may contain colons; the secret is the text after the last
colon. Lines that cannot be read are skipped, and their number is shown
in red at the bottom of the window.


Important
---------

* The codes are calculated from UTC, which the program derives from the
  system clock and the TZ variable. If the clock is wrong or TZ in
  CONFIG.SYS does not match your time zone, every code will be wrong.
  The clock must be accurate to within a few seconds.

* The secrets are stored unencrypted in the entries file. Protect the
  file like a password list, and do not share it.

* Limits: 64 entries, names up to 47 characters, secrets up to 64 bytes.
  There is no scrolling; enlarge the window if entries are cut off.
  There are no menus - edit the file with a text editor, then press F5.


Building from source
--------------------

    wcl386 -bt=os2 -l=os2v2_pm -w4 pmtotp.c

Needs Open Watcom with the OS/2 headers. Single source file, no resources.


License
-------

MIT License

Copyright (c) 2026 Axel Meiss

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.


Credits
-------

Written with Claude (Anthropic). Compiled, tested and published by
Axel Meiss.
