Coder Social home page Coder Social logo

vjeson / flutter-openpgp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jerson/flutter-openpgp

0.0 0.0 0.0 173.64 MB

OpenPGP for flutter made with golang for fast performance with support for android, ios, macos, linux, windows, web and hover

Home Page: https://pub.dev/packages/openpgp

License: MIT License

Java 0.47% Ruby 1.81% Objective-C 0.25% Dart 63.92% HTML 0.44% C 6.53% Go 0.99% C++ 9.80% Swift 0.66% JavaScript 6.87% CMake 6.67% Kotlin 0.05% Shell 1.32% Makefile 0.12% Dockerfile 0.10%

flutter-openpgp's Introduction

OpenPGP

Library for use openPGP with support for android, ios, macos, windows, linux, web and hover

Contents

Usage

Generate methods

import 'package:openpgp/openpgp.dart';

void main() async {
    var keyOptions = KeyOptions()..rsaBits = 1024;
    var keyPair = await OpenPGP.generate(
            options: Options()
              ..name = 'test'
              ..email = '[email protected]'
              ..passphrase = passphrase
              ..keyOptions = keyOptions);
}

Encrypt methods

import 'package:fast_rsa/rsa.dart';

void main() async {

    var bytesSample = Uint8List.fromList('data'.codeUnits);
    
    var result = await OpenPGP.encrypt("text","[publicKey here]");
    var result = await OpenPGP.encryptSymmetric("text","[passphrase here]");
    var result = await OpenPGP.encryptBytes(bytesSample,"[publicKey here]");
    var result = await OpenPGP.encryptSymmetricBytes(bytesSample,"[passphrase here]");

}

Decrypt methods

import 'package:fast_rsa/rsa.dart';

void main() async {

    var bytesSample = Uint8List.fromList('data'.codeUnits);
    
    var result = await OpenPGP.decrypt("text encrypted","[privateKey here]","[passphrase here]");
    var result = await OpenPGP.decryptSymmetric("text encrypted","[passphrase here]");
    var result = await OpenPGP.decryptBytes(bytesSample,"[privateKey here]","[passphrase here]");
    var result = await OpenPGP.decryptSymmetricBytes(bytesSample,"[passphrase here]");

}

Sign methods

import 'package:fast_rsa/rsa.dart';

void main() async {

    var bytesSample = Uint8List.fromList('data'.codeUnits);
    
    var result = await OpenPGP.sign("text","[publicKey here]","[privateKey here]","[passphrase here]");
    var result = await OpenPGP.signBytesToString(bytesSample,"[publicKey here]","[privateKey here]","[passphrase here]");

}

Verify methods

import 'package:fast_rsa/rsa.dart';

void main() async {

    var bytesSample = Uint8List.fromList('data'.codeUnits);
    
    var result = await OpenPGP.verify("text signed","text","[publicKey here]");
    var result = await OpenPGP.verifyBytes("text signed", bytesSample,"[publicKey here]");

}

Setup

Android

No additional setup required.

iOS

No additional setup required.

Web

Add to you pubspec.yaml.

assets:
    - packages/openpgp/web/assets/worker.js
    - packages/openpgp/web/assets/wasm_exec.js
    - packages/openpgp/web/assets/openpgp.wasm

ref: https://github.com/jerson/flutter-openpgp/blob/master/example/pubspec.yaml

MacOS

No additional setup required.

Hover

Update your plugins.

hover plugins get

In you main_desktop.dart by now you need to add OpenPGP.bindingEnabled = false in order to use channels instead of shared objects

import 'main.dart' as original_main;
import 'package:openpgp/openpgp.dart';

void main() {
  OpenPGP.bindingEnabled = false;
  original_main.main();
}

Linux

No additional setup required.

Windows

No additional setup required.

Example

Inside example folder.

cd example && flutter run

check our web demo: [https://flutter-openpgp.jerson.dev/]

Native Code

Native library is made in Go for faster performance.

[https://github.com/jerson/openpgp-mobile]

flutter-openpgp's People

Contributors

bobanalappat avatar delaosa avatar irasekh3 avatar jerson avatar jerson-av 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.