forked from ava-labs/avalanchego-kurtosis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
static_gecko_cert_provider.go
25 lines (20 loc) · 1021 Bytes
/
static_gecko_cert_provider.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// (c) 2021, Ava Labs, Inc. All rights reserved.
// See the file LICENSE for licensing terms.
package certs
import "bytes"
// StaticAvalancheCertProvider implements AvalancheCertProvider and provides the same cert every time
type StaticAvalancheCertProvider struct {
key bytes.Buffer
cert bytes.Buffer
}
// NewStaticAvalancheCertProvider creates an instance of StaticAvalancheCertProvider using the given key and cert
// Args:
// key: The private key that the StaticAvalancheCertProvider will return on every call to GetCertAndKey
// cert: The cert that will be returned on every call to GetCertAndKey
func NewStaticAvalancheCertProvider(key bytes.Buffer, cert bytes.Buffer) *StaticAvalancheCertProvider {
return &StaticAvalancheCertProvider{key: key, cert: cert}
}
// GetCertAndKey returns the same cert and key that was configured at the time of construction
func (s StaticAvalancheCertProvider) GetCertAndKey() (certPemBytes bytes.Buffer, keyPemBytes bytes.Buffer, err error) {
return s.cert, s.key, nil
}