repo
scope to use this endpoint. GitHub Apps must have the secrets
repository permission to use
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/repos///actions/secrets/' \
--header 'Content-Type: application/json' \
--data-raw '{
"encrypted_value": "c2VjcmV0",
"key_id": "012345678912345678"
}'
{}
Authorization: Bearer ********************
【GitHub】API开发者 微信交流群
用微信扫右侧二维码,加入【GitHub】API开发者 交流群,互助沟通