export const UserStatuses: { [identityId: string]: UserStatusType | null } = {}
  @expose()
  async get(args: { identityIds: string[] }): Promise<UserStatusType[]> {
    const missingStatusIdentityIds: string[] = []
    const userStatuses: UserStatusType[] = []

    for (const identityId of args.identityIds) {
      const userStatus = UserStatuses[identityId]
      console.log("=================handler identityIds===================")
      console.log(identityId)
      console.log("=================end handler identityIds===================")
      if (!userStatus) {
        missingStatusIdentityIds.push(identityId)
      } else if (userStatus.lastSeenTime + 60 * 1000 < Date.now()) {
        missingStatusIdentityIds.push(identityId)
      } else {
        userStatuses.push(userStatus)
      }
    }

    if (missingStatusIdentityIds.length) {
      const hostedStatuses = await this.context
        .connect()
        .request("UserStatusHandler")
        .get({ identityIds: missingStatusIdentityIds })

      const allDevicesSignaturePublicKeyIds = DeviceUtils.getAllEncryptionKeys(
        this.context.wallet.devices,
      ).map((publicKey) => publicKey.id)

      for (const hostedStatus of hostedStatuses) {
        if (hostedStatus.encryptedSecret) {
          if (
            CryptoUtils.hasJWERecipients(
              hostedStatus.encryptedSecret,
              allDevicesSignaturePublicKeyIds,
            )
          ) {
            // todo: make sure to store all keys in the wallet
            //  and during decryption use proper key
            const decryptedSecret = this.context.wallet.decryptByDevice(
              hostedStatus.encryptedSecret,
            ) as string

            const userStatusKeyPair = CryptoUtils.generateKeyPair(
              "x25519",
              "user-status",
              StringUtils.utf8ToBytes(decryptedSecret),
            )

            const userStatus: UserStatusType = {
              id: hostedStatus.id,
              text: hostedStatus.text
                ? (CryptoUtils.decrypt(hostedStatus.text as JWE, [
                    userStatusKeyPair,
                  ]) as string)
                : hostedStatus.text,
              emoji: hostedStatus.emoji
                ? (CryptoUtils.decrypt(hostedStatus.emoji as JWE, [
                    userStatusKeyPair,
                  ]) as string)
                : hostedStatus.emoji,
              lastSeenTime: CryptoUtils.decrypt(
                hostedStatus.lastSeenTime as JWE,
                [userStatusKeyPair],
              ) as number,
            }

            UserStatuses[hostedStatus.id] = userStatus
            userStatuses.push(userStatus)
          } else {
            UserStatuses[hostedStatus.id] = null
          }
        } else {
          const userStatus: UserStatusType = {
            id: hostedStatus.id,
            text: hostedStatus.text as string | null,
            emoji: hostedStatus.emoji as string | null,
            lastSeenTime: hostedStatus.lastSeenTime as number,
          }

          UserStatuses[hostedStatus.id] = userStatus
          userStatuses.push(userStatus)
        }
      }
    }

    return userStatuses
  }
the issue  const userStatus = UserStatuses[identityId] here, there is identityId but userStatus giving null, why is it null ?