Trustless authentication is a way for a user to log in without sharing their password. It would be great if companies started doing this because apparently they keep getting hacked and user passwords are leaked.
Trustless authentication is also very useful for P2P applications where there is no trusted server.
Check out the source code of example.html.
Note that all functions take and produce strings, since strings are generally a bit easier to work with for web and databases.
Takes a string and converts it to a secret key.
Takes a private key and returns its public key.
Encrypt a message with a secret key.
Verify that a message has been encrypted by the a public key that corresponds to a private key. (The fact that you don't need the private key for this is where the magic of public key cryptography comes from.)
This uses the Secp256k1 ECDSA (the BitCoin curve).
This code is CC0.