mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2026-02-20 22:44:31 +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:
@@ -1237,7 +1237,7 @@ PODS:
|
||||
- ReactCommon/turbomodule/bridging
|
||||
- ReactCommon/turbomodule/core
|
||||
- Yoga
|
||||
- react-native-pubky (0.7.1):
|
||||
- react-native-pubky (0.8.0):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
@@ -1757,7 +1757,7 @@ SPEC CHECKSUMS:
|
||||
React-logger: 4072f39df335ca443932e0ccece41fbeb5ca8404
|
||||
React-Mapbuffer: 714f2fae68edcabfc332b754e9fbaa8cfc68fdd4
|
||||
React-microtasksnativemodule: 4943ad8f99be8ccf5a63329fa7d269816609df9e
|
||||
react-native-pubky: 1740252f1e510886c4239242d0b731bc4d96b91b
|
||||
react-native-pubky: 1da8f3324a665ecf4495652efe0e67820a22f3a2
|
||||
React-nativeconfig: 4a9543185905fe41014c06776bf126083795aed9
|
||||
React-NativeModulesApple: 0506da59fc40d2e1e6e12a233db5e81c46face27
|
||||
React-perflogger: 3bbb82f18e9ac29a1a6931568e99d6305ef4403b
|
||||
|
||||
@@ -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