ecdh_plugin 0.0.1 ecdh_plugin: ^0.0.1 copied to clipboard
ECDH key generation plugin
import 'package:flutter/material.dart';
import 'dart:async';
import 'package:flutter/services.dart';
import 'package:ecdh_plugin/ecdh_plugin.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({Key? key}) : super(key: key);
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _publicKeyHex = "unknown public key";
String _privateKeyHex = "Unknown private key";
final _ecdhPlugin = EcdhPlugin();
@override
void initState() {
super.initState();
}
getKeys() async {
var value = await _ecdhPlugin.getECDHKey();
setState(() {
_publicKeyHex = value.publicKey!;
_privateKeyHex = value.privateKey!;
;
});
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('ECDH Plugin example app'),
),
body: Center(
child: Column(
children: [
ElevatedButton(onPressed: () {}, child: Text("get Publlic Key")),
const SizedBox(height: 20),
Text("Public key : $_publicKeyHex"),
const SizedBox(height: 20),
ElevatedButton(onPressed: () {}, child: Text("get Private Key")),
SizedBox(height: 30),
Text("Private key : $_privateKeyHex"),
SizedBox(height: 30),
ElevatedButton(
onPressed: () {
getKeys();
},
child: Text("get ECDH Keys"))
],
),
),
),
);
}
}