mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2025-12-17 14:44:26 +01:00
feat: implement parseAuthUrl
Adds & Implements parseAuthUrl. Updates README.md. Bumps version to 0.2.0.
This commit is contained in:
@@ -1,33 +1,9 @@
|
||||
import { StyleSheet, View, Button } from 'react-native';
|
||||
import { auth } from '@synonymdev/react-native-pubky';
|
||||
import { getAddress } from 'react-native-address-generator';
|
||||
|
||||
import { auth, parseAuthUrl } from '@synonymdev/react-native-pubky';
|
||||
|
||||
export default function App() {
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Button
|
||||
title={'getAddress'}
|
||||
onPress={async (): Promise<void> => {
|
||||
const mnemonic =
|
||||
'lazy rally chat way pet outside flame cup oval absurd innocent balcony';
|
||||
const passphrase = 'passphrase';
|
||||
const path = "m/84'/1'/0'/0/0";
|
||||
const network = 'testnet';
|
||||
|
||||
const getAddressRes = await getAddress({
|
||||
mnemonic,
|
||||
path,
|
||||
network,
|
||||
passphrase,
|
||||
});
|
||||
if (getAddressRes.isErr()) {
|
||||
console.log(getAddressRes.error.message);
|
||||
return;
|
||||
}
|
||||
console.log(getAddressRes.value);
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
title={'auth'}
|
||||
onPress={async (): Promise<void> => {
|
||||
@@ -46,6 +22,23 @@ export default function App() {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
title={'parseAuthUrl'}
|
||||
onPress={async (): Promise<void> => {
|
||||
try {
|
||||
const res = await parseAuthUrl(
|
||||
'pubkyauth:///?relay=https://demo.httprelay.io/link&capabilities=/pub/pubky.app:rw,/pub/example.com/nested:rw&secret=FyzJ3gJ1W7boyFZC1Do9fYrRmDNgCLNRwEu_gaBgPUA'
|
||||
);
|
||||
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