mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2026-01-13 11:54:33 +01:00
feat: add create_recovery_file decrypt_recovery_file
Adds create_recovery_file & decrypt_recovery_file functions. Adds examples for create_recovery_file & decrypt_recovery_file. Updates README.md. Updates version to 0.8.0.
This commit is contained in:
@@ -14,6 +14,8 @@ import {
|
||||
list,
|
||||
generateSecretKey,
|
||||
getPublicKeyFromSecretKey,
|
||||
decryptRecoveryFile,
|
||||
createRecoveryFile,
|
||||
} from '@synonymdev/react-native-pubky';
|
||||
|
||||
const HOMESERVER = '8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo';
|
||||
@@ -268,6 +270,44 @@ export default function App() {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<Button
|
||||
title={'Create Recovery File'}
|
||||
onPress={async (): Promise<void> => {
|
||||
try {
|
||||
const res = await createRecoveryFile(
|
||||
SECRET_KEY, // Secret Key
|
||||
'passphrase' // Passphrase
|
||||
);
|
||||
if (res.isErr()) {
|
||||
console.log(res.error.message);
|
||||
return;
|
||||
}
|
||||
console.log(res.value);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<Button
|
||||
title={'Decrypt Recovery File'}
|
||||
onPress={async (): Promise<void> => {
|
||||
try {
|
||||
const res = await decryptRecoveryFile(
|
||||
'cHVia3kub3JnL3JlY292ZXJ5CkZRt1NHIjxyTo0whSSgTgNrH56MPpGrSxvAQSE0x5FeklVJpNJqcNP4zjdwW/OpdBOsEC1qZ5MI/mcEUKFKVAEZwikdclsLZg==', // Recovery File (base64 encoded)
|
||||
'passphrase' // Passphrase
|
||||
);
|
||||
if (res.isErr()) {
|
||||
console.log(res.error.message);
|
||||
return;
|
||||
}
|
||||
console.log(res.value);
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user