mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2026-02-17 21:14:33 +01:00
refactor: get signup token
Upgrades bindings. Adds and implements getSignupToken. Adds signupToken param to signUp method. Update README.md.
This commit is contained in:
@@ -1237,7 +1237,7 @@ PODS:
|
||||
- ReactCommon/turbomodule/bridging
|
||||
- ReactCommon/turbomodule/core
|
||||
- Yoga
|
||||
- react-native-pubky (0.9.5):
|
||||
- react-native-pubky (0.10.0):
|
||||
- DoubleConversion
|
||||
- glog
|
||||
- hermes-engine
|
||||
@@ -1757,7 +1757,7 @@ SPEC CHECKSUMS:
|
||||
React-logger: 4072f39df335ca443932e0ccece41fbeb5ca8404
|
||||
React-Mapbuffer: 714f2fae68edcabfc332b754e9fbaa8cfc68fdd4
|
||||
React-microtasksnativemodule: 4943ad8f99be8ccf5a63329fa7d269816609df9e
|
||||
react-native-pubky: 7c1f0436da7e93cd17fc7aa22ff3f89c6cb3445d
|
||||
react-native-pubky: f45bed8e9a6ccbb350c2e40131be2e92d394722c
|
||||
React-nativeconfig: 4a9543185905fe41014c06776bf126083795aed9
|
||||
React-NativeModulesApple: 0506da59fc40d2e1e6e12a233db5e81c46face27
|
||||
React-perflogger: 3bbb82f18e9ac29a1a6931568e99d6305ef4403b
|
||||
|
||||
@@ -21,6 +21,7 @@ import {
|
||||
removeEventListener,
|
||||
session,
|
||||
deleteFile,
|
||||
getSignupToken,
|
||||
} from '@synonymdev/react-native-pubky';
|
||||
|
||||
const HOMESERVER = '8pinxxgqs41n4aididenw5apqp1urfmzdztr8jt4abrkdn435ewo';
|
||||
@@ -131,13 +132,36 @@ export default function App() {
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<Button
|
||||
title={'Get Signup Token'}
|
||||
onPress={async (): Promise<void> => {
|
||||
try {
|
||||
const res = await getSignupToken(
|
||||
HOMESERVER, // Homeserver pubky
|
||||
'admin_password' // Admin Password
|
||||
);
|
||||
if (res.isErr()) {
|
||||
console.log(res.error);
|
||||
return;
|
||||
}
|
||||
console.log('Signup Token:', res.value);
|
||||
// Store this token for use with signUpWithToken
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
<Button
|
||||
title={'signup'}
|
||||
onPress={async (): Promise<void> => {
|
||||
try {
|
||||
const signupToken = 'signup_token';
|
||||
const res = await signUp(
|
||||
SECRET_KEY, // Secret Key
|
||||
`pubky://${HOMESERVER}` // Homeserver
|
||||
`pubky://${HOMESERVER}`, // Homeserver
|
||||
signupToken
|
||||
);
|
||||
if (res.isErr()) {
|
||||
console.log(res.error.message);
|
||||
|
||||
Reference in New Issue
Block a user