Skip to content
This repository has been archived by the owner on Sep 14, 2024. It is now read-only.

Latest commit

 

History

History
57 lines (35 loc) · 1.81 KB

signer_doc.md

File metadata and controls

57 lines (35 loc) · 1.81 KB

Signature and verification

This document describes examples of signing and verification with a key pair using the NosoDart library.

Table of contents

Check for key pair matching

This example demonstrates how to perform a key-pair matching check.

bool isMatching = NosoSigner().verifyKeysPair(KeyPair(publicKey: "examplePublic", privateKey: "examplePrivate"));

The verifyKeysPair() method will return true if the key match is confirmed, otherwise it will return false.


Signing message or creating an ECSignature

This example explains how to create an ECSignature signature and convert it to Base64. Or just sign the message for further verification.

ECSignature? ecSignature = NosoSigner().signMessage("exampleMessage", "examplePrivatKey");

The signMessage() method will return a valid ECSignature if no exceptions occurred in the process, otherwise null will be returned;

How to encode ECSignature to Base64

String signatureString = NosoSigner().encodeSignatureToBase64(ecSignature);

How to decode Base64 to ECSignature

ECSignature decodeEcSignature = NosoSigner().decodeBase64ToSignature(signatureString);

Verification of the signed message

This example demonstrates how to verify a signed message.

bool isVerified = NosoSigner().verifySignedString("exampleMessage", ecSignature, "examplePublickKey");

The verifySignedString() method will return true if the message signature is confirmed, otherwise it will return false;