Compare commits
3 Commits
v0.2.0-dev
...
v0.2.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | 29adc6dcca | |
Derrick Hammer | 6555fcd9a3 | |
Derrick Hammer | 6d5c27c972 |
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.7",
|
"version": "0.2.0-develop.8",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.7",
|
"version": "0.2.0-develop.8",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@noble/curves": "^1.1.0",
|
"@noble/curves": "^1.1.0",
|
||||||
"@noble/hashes": "^1.3.1",
|
"@noble/hashes": "^1.3.1",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libportal",
|
"name": "@lumeweb/libportal",
|
||||||
"version": "0.2.0-develop.7",
|
"version": "0.2.0-develop.8",
|
||||||
"main": "lib/index.js",
|
"main": "lib/index.js",
|
||||||
"module": "lib/index.mjs",
|
"module": "lib/index.mjs",
|
||||||
"types": "lib/index.d.ts",
|
"types": "lib/index.d.ts",
|
||||||
|
|
|
@ -105,6 +105,10 @@ export class Client {
|
||||||
}
|
}
|
||||||
|
|
||||||
async login(): Promise<LoginResponse> {
|
async login(): Promise<LoginResponse> {
|
||||||
|
if (!this._options.privateKey) {
|
||||||
|
return this.loginPubkey();
|
||||||
|
}
|
||||||
|
|
||||||
return this.post<LoginResponse>("/api/v1/auth/login", {
|
return this.post<LoginResponse>("/api/v1/auth/login", {
|
||||||
email: this._options.email,
|
email: this._options.email,
|
||||||
password: this._options.password,
|
password: this._options.password,
|
||||||
|
@ -131,7 +135,7 @@ export class Client {
|
||||||
return json.status as boolean;
|
return json.status as boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
async loginPubkey(): Promise<void> {
|
async loginPubkey(): Promise<LoginResponse> {
|
||||||
if (!this._options.privateKey) {
|
if (!this._options.privateKey) {
|
||||||
throw new Error("Private key is required");
|
throw new Error("Private key is required");
|
||||||
}
|
}
|
||||||
|
@ -158,6 +162,8 @@ export class Client {
|
||||||
);
|
);
|
||||||
|
|
||||||
this.jwtSessionKey = loginRet.token;
|
this.jwtSessionKey = loginRet.token;
|
||||||
|
|
||||||
|
return { token: loginRet.token };
|
||||||
}
|
}
|
||||||
|
|
||||||
logout(request: LogoutRequest): Promise<void> {
|
logout(request: LogoutRequest): Promise<void> {
|
||||||
|
|
Loading…
Reference in New Issue