0.1.2 • Published 4 years ago
@albedo-link/signature-verification v0.1.2
Signature verification
Utility for the verification of ED25519 message signatures generated by Albedo signer app.
Installation
npm i -S @albedo-link/signature-verificationUsage
import {verifyMessageSignature} from '@albedo-link/signature-verification'
const isValid = verifyMessageSignature(
'GDWPMRQSLXNEHCXC7RTISZAHULB7FDDIOPR6CF5B5IUWOQXN2CUWN4LO',
'DGmk7s8gkhXMqRNsiCBanwL76Kt+5+WUzAOlWoh0nDs=',
'049a26b40c1a30be1cef3ef7a64af8ae305e7567ee2cac57e5a494e0036860b81dc417c005e4f4dff6ad6bc52f56f0e61e9d084c2718638bc4f78130fc14d20e'
)Parameters
publicKey(string) - Ed25519 public key in StrKey encoding (e.g. "GDWP...N4LO").message(string) - Arbitrary text message signed by the given public key.signature(string|Buffer|Uint8Array) - Hex-encoded message signature.
Returns
(boolean) - Returns true if a signature is valid and false otherwise.
Direct usage without bundler
The library can be also used directly in the browser without a package bundler:
<script src="https://unpkg.com/@albedo-link/signature-verification/lib/albedo.signature.verification.js"></script>albedoSignatureVerification.verifyMessageSignature(
'GDWPMRQSLXNEHCXC7RTISZAHULB7FDDIOPR6CF5B5IUWOQXN2CUWN4LO',
'DGmk7s8gkhXMqRNsiCBanwL76Kt+5+WUzAOlWoh0nDs=',
'049a26b40c1a30be1cef3ef7a64af8ae305e7567ee2cac57e5a494e0036860b81dc417c005e4f4dff6ad6bc52f56f0e61e9d084c2718638bc4f78130fc14d20e'
)Development
To create UMD library bundle, run the following NPM script:
npm run buildRunning tests:
npm run test