All Projects → jerson → react-native-fast-openpgp

jerson / react-native-fast-openpgp

Licence: MIT license
OpenPGP for react native made with golang for fast performance

Programming Languages

typescript
32286 projects
C++
36643 projects - #6 most used programming language
javascript
184084 projects - #8 most used programming language
c
50402 projects - #5 most used programming language
java
68154 projects - #9 most used programming language
Objective-C++
1391 projects

Projects that are alternatives of or similar to react-native-fast-openpgp

lokey
A tool that makes it easy to work with and convert between cryptographic key formats
Stars: ✭ 87 (+200%)
Mutual labels:  pgp, openpgp
Gpgsync
🔒 GPG Sync is designed to let users always have up-to-date public keys for other members of their organization
Stars: ✭ 301 (+937.93%)
Mutual labels:  pgp, openpgp
openpgp-php
OpenPGP.php is a pure-PHP implementation of the OpenPGP Message Format (RFC 4880).
Stars: ✭ 161 (+455.17%)
Mutual labels:  pgp, openpgp
pgpainless
Simple to use OpenPGP API based on Bouncy Castle
Stars: ✭ 73 (+151.72%)
Mutual labels:  pgp, openpgp
Bouncy Gpg
Make using Bouncy Castle with OpenPGP fun again!
Stars: ✭ 164 (+465.52%)
Mutual labels:  pgp, openpgp
flutter-openpgp
OpenPGP for flutter made with golang for fast performance with support for android, ios, macos, linux, windows, web and hover
Stars: ✭ 35 (+20.69%)
Mutual labels:  pgp, openpgp
OpenPGP
A C++ Implementation of RFC 4880
Stars: ✭ 87 (+200%)
Mutual labels:  pgp, openpgp
Objectivepgp
OpenPGP library for iOS and macOS
Stars: ✭ 557 (+1820.69%)
Mutual labels:  pgp, openpgp
Rnp
RNP: high performance C++ OpenPGP library, fully compliant to RFC 4880
Stars: ✭ 122 (+320.69%)
Mutual labels:  pgp, openpgp
Encrypt.to
Send encrypted PGP messages with one click
Stars: ✭ 116 (+300%)
Mutual labels:  pgp, openpgp
wp-pgp-encrypted-emails
🔐 📧 Encrypts WordPress emails using OpenPGP or S/MIME with a familiar API.
Stars: ✭ 35 (+20.69%)
Mutual labels:  pgp, openpgp
rust-flutter-reactive
This is a sample app to improve consistency over Mobile App Development.
Stars: ✭ 25 (-13.79%)
Mutual labels:  flatbuffers, ffi
openpgpkey-control
OpenPGP keys published on your website (WKD)
Stars: ✭ 36 (+24.14%)
Mutual labels:  pgp, openpgp
crfsuite-rs
Rust binding to crfsuite
Stars: ✭ 19 (-34.48%)
Mutual labels:  ffi
rust lisp
A Rust-embeddable Lisp, with support for interop with native Rust functions
Stars: ✭ 128 (+341.38%)
Mutual labels:  ffi
jsish
Jsi is a small, C-embeddable javascript interpreter with tightly woven Web and DB support.
Stars: ✭ 32 (+10.34%)
Mutual labels:  jsi
keygaen
Sign, verify, encrypt and decrypt data with PGP in your browser.
Stars: ✭ 78 (+168.97%)
Mutual labels:  pgp
keylist-rfc
🔏 turning the system behind GPG Sync into an Internet standard
Stars: ✭ 15 (-48.28%)
Mutual labels:  pgp
JitFFI
A fast and customizable JIT compiler for FFI (Foreign-Function Interface).
Stars: ✭ 45 (+55.17%)
Mutual labels:  ffi
hermes
Automates programmables à réaction aux échanges électroniques depuis une boîte IMAP4
Stars: ✭ 15 (-48.28%)
Mutual labels:  hermes

react-native-fast-openpgp

Android iOS

Getting started

$ npm install react-native-fast-openpgp --save

JSI

If you want to use with JSI instead of NativeModules you need to set

import OpenPGP from "react-native-fast-openpgp";

OpenPGP.useJSI = true;

if you need to use generate methods it is a good idea to disable it, because for now JSI will block your UI but it is faster compared to NativeModules

Usage

Encrypt methods

import OpenPGP from "react-native-fast-openpgp";

const encrypted = await OpenPGP.encrypt(message: string, publicKey: string, signedEntity?: Entity, fileHints?: FileHints, options?: KeyOptions ): Promise<string>;
const outputFile = await OpenPGP.encryptFile(inputFile: string, outputFile: string, publicKey: string, signedEntity?: Entity, fileHints?: FileHints, options?: KeyOptions): Promise<number>;

const encryptedSymmetric = await OpenPGP.encryptSymmetric(message: string, passphrase: string, fileHints?: FileHints, options?: KeyOptions ): Promise<string>;
const outputFile = await OpenPGP.encryptSymmetricFile(inputFile: string, outputFile: string, passphrase: string, fileHints?: FileHints, options?: KeyOptions ): Promise<number> ;

Decrypt methods

import OpenPGP from "react-native-fast-openpgp";

const decrypted = await OpenPGP.decrypt(message: string, privateKey: string, passphrase: string, options?: KeyOptions ): Promise<string>;
const outputFile = await OpenPGP.decryptFile(inputFile: string, outputFile: string, privateKey: string, passphrase: string, options?: KeyOptions ): Promise<number>;

const decryptedSymmetric = await OpenPGP.decryptSymmetric(message: string, passphrase: string, options?: KeyOptions ): Promise<string>;
const outputFile = await OpenPGP.decryptSymmetricFile(inputFile: string, outputFile: string, passphrase: string, options?: KeyOptions ): Promise<number> ;

