@redzone/taunt-logins 0.0.10 → 0.0.12
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/cjs/index.cjs +19 -3
- package/dist/cjs/index.d.cts +9 -1
- package/dist/es/index.d.ts +9 -1
- package/dist/es/index.js +19 -3
- package/package.json +5 -5
package/dist/cjs/index.cjs
CHANGED
|
@@ -519,7 +519,7 @@ class TauntApi {
|
|
|
519
519
|
try {
|
|
520
520
|
signature = await provider.personalSign(message, walletAddress);
|
|
521
521
|
} catch (err) {
|
|
522
|
-
throw new Error(
|
|
522
|
+
throw new Error(`User denied message signature, ${err}`);
|
|
523
523
|
}
|
|
524
524
|
if (!signature) {
|
|
525
525
|
throw new Error("No signature returned");
|
|
@@ -647,17 +647,33 @@ class TauntApi {
|
|
|
647
647
|
originalRequest._retry = true;
|
|
648
648
|
console.log("401 - refreshing token");
|
|
649
649
|
try {
|
|
650
|
-
|
|
650
|
+
await this.refresh();
|
|
651
651
|
return this._axios(originalRequest);
|
|
652
652
|
} catch (error) {
|
|
653
653
|
console.log("Unable to refresh access token, please log in");
|
|
654
654
|
this.refreshToken = null;
|
|
655
|
-
window.location.href = "/"
|
|
655
|
+
// window.location.href = "/"
|
|
656
656
|
return Promise.reject(error);
|
|
657
657
|
}
|
|
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
|
package/dist/cjs/index.d.cts
CHANGED
|
@@ -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.d.ts
CHANGED
|
@@ -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
|
@@ -513,7 +513,7 @@ class TauntApi {
|
|
|
513
513
|
try {
|
|
514
514
|
signature = await provider.personalSign(message, walletAddress);
|
|
515
515
|
} catch (err) {
|
|
516
|
-
throw new Error(
|
|
516
|
+
throw new Error(`User denied message signature, ${err}`);
|
|
517
517
|
}
|
|
518
518
|
if (!signature) {
|
|
519
519
|
throw new Error("No signature returned");
|
|
@@ -641,17 +641,33 @@ class TauntApi {
|
|
|
641
641
|
originalRequest._retry = true;
|
|
642
642
|
console.log("401 - refreshing token");
|
|
643
643
|
try {
|
|
644
|
-
|
|
644
|
+
await this.refresh();
|
|
645
645
|
return this._axios(originalRequest);
|
|
646
646
|
} catch (error) {
|
|
647
647
|
console.log("Unable to refresh access token, please log in");
|
|
648
648
|
this.refreshToken = null;
|
|
649
|
-
window.location.href = "/"
|
|
649
|
+
// window.location.href = "/"
|
|
650
650
|
return Promise.reject(error);
|
|
651
651
|
}
|
|
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.
|
|
3
|
+
"version": "0.0.12",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
"magic-sdk": "^30.0.0"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@repo/typescript-config": "*",
|
|
38
37
|
"@ianvs/prettier-plugin-sort-imports": "^4.7.0",
|
|
38
|
+
"@repo/eslint-config": "*",
|
|
39
|
+
"@repo/typescript-config": "*",
|
|
39
40
|
"@types/chrome": "^0.1.16",
|
|
40
41
|
"@types/node": "^24.6.1",
|
|
41
42
|
"@vitejs/plugin-react": "^5.0.4",
|
|
42
|
-
"
|
|
43
|
-
"eslint": "
|
|
43
|
+
"bunchee": "^6.4.0",
|
|
44
|
+
"eslint": "^9.38.0",
|
|
44
45
|
"prettier": "latest",
|
|
45
46
|
"prettier-config-custom": "*",
|
|
46
|
-
"bunchee": "^6.4.0",
|
|
47
47
|
"tsup": "^8.5.0",
|
|
48
48
|
"typescript": "^5.9.3"
|
|
49
49
|
}
|