Compare commits

..

3 Commits

3 changed files with 10 additions and 4 deletions

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libportal",
"version": "0.2.0-develop.7",
"version": "0.2.0-develop.8",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libportal",
"version": "0.2.0-develop.7",
"version": "0.2.0-develop.8",
"dependencies": {
"@noble/curves": "^1.1.0",
"@noble/hashes": "^1.3.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libportal",
"version": "0.2.0-develop.7",
"version": "0.2.0-develop.8",
"main": "lib/index.js",
"module": "lib/index.mjs",
"types": "lib/index.d.ts",

View File

@ -105,6 +105,10 @@ export class Client {
}
async login(): Promise<LoginResponse> {
if (!this._options.privateKey) {
return this.loginPubkey();
}
return this.post<LoginResponse>("/api/v1/auth/login", {
email: this._options.email,
password: this._options.password,
@ -131,7 +135,7 @@ export class Client {
return json.status as boolean;
}
async loginPubkey(): Promise<void> {
async loginPubkey(): Promise<LoginResponse> {
if (!this._options.privateKey) {
throw new Error("Private key is required");
}
@ -158,6 +162,8 @@ export class Client {
);
this.jwtSessionKey = loginRet.token;
return { token: loginRet.token };
}
logout(request: LogoutRequest): Promise<void> {