github.com/keybase/client/go@v0.0.0-20240309051027-028f7c731f8b/kbfs/libgit/config.go (about)

     1  // Copyright 2017 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 libgit
     6  
     7  import "encoding/json"
     8  
     9  // Config is a KBFS git repo config file.
    10  type Config struct {
    11  	ID         ID
    12  	Name       string // the original user-supplied format of the name
    13  	CreatorUID string
    14  	Ctime      int64 // create time in unix nanoseconds, by creator's clock
    15  }
    16  
    17  func configFromBytes(buf []byte) (*Config, error) {
    18  	var c Config
    19  	err := json.Unmarshal(buf, &c)
    20  	if err != nil {
    21  		return nil, err
    22  	}
    23  	return &c, nil
    24  }
    25  
    26  func (c *Config) toBytes() ([]byte, error) {
    27  	return json.MarshalIndent(c, "", " ")
    28  }