remote

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Overview

Package remote provides remote config fetch with optional RSA decryption.

Index

Constants

View Source
const (
	// EncryptedContentType is the Content-Type value when response body is RSA+AES encrypted.
	EncryptedContentType = "application/x-warden-encrypted"
	// RSAKeySize2048 ciphertext block size in bytes.
	RSAKeySize2048 = 256
	// AESKeySize + IVSize = 32 + 16 = 48 bytes encrypted by RSA.
	AESKeySize = 32
	// IVSize is the AES CTR IV size in bytes.
	IVSize = 16
)

Variables

This section is empty.

Functions

func FetchDecrypted

func FetchDecrypted(ctx context.Context, url, authHeader string, decryptEnabled bool, rsaKeyPath, rsaKeyPEM string, timeout time.Duration, insecureTLS bool) ([]byte, error)

FetchDecrypted fetches url with optional auth header. If decryptEnabled and rsaKey (file path or PEM) are set, and response Content-Type is EncryptedContentType (or body looks like base64), decrypts with RSA private key. Expected encrypted format: base64( RSA_encrypt(aes_key_32 + iv_16) || aes_ctr_ciphertext ). Returns decrypted or raw body and error. rsaKeyPath and rsaKeyPEM: use file when rsaKeyPath is non-empty, else use rsaKeyPEM (inline PEM).

func FetchDecryptedUsers

func FetchDecryptedUsers(ctx context.Context, url, authHeader string, decryptEnabled bool, rsaKeyPath, rsaKeyPEM string, timeout time.Duration, insecureTLS bool) ([]define.AllowListUser, error)

FetchDecryptedUsers fetches remote URL and returns parsed []AllowListUser. If decrypt is enabled and response is encrypted, decrypts then parses JSON. rsaKeyPath and rsaKeyPEM: use file when rsaKeyPath is non-empty, else use rsaKeyPEM.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL