mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2026-02-09 09:04:41 +01:00
feat: implement parseAuthUrl
Adds & Implements parseAuthUrl. Updates README.md. Bumps version to 0.2.0.
This commit is contained in:
@@ -1237,7 +1237,7 @@ PODS:
|
||||
- ReactCommon/turbomodule/bridging
|
||||
- ReactCommon/turbomodule/core
|
||||
- Yoga
|
||||
- react-native-pubky (0.1.0):
|
||||
- react-native-pubky (0.2.0):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
@@ -1757,7 +1757,7 @@ SPEC CHECKSUMS:
|
||||
React-logger: 4072f39df335ca443932e0ccece41fbeb5ca8404
|
||||
React-Mapbuffer: 714f2fae68edcabfc332b754e9fbaa8cfc68fdd4
|
||||
React-microtasksnativemodule: 4943ad8f99be8ccf5a63329fa7d269816609df9e
|
||||
react-native-pubky: 10845f4997bf81181a4f915d22642d04492daec7
|
||||
react-native-pubky: 9fb377be57b3f0ee6a91aca7e2e6a754a756f11b
|
||||
React-nativeconfig: 4a9543185905fe41014c06776bf126083795aed9
|
||||
React-NativeModulesApple: 0506da59fc40d2e1e6e12a233db5e81c46face27
|
||||
React-perflogger: 3bbb82f18e9ac29a1a6931568e99d6305ef4403b
|
||||
|
||||
@@ -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