Giter VIP home page Giter VIP logo

key_enclave's Introduction

key_enclave

For more secure when you want to communicate to ... and you want to make sure this message came from real user.

Using Keystore and Secure Enclave for stored private key

use ECDSA512 for sign message

NOTE THAT you can't retreve private key from mobile, I can't even do it too.

NOT SUPPORTED background process because i'm not allowed to access private key when mobile turn off or locked

for more information

Usage

To use this plugin, add key_enclave as a dependency in your pubspec.yaml file.

Features

  • generate key pair (EC Algorithm) and return public key back private key store in secure enclave(ios) and tte|keystore(android)

  • delete private key

  • sign message by using private key

Example

import 'package:key_enclave/key_enclave.dart';


class _MyAppState extends State<MyApp> {
  String publicKey = '';
  String signMessage = "";
  String TAG = "KEY_TAG";

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          crossAxisAlignment: CrossAxisAlignment.center,
          children: <Widget>[
            RaisedButton(
              onPressed: () async {
                final pub = await KeyEnclave().generateKeyPair(TAG);
                setState(() {
                  this.publicKey = pub;
                });
              },
              child: Text("GENERATE KEY PAIR"),
            ),
            Text("PUBLIC KEY " + this.publicKey),
             RaisedButton(
              onPressed: () async {
                try {
                  // change message that you want to sign
                final signed = await KeyEnclave().signMessage(TAG,"SECURE MESSAGE");
                setState(() {
                  this.signMessage = signed;
                });
                  
                } catch (e) {
                  setState(() {
                    this.signMessage = e.toString();
                  });
                }
              },
              child: Text("SIGN MESSAGE"),
            ),
            Text("SIGN MESSAGE " + this.signMessage)
          ],
        ),
      ),
    );
  }
}

Upcomming Features

  • verify message
  • encrpyt message
  • decrypt message
  • add option generate key (RSA OR EC) now supported only EC
  • add option user must authen when need to use private key first

key_enclave's People

Contributors

toeydevelopment avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.