mirror of
https://github.com/aljazceru/react-native-pubky.git
synced 2026-02-02 13:44:27 +01:00
refactor: return session info
Returns session info when signing up/in. Bumps version to 0.9.3.
This commit is contained in:
@@ -129,25 +129,25 @@ export async function resolve(publicKey: string): Promise<Result<IDNSPacket>> {
|
||||
export async function signUp(
|
||||
secretKey: string,
|
||||
homeserver: string
|
||||
): Promise<Result<string[]>> {
|
||||
): Promise<Result<SessionInfo>> {
|
||||
try {
|
||||
const res = await Pubky.signUp(secretKey, homeserver);
|
||||
if (res[0] === 'error') {
|
||||
return err(res[1]);
|
||||
}
|
||||
return ok(res[1]);
|
||||
return ok(JSON.parse(res[1]));
|
||||
} catch (e) {
|
||||
return err(JSON.stringify(e));
|
||||
}
|
||||
}
|
||||
|
||||
export async function signIn(secretKey: string): Promise<Result<string[]>> {
|
||||
export async function signIn(secretKey: string): Promise<Result<SessionInfo>> {
|
||||
try {
|
||||
const res = await Pubky.signIn(secretKey);
|
||||
if (res[0] === 'error') {
|
||||
return err(res[1]);
|
||||
}
|
||||
return ok(res[1]);
|
||||
return ok(JSON.parse(res[1]));
|
||||
} catch (e) {
|
||||
return err(JSON.stringify(e));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user