• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16import { HiLog } from '../../common/HiLog';
17
18const TAG: string = 'AuthAccount';
19
20export default class AuthorizedAccount {
21  private mUserAccount: string;
22  private mTimestamp: number;
23
24  constructor(userAccount: string, timestamp: number) {
25    this.mUserAccount = userAccount;
26    this.mTimestamp = timestamp;
27  }
28
29  public getUserAccount(): string {
30    return this.mUserAccount;
31  }
32
33  public setUserAccount(userAccount: string): void {
34    this.mUserAccount = userAccount;
35  }
36
37  public getTimestamp(): number {
38    return this.mTimestamp;
39  }
40
41  public setTimestamp(timestamp: number): void {
42    if (isNaN(timestamp)) {
43      HiLog.error(TAG, 'The input timestamp is invalid.');
44      return;
45    }
46    this.mTimestamp = timestamp;
47  }
48}