admin:org
scope to use this endpoint.
from base64 import b64encode
from nacl import encoding, public
def encrypt(public_key: str, secret_value: str) -> str:
"""Encrypt a Unicode string using the public key."""
public_key = public.PublicKey(public_key.encode("utf-8"), encoding.Base64Encoder())
sealed_box = public.SealedBox(public_key)
encrypted = sealed_box.encrypt(secret_value.encode("utf-8"))
return b64encode(encrypted).decode("utf-8")
var secretValue = System.Text.Encoding.UTF8.GetBytes("mySecret");
var publicKey = Convert.FromBase64String("2Sg8iYjAxxmI2LvUXpJjkYrMxURPc8r+dB7TJyvvcCU=");
var sealedPublicKeyBox = Sodium.SealedPublicKeyBox.Create(secretValue, publicKey);
Console.WriteLine(Convert.ToBase64String(sealedPublicKeyBox));
curl --location --request PUT 'https://api.github.com/orgs//codespaces/secrets/' \
--header 'Content-Type: application/json' \
--data-raw '{
"encrypted_value": "c2VjcmV0",
"key_id": "012345678912345678",
"selected_repository_ids": [
1296269,
1296280
],
"visibility": "selected"
}'
null
visibility
is set to selected
. You can manage the list of selected repositories using the List selected repositories for an organization secret, Set selected repositories for an organization secret, and Remove selected repository from an organization secret endpoints.selected
means only the repositories specified by selected_repository_ids
can access the secret.