Sign and Verify methods

import OpenPGP from "react-native-fast-openpgp";

const signed = await OpenPGP.sign(message: string, publicKey: string, privateKey: string, passphrase: string, options?: KeyOptions ): Promise<string>;
const signed = await OpenPGP.signFile(inputFile: string, publicKey: string, privateKey: string, passphrase: string, options?: KeyOptions ): Promise<string>;

const verified = await OpenPGP.verify(signature: string, message: string, publicKey: string ): Promise<boolean>;
const verified = await OpenPGP.verifyFile(signature: string, inputFile: string,publicKey: string): Promise<boolean>;

Generate

import OpenPGP from "react-native-fast-openpgp";

const generated = await OpenPGP.generate(options: Options): Promise<KeyPair>;

Convert methods

import OpenPGP from "react-native-fast-openpgp";

const publicKey = await OpenPGP.convertPrivateKeyToPublicKey(privateKey: string): Promise<string>;

Metadata methods

import OpenPGP from "react-native-fast-openpgp";

const metadata1 = await OpenPGP.getPublicKeyMetadata(publicKey: string): Promise<PublicKeyMetadata>;
const metadata2 = await OpenPGP.getPrivateKeyMetadata(privateKey: string): Promise<PrivateKeyMetadata>;

Encrypt with multiple keys

import OpenPGP from "react-native-fast-openpgp";

const publicKeys = `-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBF0Tpe0BCADm+ja4vMKuodkQEhLm/092M/6gt4TaKwzv8QcA53/FrM3g8wab
D4m65Neoc7DBEdvzgK9IUMpwG5N0t+0pfWLhs8AZdMxE7RbP
=kbtq
-----END PGP PUBLIC KEY BLOCK-----
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBF0Tpe0BCADm+ja4vMKuodkQEhLm/092M/6gt4TaKwzv8QcA53/FrM3g8wab
D4m65Neoc7DBEdvzgK9IUMpwG5N0t+0pfWLhs8AZdMxE7RbP
=kbtq
-----END PGP PUBLIC KEY BLOCK-----
-----BEGIN PGP PUBLIC KEY BLOCK-----

mQENBF0Tpe0BCADm+ja4vMKuodkQEhLm/092M/6gt4TaKwzv8QcA53/FrM3g8wab
D4m65Neoc7DBEdvzgK9IUMpwG5N0t+0pfWLhs8AZdMxE7RbP
=kbtq
-----END PGP PUBLIC KEY BLOCK-----`;
const encrypted = await OpenPGP.encrypt("sample text" publicKeys);

Types

import OpenPGP from "react-native-fast-openpgp";


export enum Hash {
    SHA256 = 0,
    SHA224 = 1,
    SHA384 = 2,
    SHA512 = 3,
}

export enum Compression {
    NONE = 0,
    ZLIB = 1,
    ZIP = 2,
}

export enum Cipher {
    AES128 = 0,
    AES192 = 1,
    AES256 = 2,
}

export interface KeyOptions {
    /**
     * RSABits is the number of bits in new RSA keys made with NewEntity.
     * If zero, then 2048 bit keys are created.
     * @default 2048
     */
    rsaBits?: number;

    /**
     * Cipher is the cipher to be used.
     * If zero, AES-128 is used.
     * @default aes128
     */
    cipher?: Cipher;

    /**
     * Compression is the compression algorithm to be
     * applied to the plaintext before encryption. If zero, no
     * compression is done.
     * @default none
     */
    compression?: Compression;

    /**
     * Hash is the default hash function to be used.
     * If zero, SHA-256 is used.
     * @default sha256
     */
    hash?: Hash;

    /**
     * CompressionLevel is the compression level to use. It must be set to
     * between -1 and 9, with -1 causing the compressor to use the
     * default compression level, 0 causing the compressor to use
     * no compression and 1 to 9 representing increasing (better,
     * slower) compression levels. If Level is less than -1 or
     * more then 9, a non-nil error will be returned during
     * encryption. See the constants above for convenient common
     * settings for Level.
     * @default 0
     */
    compressionLevel?: number;
}

export interface Options {
    comment?: string;
    email?: string;
    name?: string;
    passphrase?: string;
    keyOptions?: KeyOptions;
}

export interface KeyPair {
    publicKey: string;
    privateKey: string;
}

export interface PublicKeyMetadata {
    keyID: string;
    keyIDShort: string;
    creationTime: string;
    fingerprint: string;
    keyIDNumeric: string;
    isSubKey: boolean;
}
export interface PrivateKeyMetadata {
    keyID: string;
    keyIDShort: string;
    creationTime: string;
    fingerprint: string;
    keyIDNumeric: string;
    isSubKey: boolean;
    encrypted: boolean;
}

/**
 * An Entity represents the components of an OpenPGP key: a primary public key
 * (which must be a signing key), one or more identities claimed by that key,
 * and zero or more subkeys, which may be encryption keys.
 */
export interface Entity {
    publicKey: string;
    privateKey: string;
    passphrase?: string;
}

export interface FileHints {
    /**
     * IsBinary can be set to hint that the contents are binary data.
     */
    isBinary?: boolean;
    /**
     * FileName hints at the name of the file that should be written. It's
     * truncated to 255 bytes if longer. It may be empty to suggest that the
     * file should not be written to disk. It may be equal to "_CONSOLE" to
     * suggest the data should not be written to disk.
     */
    fileName?: string;
    /**
     * ModTime format allowed: RFC3339, contains the modification time of the file, or the zero time if not applicable.
     */
    modTime?: string;
}

Native Code

the native library is made in Golang for faster performance

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

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].