refactor: return session info

Returns session info when signing up/in.
Bumps version to 0.9.3.
This commit is contained in:
coreyphillips
2024-11-23 22:43:41 -05:00
parent c2b2b58761
commit efb3c38ff9
10 changed files with 8 additions and 7 deletions

View File

@@ -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));
}