app_authentication_kit 0.0.6 app_authentication_kit: ^0.0.6 copied to clipboard
Flutter Plugin for application to perform various authentication functions
app_authentication_kit #
app_authentication_kit is a plugin for application to preform a set of authentication functions e.g. generate mnemonic phrase, generate private key from mnemonic phrase.
Usage #
Generate Mnemonic Phrase #
import 'package:app_authentication_kit/app_authentication_kit.dart';
// Generate 12 words mnemonic phrase
// Return [String] contains 12 words
String mPharse = MnemonicKit().genMnemonicPhrase();
// Generate 24 words mnemonic phrase
// Return [String] contains 24 words
String mPharse = MnemonicKit().genMnemonicPhrase(strength: 256);
Validate Mneonic Phraase #
import 'package:app_authentication_kit/app_authentication_kit.dart';
// Validate mnemonic phrase
// Return [bool], [true] indicates valid, [false] indicates invalid
bool isValid = MnemonicKit().validateMnemonic(mPhrase);
Import Mnemonic Phrase #
import 'package:app_authentication_kit/app_authentication_kit.dart';
// Generate root key for application to store in local
// Uses this key to derivative Address and Private key
String base58 = MnemonicKit().mnemonicToBase58(mPhrase);
// Generate Address Pair
// [AddressPair] includes [String] [address], [String] [publicKey] and [String] [privateKey]
AddressPair addressPair = MnemonicKit().genAddressPairFromBase58(base58);
// Or directly Generate Address Pair from Mnemonic Phrase
AddressPair addressPair = MnemonicKit().mnemonicPhraseToAddressPair(mPhrase);