@citrineos/base
Version:
The base module for OCPP v2.0.1 including all interfaces. This module is not intended to be used directly, but rather as a dependency for other modules.
45 lines • 1.16 kB
JavaScript
// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
//
// SPDX-License-Identifier: Apache-2.0
/**
* Result of authentication process
*/
export class ApiAuthenticationResult {
/**
* Whether authentication was successful
*/
isAuthenticated = false;
/**
* User information if authentication was successful
*/
user;
/**
* Error message if authentication failed
*/
error;
/**
* Creates a new successful authentication result
*
* @param user Authenticated user information
* @returns Authentication result
*/
static success(user) {
const result = new ApiAuthenticationResult();
result.isAuthenticated = true;
result.user = user;
return result;
}
/**
* Creates a new failed authentication result
*
* @param error Error message
* @returns Authentication result
*/
static failure(error) {
const result = new ApiAuthenticationResult();
result.isAuthenticated = false;
result.error = error;
return result;
}
}
//# sourceMappingURL=ApiAuthenticationResult.js.map