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 @@ -124,30 +124,6 @@ export async function saveAuthToken(
124124 }
125125}
126126
127- /**
128- * Checks if the user is authenticated by validating the stored auth token.
129- *
130- * License is validated separately
131- *
132- * @returns boolean indicating if the authentication is valid
133- */
134- export async function checkIsAuthenticated ( ) {
135- try {
136- const authJson = await fs . readFile ( LOCALSTACK_AUTH_FILENAME , "utf-8" ) ;
137- const authObject = JSON . parse ( authJson ) as unknown ;
138- if ( ! isAuthTokenPresent ( authObject ) ) {
139- return false ;
140- }
141- const authToken = authObject [ AUTH_TOKEN_KEY ] ;
142- if ( typeof authToken !== "string" ) {
143- return false ;
144- }
145- return true ;
146- } catch {
147- return false ;
148- }
149- }
150-
151127function isAuthTokenPresent ( authObject : unknown ) {
152128 return (
153129 typeof authObject === "object" &&
@@ -173,3 +149,14 @@ export async function readAuthToken(): Promise<string> {
173149 return "" ;
174150 }
175151}
152+
153+ /**
154+ * Checks if the user is authenticated by validating the stored auth token.
155+ *
156+ * License is validated separately
157+ *
158+ * @returns boolean indicating if the authentication is valid
159+ */
160+ export async function checkIsAuthenticated ( ) {
161+ return ( await readAuthToken ( ) ) !== "" ;
162+ }
You can’t perform that action at this time.
0 commit comments