@redzone/taunt-logins 0.0.10 → 0.0.11

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.
@@ -658,6 +658,22 @@ class TauntApi {
658
658
  }
659
659
  return Promise.reject(ErrorFromResponse(error.response));
660
660
  };
661
+ this.setLoginDetails = async (props, checkGet = true)=>{
662
+ this.accessToken = props.accessToken;
663
+ this.refreshToken = props.refreshToken;
664
+ if (checkGet) {
665
+ const user = await this.getLoggedInUser();
666
+ if (!user) {
667
+ this.accessToken = null;
668
+ this.refreshToken = null;
669
+ return null;
670
+ }
671
+ }
672
+ return {
673
+ accessToken: this.accessToken,
674
+ refreshToken: this.refreshToken
675
+ };
676
+ };
661
677
  this.nonceLogin = (walletAddress, clientNonce)=>this.post("/v1/auth/nonce/login", {
662
678
  walletAddress,
663
679
  clientNonce
@@ -295,6 +295,10 @@ type TauntSigProps = {
295
295
  type TauntExtSigProps = TauntSigProps & {
296
296
  extNonce?: string;
297
297
  };
298
+ type TauntAccessDetails = {
299
+ accessToken: string;
300
+ refreshToken: string;
301
+ };
298
302
  type TauntRespType = {
299
303
  accessToken: string;
300
304
  refreshToken: string;
@@ -327,6 +331,10 @@ declare class TauntApi {
327
331
  response: AxiosResponse;
328
332
  }) => Promise<AxiosResponse<any, any, {}>>;
329
333
  private _api;
334
+ setLoginDetails: (props: TauntAccessDetails, checkGet?: boolean) => Promise<{
335
+ accessToken: string;
336
+ refreshToken: string;
337
+ } | null>;
330
338
  post<T = TauntRespType>(url: string, body?: {}, headers?: {}): Promise<T>;
331
339
  get<T = TauntRespType>(url: string, headers?: {}): Promise<T>;
332
340
  nonceLogin: (walletAddress: string, clientNonce: string) => Promise<string>;
@@ -405,4 +413,4 @@ declare function tauntMetamaskLogin(tauntServiceEndpoint: string, provider?: Bas
405
413
  }>;
406
414
 
407
415
  export { BadGatewayError, BadRequestError, BandwidthLimitExceededError, ConflictError, ErrorFromResponse, ErrorResponse, ExpectationFailedError, FailedDependencyError, ForbiddenError, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, ImATeapotError, InsufficientStorageError, InternalServerError, LengthRequiredError, LockedError, LoopDetectedError, MethodNotAllowedError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, PaymentRequiredError, PreconditionFailedError, PreconditionRequiredError, ProxyAuthenticationRequiredError, RequestEntityTooLargeError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, RequestUriTooLongError, RequestedRangeNotSatisfiableError, ServiceUnavailableError, TauntApi, TooManyRequestsError, UnauthorizedError, UnknownError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, VariantAlsoNegotiatesError, emailOTPWithMagic, tauntMagicEmailOTPLogin, tauntMagicTelegramLogin, tauntMetamaskLogin, telegramWithMagic };
408
- export type { ClaimrCampaignData, TauntExtSigProps, TauntSigProps, TauntUser };
416
+ export type { ClaimrCampaignData, TauntAccessDetails, TauntExtSigProps, TauntSigProps, TauntUser };
@@ -295,6 +295,10 @@ type TauntSigProps = {
295
295
  type TauntExtSigProps = TauntSigProps & {
296
296
  extNonce?: string;
297
297
  };
298
+ type TauntAccessDetails = {
299
+ accessToken: string;
300
+ refreshToken: string;
301
+ };
298
302
  type TauntRespType = {
299
303
  accessToken: string;
300
304
  refreshToken: string;
@@ -327,6 +331,10 @@ declare class TauntApi {
327
331
  response: AxiosResponse;
328
332
  }) => Promise<AxiosResponse<any, any, {}>>;
329
333
  private _api;
334
+ setLoginDetails: (props: TauntAccessDetails, checkGet?: boolean) => Promise<{
335
+ accessToken: string;
336
+ refreshToken: string;
337
+ } | null>;
330
338
  post<T = TauntRespType>(url: string, body?: {}, headers?: {}): Promise<T>;
331
339
  get<T = TauntRespType>(url: string, headers?: {}): Promise<T>;
332
340
  nonceLogin: (walletAddress: string, clientNonce: string) => Promise<string>;
@@ -405,4 +413,4 @@ declare function tauntMetamaskLogin(tauntServiceEndpoint: string, provider?: Bas
405
413
  }>;
406
414
 
407
415
  export { BadGatewayError, BadRequestError, BandwidthLimitExceededError, ConflictError, ErrorFromResponse, ErrorResponse, ExpectationFailedError, FailedDependencyError, ForbiddenError, GatewayTimeoutError, GoneError, HTTPVersionNotSupportedError, ImATeapotError, InsufficientStorageError, InternalServerError, LengthRequiredError, LockedError, LoopDetectedError, MethodNotAllowedError, NetworkAuthenticationRequiredError, NotAcceptableError, NotExtendedError, NotFoundError, NotImplementedError, PaymentRequiredError, PreconditionFailedError, PreconditionRequiredError, ProxyAuthenticationRequiredError, RequestEntityTooLargeError, RequestHeaderFieldsTooLargeError, RequestTimeoutError, RequestUriTooLongError, RequestedRangeNotSatisfiableError, ServiceUnavailableError, TauntApi, TooManyRequestsError, UnauthorizedError, UnknownError, UnprocessableEntityError, UnsupportedMediaTypeError, UpgradeRequiredError, VariantAlsoNegotiatesError, emailOTPWithMagic, tauntMagicEmailOTPLogin, tauntMagicTelegramLogin, tauntMetamaskLogin, telegramWithMagic };
408
- export type { ClaimrCampaignData, TauntExtSigProps, TauntSigProps, TauntUser };
416
+ export type { ClaimrCampaignData, TauntAccessDetails, TauntExtSigProps, TauntSigProps, TauntUser };
package/dist/es/index.js CHANGED
@@ -652,6 +652,22 @@ class TauntApi {
652
652
  }
653
653
  return Promise.reject(ErrorFromResponse(error.response));
654
654
  };
655
+ this.setLoginDetails = async (props, checkGet = true)=>{
656
+ this.accessToken = props.accessToken;
657
+ this.refreshToken = props.refreshToken;
658
+ if (checkGet) {
659
+ const user = await this.getLoggedInUser();
660
+ if (!user) {
661
+ this.accessToken = null;
662
+ this.refreshToken = null;
663
+ return null;
664
+ }
665
+ }
666
+ return {
667
+ accessToken: this.accessToken,
668
+ refreshToken: this.refreshToken
669
+ };
670
+ };
655
671
  this.nonceLogin = (walletAddress, clientNonce)=>this.post("/v1/auth/nonce/login", {
656
672
  walletAddress,
657
673
  clientNonce
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@redzone/taunt-logins",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "files": [