Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CertLib ¶
type CertLib struct {
Config *Config
}
CertLib provides methods for requesting certificates.
func NewCertLib ¶
NewCertLib creates a new CertLib instance with the given configuration.
func (*CertLib) RequestCertificates ¶
func (c *CertLib) RequestCertificates( ethAddress *common.Address, privateKey *ecdsa.PrivateKey, clientSecret string, oauthURL string, stepCAUrl string, fingerprint string, connectionAddr string, ) (string, string, error)
RequestCertificates requests a certificate from step-ca using the provided parameters. It performs the following steps: 1. Retrieves an OAuth token by signing a challenge with the provided Ethereum private key. 2. Uses the token to create and sign a certificate request with step-ca. 3. Returns the signed certificate and private key in PEM format.
Parameters: - ethAddress: The Ethereum address used to sign the challenge. - privateKey: The private key corresponding to the Ethereum address. - clientSecret: The client secret for OAuth authentication. - oauthURL: The URL of the OAuth server to generate and submit the challenge. - stepCAUrl: The URL of the step-ca server to sign the certificate. - fingerprint: The SHA256 fingerprint of the step-ca root certificate. - connectionAddr: The connection address to be included in the certificate's Common Name.
Returns: - A string containing the signed certificate in PEM format. - A string containing the private key in PEM format. - An error if any step in the process fails.
type ChallengeResponse ¶
type Config ¶
type Config struct {
Domain string
ClientID string
ResponseType string
Scope string
GenerateChallengeURI string
SubmitChallengeURI string
GrantType string
PrivateKeyPEMType string
CertificatePEMType string
Logger zerolog.Logger
HTTPClient *http.Client
}
Config holds the configuration for the certificate library.
func NewDefaultConfig ¶
func NewDefaultConfig() *Config
NewDefaultConfig creates a default configuration.
type TokenResponse ¶
type TokenResponse struct {
AccessToken string `json:"access_token"`
}