github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/kbfs/libfs/user_edit_history.go (about)

     1  // Copyright 2018 Keybase Inc. All rights reserved.
     2  // Use of this source code is governed by a BSD
     3  // license that can be found in the LICENSE file.
     4  
     5  package libfs
     6  
     7  import (
     8  	"context"
     9  	"time"
    10  
    11  	"github.com/keybase/client/go/kbfs/idutil"
    12  	"github.com/keybase/client/go/kbfs/libkbfs"
    13  )
    14  
    15  // GetEncodedUserEditHistory returns serialized JSON containing the
    16  // file edit history for the user.
    17  func GetEncodedUserEditHistory(ctx context.Context, config libkbfs.Config) (
    18  	data []byte, t time.Time, err error) {
    19  	session, err := idutil.GetCurrentSessionIfPossible(
    20  		ctx, config.KBPKI(), true)
    21  	if err != nil {
    22  		return nil, time.Time{}, err
    23  	}
    24  
    25  	edits := config.UserHistory().Get(string(session.Name))
    26  	data, err = PrettyJSON(edits)
    27  	return data, time.Time{}, err
    28  }