You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: main.go
    path of file: ./repos/go-github/example/codespaces/newusersecretwithxcrypto
    
    the code of the file until where you have to start completion: // Copyright 2023 The go-github AUTHORS. All rights reserved.
//
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

// newusersecretwithxcrypto creates a new secret in GitHub for a given user.
// newusersecretwithxcrypto uses x/crypto/nacl/box instead of sodium.
// It does not depend on any native libraries and is easier to cross-compile for different platforms.
// Quite possibly there is a performance penalty due to this.
//
// newusersecretwithxcrypto takes in one argument for the name of the secret to add, and 2 flags owner, repo.
// If owner/repo are defined then it adds the secret to that repository
// The secret value is pulled from an environment variable based on the secret name.
// To authenticate with Gi
    
func addUserSecret(ctx context.Context, client *github.Client, secretName, secretValue, owner, repo string) error {
	publicKey, _, err := client.Codespaces.GetUserPublicKey(ctx)
	if err != nil {
		return err
	}

	encryptedSecret, err := encryptSecretWithPublicKey(publicKey, secretName, secretValue)
	if err != nil {
		return err
	}

	if _, err := client.Codespaces.CreateOrUpdateUserSecret(ctx, encryptedSecret); err != nil {
		return fmt.Errorf("Codespaces.CreateOrUpdateUserSecret returned error: %v", err)
	}

	if owner != "" && repo != "" {
		r, _, err := client.Repositories.Get(ctx, owner, repo)
		if err != nil {
			return fmt.Errorf("Repositories.Get returned error: %v", err)
		}
		_, err = client.Codespaces.AddSelectedRepoToUserSecret(ctx, encryptedSecret.Name, r)
		if err != nil {
			return fmt.Errorf("Codespaces.AddSelectedRepoToUserSecret returned error: %v", err)
		}
		fmt.Printf("Added secret %q to %v/%v\n", secretName, owner, repo)
	}

	return nil
}