github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/git/interfaces.go (about) 1 package git 2 3 import ( 4 "github.com/keybase/client/go/protocol/keybase1" 5 "golang.org/x/net/context" 6 ) 7 8 // Teamer handles teams for use with the Git index 9 type Teamer interface { 10 // LookupOrCreate either lookups or creates a team that corresponds to the given Folder 11 // Does not create new named teams. 12 LookupOrCreate(ctx context.Context, folder keybase1.FolderHandle) (teamID keybase1.TeamIDWithVisibility, err error) 13 } 14 15 // Cryptoer handles crypto operations to encrypt and decrypt data as it is 16 // sent to or received from the server-side Git index. 17 type Cryptoer interface { 18 // Box encrypts the plaintext with the most current key for the given team. It yields a NaCl 19 // ciphertext and nonce, and also says which generation of the key it used. 20 Box(ctx context.Context, plaintext []byte, team keybase1.TeamIDWithVisibility) (*keybase1.EncryptedGitMetadata, error) 21 // Unbox decrypts the given ciphertext with the given nonce, for the given generation of the 22 // given team. Can return an error. Will return a non-nil plaintext on success. 23 Unbox(ctx context.Context, team keybase1.TeamIDWithVisibility, metadata *keybase1.EncryptedGitMetadata) (plaintext []byte, err error) 24 }