Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

200
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda