mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
cd890aa3a0
This PR contains the remaining logic necessary to hook up key rotation to the product.
26 lines
580 B
Go
26 lines
580 B
Go
package wsproxy
|
|
|
|
import (
|
|
"context"
|
|
|
|
"golang.org/x/xerrors"
|
|
|
|
"github.com/coder/coder/v2/coderd/cryptokeys"
|
|
"github.com/coder/coder/v2/codersdk"
|
|
"github.com/coder/coder/v2/enterprise/wsproxy/wsproxysdk"
|
|
)
|
|
|
|
var _ cryptokeys.Fetcher = &ProxyFetcher{}
|
|
|
|
type ProxyFetcher struct {
|
|
Client *wsproxysdk.Client
|
|
}
|
|
|
|
func (p *ProxyFetcher) Fetch(ctx context.Context, feature codersdk.CryptoKeyFeature) ([]codersdk.CryptoKey, error) {
|
|
keys, err := p.Client.CryptoKeys(ctx, feature)
|
|
if err != nil {
|
|
return nil, xerrors.Errorf("crypto keys: %w", err)
|
|
}
|
|
return keys.CryptoKeys, nil
|
|
}
|