@flashbacktech/flashbackclient 0.1.28 → 0.1.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.d.ts +7 -2
- package/dist/api/client.js +9 -4
- package/dist/api/types/auth.d.ts +6 -0
- package/package.json +1 -1
package/dist/api/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreateUnitRequest, CreateUnitResponse, CreateRepoRequest, CreateRepoResponse, StorageUnit, CreateRepoKeyRequest, CreateRepoKeyResponse, GetUnitsResponse, GetReposResponse, GetRepoKeysResponse, UpdateUnitRequest, UpdateUnitResponse, ActionResponse, UpdateRepoRequest, UpdateRepoResponse, UpdateRepoKeyRequest, UpdateRepoKeyResponse, ValidateUnitRequest, ValidateUnitResponse, ValidateRepoUnitsRequest, ValidateRepoUnitsResponse, StorageUnitStatusResponse, GetUnitNodeStatsResponse, GetUnitNodeStatsRequest, CreateBucketRequest, CreateBucketResponse, UpdateBucketRequest, UpdateBucketResponse, ValidateBucketRequest, ValidateBucketResponse, StorageBucket, GetBucketsResponse, StorageBucketStatusResponse, GetBucketNodeStatsRequest, GetBucketNodeStatsResponse, CreateRepoWithBucketsRequest, UpdateRepoWithBucketsRequest, ValidateRepoBucketsRequest, ValidateRepoBucketsResponse } from './types/storage';
|
|
2
2
|
import { IApiClient, ProviderType } from './interfaces';
|
|
3
|
-
import { ActivateResponse, DeactivateResponse, LoginBody, LoginResponse, LogoutResponse, OAuth2ResponseDTO, RefreshTokenErrorResponse, RefreshTokenResponse, RegisterBody, RegisterResponse, ResetPasswordBody } from './types/auth';
|
|
3
|
+
import { ActivateResponse, DeactivateResponse, LoginBody, LoginResponse, LogoutResponse, OAuth2ResponseDTO, RefreshTokenErrorResponse, RefreshTokenResponse, RegisterBody, RegisterResponse, ResetPasswordBody, Web3RegisterBody } from './types/auth';
|
|
4
4
|
import { StatsQueryParams, StatsResponse, NodeStatsMinuteResponse, NodeStatsDailyResponse, NodeStatsQueryParams, UnitStatsResponse, RepoStatsResponse, NodeStatsDailyQueryParams, BucketStatsResponse, StatsQueryWithBucketParams, NodeStatsQueryWithBucketParams, NodeStatsDailyQueryWithBucketParams } from './types/stats';
|
|
5
5
|
import { NodeInfo } from './types/bridge';
|
|
6
6
|
import { QuotaResponse } from './types/quota';
|
|
@@ -33,10 +33,15 @@ export declare class ApiClient implements IApiClient {
|
|
|
33
33
|
* @returns The refreshed token
|
|
34
34
|
*/
|
|
35
35
|
refreshToken: (refreshToken: string, provider: ProviderType) => Promise<RefreshTokenResponse | RefreshTokenErrorResponse>;
|
|
36
|
-
private authenticateWeb3Stellar;
|
|
37
36
|
private makeRequest;
|
|
38
37
|
private authenticateGoogle;
|
|
39
38
|
private authenticateGithub;
|
|
39
|
+
/**
|
|
40
|
+
* Authenticate with a web3 provider
|
|
41
|
+
* @param data - The data to authenticate with
|
|
42
|
+
* @returns The authentication response
|
|
43
|
+
*/
|
|
44
|
+
web3Authenticate: (data: Web3RegisterBody) => Promise<any>;
|
|
40
45
|
private refreshGoogleToken;
|
|
41
46
|
private refreshGithubToken;
|
|
42
47
|
private exchangeGoogleCode;
|
package/dist/api/client.js
CHANGED
|
@@ -33,7 +33,7 @@ class ApiClient {
|
|
|
33
33
|
case interfaces_1.ProviderType.GITHUB:
|
|
34
34
|
return this.authenticateGithub(token);
|
|
35
35
|
case interfaces_1.ProviderType.WEB3_STELLAR:
|
|
36
|
-
|
|
36
|
+
throw new Error('Call web3Authenticate for web3 authentication');
|
|
37
37
|
case interfaces_1.ProviderType.LOCAL:
|
|
38
38
|
throw new Error('Call userLogin for local authentication');
|
|
39
39
|
default:
|
|
@@ -76,9 +76,6 @@ class ApiClient {
|
|
|
76
76
|
throw new Error(`Unsupported provider: ${provider}`);
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
|
-
this.authenticateWeb3Stellar = async (token) => {
|
|
80
|
-
throw new Error('Not implemented');
|
|
81
|
-
};
|
|
82
79
|
this.makeRequest = async (path, method, data) => {
|
|
83
80
|
const isFormData = data instanceof FormData;
|
|
84
81
|
const options = {
|
|
@@ -136,6 +133,14 @@ class ApiClient {
|
|
|
136
133
|
this.setAuthToken(code);
|
|
137
134
|
return this.makeRequest('auth/github', 'POST', { code });
|
|
138
135
|
};
|
|
136
|
+
/**
|
|
137
|
+
* Authenticate with a web3 provider
|
|
138
|
+
* @param data - The data to authenticate with
|
|
139
|
+
* @returns The authentication response
|
|
140
|
+
*/
|
|
141
|
+
this.web3Authenticate = async (data) => {
|
|
142
|
+
return this.makeRequest('auth/web3', 'POST', data);
|
|
143
|
+
};
|
|
139
144
|
this.refreshGoogleToken = async (refreshToken) => {
|
|
140
145
|
return this.makeRequest('auth/google/refresh', 'POST', {
|
|
141
146
|
refresh_token: refreshToken,
|
package/dist/api/types/auth.d.ts
CHANGED
|
@@ -35,6 +35,12 @@ export interface JwtPayload {
|
|
|
35
35
|
iat?: number;
|
|
36
36
|
exp?: number;
|
|
37
37
|
}
|
|
38
|
+
export interface Web3RegisterBody {
|
|
39
|
+
address: string;
|
|
40
|
+
network: string;
|
|
41
|
+
signature: string;
|
|
42
|
+
nonce: string;
|
|
43
|
+
}
|
|
38
44
|
export interface RegisterBody {
|
|
39
45
|
email: string;
|
|
40
46
|
password: string;
|