Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

251
Vistas
How can I use this React Native PGP library?

I want to make a App that just generates a PGP Keypair and Displays it in those with useState but i didn't unterstand anything on the Documentation https://github.com/jerson/react-native-fast-openpgp#readme :/ can someone help me ?

Just Generating, Encrypt/Decrypt would be a Project for later, Iam new to React Native and dont want to make it too complicated.

import { StatusBar } from 'expo-status-bar';
import { useState } from 'react';
import { StyleSheet, Text, View, Button } from 'react-native';
export default function App() {
const [MyPublicKey,setMyPublicKey] = useState('No key yet');
const [MyPrivateKey,setMyPrivateKey] = useState('No key yet');
const [ButtonText,setButtonText] = useState('Generate Keypair');
const GenerateKeypair = ()=>{

// This is an Example, Here Should be the Function from the Library
setMyPublicKey('-----BEGIN PGP PUBLIC KEY BLOCK-----')
setMyPrivateKey('-----BEGIN PGP Private KEY BLOCK-----')
setButtonText('renew')
}
return (
<View style={styles.container}>
<Text>{MyPublicKey}
</Text>
<Text>
{MyPrivateKey}
</Text>
<Button onPress={GenerateKeypair} title={ButtonText}/>
<StatusBar style="auto" />
</View>
  );
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'space-evenly',
  },
});

I used openpgp library for normal react but with react native it doesnt work all i had to do is this :

const [MyPrivateKey,setMyPrivateKey] = useState('');   const [MyPublicKey,setMyPublicKey] = useState('');   const [MyRevocation,setMyRevocation] = useState('');   const GenerateKeypair = async () => {     const { privateKey, publicKey, revocationCertificate } = await generateKey({         type: 'ecc', // Type of the key, defaults to ECC curve: 'curve25519', // ECC curve name, defaults to curve25519 userIDs: [{ name: 'Jon Smith', email: 'jon@example.com' }], // you can pass multiple user IDs passphrase: 'super long and hard to guess secret', // protects the private key format: 'armored' // output key format, defaults to 'armored' (other options: 'binary' or 'object')     });     setMyPrivateKey(privateKey);     // '-----BEGIN PGP PRIVATE KEY BLOCK ... '     setMyPublicKey(publicKey);      // '-----BEGIN PGP PUBLIC KEY BLOCK ... '     setMyRevocation(revocationCertificate); // '-----BEGIN PGP PUBLIC KEY BLOCK ... ' }
about 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Asistente virtual