Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultSocketDir ¶
DefaultSocketDir returns the path to the user-private directory for agent sockets. The directory is created with 0700 permissions if it doesn't exist. On Linux, it uses $XDG_RUNTIME_DIR/signet (typically /run/user/<uid>/signet). On other platforms (macOS, etc.), it uses $HOME/.signet/run.
func DefaultSocketPath ¶
DefaultSocketPath generates a secure default socket path with a random suffix. The socket is placed in a user-private directory (0700) with a cryptographically random 8-byte hex suffix to prevent path prediction attacks.
Types ¶
type AgentClient ¶
type AgentClient struct {
pb.SignetAgentClient
// contains filtered or unexported fields
}
AgentClient wraps a gRPC client connection and implements io.Closer. This ensures proper resource cleanup even during panics.
func NewClient ¶
func NewClient(ctx context.Context) (*AgentClient, error)
NewClient connects to the Signet agent via its Unix socket and returns an AgentClient. The caller MUST call Close() when done to avoid leaking the connection.
The provided context is used only for the initial connection establishment (2s timeout). Individual RPC calls should use their own context with appropriate timeouts:
client, err := agent.NewClient(ctx)
if err != nil {
return err
}
defer client.Close()
// Use per-RPC timeout
rpcCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
defer cancel()
resp, err := client.ListIdentities(rpcCtx, &emptypb.Empty{})
func (*AgentClient) Close ¶
func (c *AgentClient) Close() error
Close closes the underlying gRPC connection.
type Server ¶
type Server struct {
pb.UnimplementedSignetAgentServer
// contains filtered or unexported fields
}
Server implements the SignetAgent gRPC service. It holds the resources needed to perform signing operations, such as loaded keys and an OIDC token cache.
func NewServer ¶
func NewServer() *Server
NewServer creates a new instance of the agent server. For production use - loads real keys from keystore.
func NewServerForTesting ¶
func NewServerForTesting() *Server
NewServerForTesting creates a server with dummy test identities. This should only be used in tests.
func (*Server) ListIdentities ¶
func (s *Server) ListIdentities(ctx context.Context, req *emptypb.Empty) (*pb.ListIdentitiesResponse, error)
ListIdentities returns the list of keys available to the agent.
func (*Server) Sign ¶
func (s *Server) Sign(ctx context.Context, req *pb.SignRequest) (*pb.SignResponse, error)
Sign performs a signing operation using a loaded key.