File tree Expand file tree Collapse file tree 1 file changed +11
-24
lines changed
Expand file tree Collapse file tree 1 file changed +11
-24
lines changed Original file line number Diff line number Diff line change @@ -112,30 +112,6 @@ export async function saveAuthToken(
112112 }
113113}
114114
115- /**
116- * Checks if the user is authenticated by validating the stored auth token.
117- *
118- * License is validated separately
119- *
120- * @returns boolean indicating if the authentication is valid
121- */
122- export async function checkIsAuthenticated ( ) {
123- try {
124- const authJson = await fs . readFile ( LOCALSTACK_AUTH_FILENAME , "utf-8" ) ;
125- const authObject = JSON . parse ( authJson ) as unknown ;
126- if ( ! isAuthTokenPresent ( authObject ) ) {
127- return false ;
128- }
129- const authToken = authObject [ AUTH_TOKEN_KEY ] ;
130- if ( typeof authToken !== "string" ) {
131- return false ;
132- }
133- return true ;
134- } catch {
135- return false ;
136- }
137- }
138-
139115function isAuthTokenPresent ( authObject : unknown ) {
140116 return (
141117 typeof authObject === "object" &&
@@ -161,3 +137,14 @@ export async function readAuthToken(): Promise<string> {
161137 return "" ;
162138 }
163139}
140+
141+ /**
142+ * Checks if the user is authenticated by validating the stored auth token.
143+ *
144+ * License is validated separately
145+ *
146+ * @returns boolean indicating if the authentication is valid
147+ */
148+ export async function checkIsAuthenticated ( ) {
149+ return ( await readAuthToken ( ) ) !== "" ;
150+ }
You can’t perform that action at this time.
0 commit comments