Last active
December 1, 2021 06:59
-
-
Save prihandi/4e31ad9e08b83f2ce0ff12999281687a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Generate EDDSA public key and private key | |
| {public_key, priv_key} = :crypto.generate_key(:eddsa, :ed25519) | |
| # Payload that need to be signed | |
| payload = "some_string" | |
| # Generate signature with both public key and private key | |
| signature = :public_key.sign(payload, :none, {:ed_pri, :ed25519, public_key, priv_key}, []) | |
| # Verify signature with public key | |
| is_verified = :public_key.verify(payload, :none, signature, {:ed_pub, :ed25519, public_key}) | |
| # DWYOR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment