Documentation
¶
Index ¶
- Variables
- type APIError
- type Client
- func (u Client) AddFederationServer(ctx context.Context, servers []tapsdk.FederationServer) error
- func (w Client) AddrReceives(ctx context.Context, query *tapsdk.AddressReceivesQuery) ([]*tapsdk.AddressEvent, error)
- func (w Client) AnchorVirtualPsbts(ctx context.Context, signedPsbts [][]byte) (*tapsdk.AssetTransfer, error)
- func (u Client) AssetLeafKeys(ctx context.Context, req *tapsdk.AssetLeafKeysRequest) ([]tapsdk.AssetLeafKey, error)
- func (u Client) AssetLeaves(ctx context.Context, id *tapsdk.UniverseID) ([]tapsdk.AssetLeaf, error)
- func (u Client) AssetRoots(ctx context.Context, req *tapsdk.AssetRootRequest) (map[string]*tapsdk.UniverseRoot, error)
- func (w Client) BurnAsset(ctx context.Context, req *tapsdk.BurnAssetRequest) (*tapsdk.BurnAssetResponse, error)
- func (m Client) CancelBatch(ctx context.Context) (*tapsdk.CancelBatchResponse, error)
- func (c *Client) Close() error
- func (w Client) CommitVirtualPsbts(ctx context.Context, virtualPsbts [][]byte, passivePsbts [][]byte, ...) (*tapsdk.CommittedTransfer, error)
- func (w Client) DeclareScriptKey(ctx context.Context, req *tapsdk.DeclareScriptKeyRequest) (*tapsdk.ScriptKey, error)
- func (w Client) DecodeAddr(ctx context.Context, addr string) (*tapsdk.Address, error)
- func (p Client) DecodeProof(ctx context.Context, rawProof []byte) (*tapsdk.DecodedProof, error)
- func (u Client) DeleteAssetRoot(ctx context.Context, id *tapsdk.UniverseID) error
- func (u Client) DeleteFederationServer(ctx context.Context, servers []tapsdk.FederationServer) error
- func (w Client) DeriveInternalKey(ctx context.Context) (*tapsdk.InternalKey, error)
- func (w Client) DeriveScriptKey(ctx context.Context) (*tapsdk.ScriptKey, error)
- func (w Client) ExportBackup(ctx context.Context, mode tapsdk.BackupMode) ([]byte, error)
- func (p Client) ExportProof(ctx context.Context, ref tapsdk.AssetRef, scriptKey tapsdk.PubKey, ...) (*tapsdk.ProofFile, error)
- func (w Client) FetchAssetMeta(ctx context.Context, req *tapsdk.FetchAssetMetaRequest) (*tapsdk.AssetMeta, error)
- func (m Client) FinalizeBatch(ctx context.Context, req *tapsdk.FinalizeBatchRequest) (*tapsdk.MintingBatch, error)
- func (m Client) FundBatch(ctx context.Context, req *tapsdk.FundBatchRequest) (*tapsdk.VerboseMintingBatch, error)
- func (w Client) FundInteractivePsbt(ctx context.Context, psbt []byte) (*tapsdk.FundedTransfer, error)
- func (w Client) FundTransfer(ctx context.Context, recipients []tapsdk.Recipient, inputs []tapsdk.PrevID) (*tapsdk.FundedTransfer, error)
- func (w Client) GetInfo(ctx context.Context) (*tapsdk.Info, error)
- func (w Client) ImportBackup(ctx context.Context, backup []byte) (uint32, error)
- func (u Client) Info(ctx context.Context) (*tapsdk.UniverseInfo, error)
- func (u Client) InsertProof(ctx context.Context, rawProof []byte, decoded *tapsdk.DecodedProof) error
- func (w Client) ListAssetGroups(ctx context.Context) ([]tapsdk.AssetGroupRecord, error)
- func (w Client) ListAssetRecords(ctx context.Context, req *tapsdk.ListAssetsRequest) ([]*tapsdk.AssetRecord, error)
- func (w Client) ListBalances(ctx context.Context, req *tapsdk.ListBalancesRequest) (*tapsdk.ListBalancesResponse, error)
- func (m Client) ListBatches(ctx context.Context, req *tapsdk.ListBatchesRequest) ([]*tapsdk.VerboseMintingBatch, error)
- func (w Client) ListBurns(ctx context.Context, req *tapsdk.ListBurnsRequest) ([]*tapsdk.BurnRecord, error)
- func (u Client) ListFederationServers(ctx context.Context) ([]tapsdk.FederationServer, error)
- func (w Client) ListTransfers(ctx context.Context, req *tapsdk.ListTransfersRequest) ([]*tapsdk.AssetTransfer, error)
- func (w Client) ListUtxos(ctx context.Context, req *tapsdk.ListUtxosRequest) (map[string]*tapsdk.ManagedUtxo, error)
- func (m Client) MintAsset(ctx context.Context, req *tapsdk.MintAssetRequest) (*tapsdk.MintingBatch, error)
- func (m Client) MintIssuance(ctx context.Context, req *tapsdk.MintIssuanceRequest) (*tapsdk.MintingBatch, error)
- func (w Client) NewAddr(ctx context.Context, req *tapsdk.NewAddressRequest) (*tapsdk.Address, error)
- func (w Client) ProveAssetOwnership(ctx context.Context, req *tapsdk.ProveOwnershipRequest) (*tapsdk.OwnershipProof, error)
- func (w Client) PublishAndLogTransfer(ctx context.Context, anchorPsbt []byte, virtualPsbts [][]byte, ...) (*tapsdk.AssetPacket, error)
- func (w Client) QueryAddrs(ctx context.Context, query *tapsdk.AddressQuery) ([]*tapsdk.Address, error)
- func (u Client) QueryAssetRoots(ctx context.Context, id *tapsdk.UniverseID) (*tapsdk.QueryRootResponse, error)
- func (u Client) QueryAssetStats(ctx context.Context, req *tapsdk.AssetStatsQuery) ([]tapsdk.AssetStatsSnapshot, error)
- func (u Client) QueryEvents(ctx context.Context, req *tapsdk.QueryEventsRequest) ([]tapsdk.GroupedUniverseEvents, error)
- func (u Client) QueryFederationSyncConfig(ctx context.Context, ids []tapsdk.UniverseID) (*tapsdk.FederationSyncConfig, error)
- func (w Client) QueryInternalKey(ctx context.Context, internalKey []byte) (*tapsdk.KeyDescriptor, error)
- func (u Client) QueryProof(ctx context.Context, key *tapsdk.UniverseKey) (*tapsdk.AssetProofResponse, error)
- func (w Client) QueryScriptKey(ctx context.Context, tweakedScriptKey []byte) (*tapsdk.ScriptKey, error)
- func (p Client) RegisterTransfer(ctx context.Context, assetRef tapsdk.AssetRef, scriptKey tapsdk.PubKey, ...) (*tapsdk.RegisteredAsset, error)
- func (p Client) RegisterTransferWithIssuance(ctx context.Context, assetRef tapsdk.AssetRef, issuanceID tapsdk.AssetID, ...) (*tapsdk.RegisteredAsset, error)
- func (w Client) RemoveUTXOLease(ctx context.Context, outpoint tapsdk.Outpoint) error
- func (m Client) SealBatch(ctx context.Context, req *tapsdk.SealBatchRequest) (*tapsdk.MintingBatch, error)
- func (w Client) SendAsset(ctx context.Context, req *tapsdk.SendAssetRequest) (*tapsdk.AssetTransfer, error)
- func (u Client) SetFederationSyncConfig(ctx context.Context, global []tapsdk.GlobalFederationSyncConfig, ...) error
- func (w Client) SignVirtualPsbt(ctx context.Context, fundedPsbt []byte) ([]byte, error)
- func (c Client) SubscribeMintEvents(ctx context.Context, req *tapsdk.SubscribeMintEventsRequest) (<-chan *tapsdk.MintEvent, <-chan error, error)
- func (c Client) SubscribeReceiveEvents(ctx context.Context, req *tapsdk.SubscribeReceiveEventsRequest) (<-chan *tapsdk.ReceiveEventRecord, <-chan error, error)
- func (c Client) SubscribeSendEvents(ctx context.Context, req *tapsdk.SubscribeSendEventsRequest) (<-chan *tapsdk.SendEventRecord, <-chan error, error)
- func (u Client) SyncUniverse(ctx context.Context, req *tapsdk.SyncRequest) ([]tapsdk.SyncedUniverse, error)
- func (u Client) UniverseStats(ctx context.Context) (*tapsdk.UniverseStats, error)
- func (p Client) UnpackProofFile(ctx context.Context, rawProofFile []byte) ([][]byte, error)
- func (w Client) VerifyAssetOwnership(ctx context.Context, req *tapsdk.VerifyOwnershipRequest) (*tapsdk.VerifyOwnershipResponse, error)
- func (w Client) VerifyProof(ctx context.Context, rawProofFile []byte) (*tapsdk.VerifyProofResponse, error)
- type Config
- type TLSSource
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedNetwork = errors.New("unsupported network")
ErrUnsupportedNetwork is returned when an unknown network is specified in the configuration.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
APIError represents an error returned by the tapd REST API.
func (*APIError) GRPCStatus ¶
GRPCStatus exposes the embedded gRPC code so callers can use the same status helpers as the native gRPC transport.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client holds the HTTP transport and sub-clients for communicating with the tapd REST API. It satisfies the same tapsdk.Client interface as grpc.Client.
func NewClient ¶
NewClient creates a REST-based Client that satisfies all tap-sdk sub-client interfaces. The Config mirrors grpc.Config but points at the REST endpoint (https://host:8089 by default).
func (Client) AddFederationServer ¶
func (u Client) AddFederationServer(ctx context.Context, servers []tapsdk.FederationServer) error
AddFederationServer adds servers to the federation.
func (Client) AddrReceives ¶
func (w Client) AddrReceives(ctx context.Context, query *tapsdk.AddressReceivesQuery) ( []*tapsdk.AddressEvent, error)
AddrReceives returns incoming transfer events for addresses.
func (Client) AnchorVirtualPsbts ¶
func (w Client) AnchorVirtualPsbts(ctx context.Context, signedPsbts [][]byte) (*tapsdk.AssetTransfer, error)
AnchorVirtualPsbts anchors signed virtual PSBTs in a single call.
func (Client) AssetLeafKeys ¶
func (u Client) AssetLeafKeys(ctx context.Context, req *tapsdk.AssetLeafKeysRequest) ( []tapsdk.AssetLeafKey, error)
AssetLeafKeys returns the set of leaf keys for a universe.
func (Client) AssetLeaves ¶
AssetLeaves returns the set of asset leaves for a universe.
func (Client) AssetRoots ¶
func (u Client) AssetRoots(ctx context.Context, req *tapsdk.AssetRootRequest) ( map[string]*tapsdk.UniverseRoot, error)
AssetRoots returns the known universe roots for all assets.
func (Client) BurnAsset ¶
func (w Client) BurnAsset(ctx context.Context, req *tapsdk.BurnAssetRequest) ( *tapsdk.BurnAssetResponse, error)
BurnAsset burns asset units.
func (Client) CancelBatch ¶
func (m Client) CancelBatch( ctx context.Context) (*tapsdk.CancelBatchResponse, error)
CancelBatch cancels the current mint batch.
func (*Client) Close ¶
Close is a no-op for REST clients (no persistent connection to close). It exists to satisfy the tapsdk.Client interface.
func (Client) CommitVirtualPsbts ¶
func (w Client) CommitVirtualPsbts(ctx context.Context, virtualPsbts [][]byte, passivePsbts [][]byte, feeRate tapsdk.FeeRate) (*tapsdk.CommittedTransfer, error)
CommitVirtualPsbts commits virtual transactions.
func (Client) DeclareScriptKey ¶
func (w Client) DeclareScriptKey(ctx context.Context, req *tapsdk.DeclareScriptKeyRequest) ( *tapsdk.ScriptKey, error)
DeclareScriptKey informs the wallet about an externally derived script key.
func (Client) DecodeAddr ¶
DecodeAddr decodes a bech32m Taproot Asset address string.
func (Client) DecodeProof ¶
DecodeProof decodes a raw proof and returns details about it.
func (Client) DeleteAssetRoot ¶
func (u Client) DeleteAssetRoot(ctx context.Context, id *tapsdk.UniverseID) error
DeleteAssetRoot deletes a universe root and all associated data.
func (Client) DeleteFederationServer ¶
func (u Client) DeleteFederationServer(ctx context.Context, servers []tapsdk.FederationServer) error
DeleteFederationServer removes servers from the federation.
func (Client) DeriveInternalKey ¶
func (w Client) DeriveInternalKey( ctx context.Context) (*tapsdk.InternalKey, error)
DeriveInternalKey derives a new internal key for anchor outputs.
func (Client) DeriveScriptKey ¶
DeriveScriptKey derives a new script key for receiving assets.
func (Client) ExportBackup ¶
ExportBackup exports an asset wallet backup blob.
func (Client) ExportProof ¶
func (p Client) ExportProof(ctx context.Context, ref tapsdk.AssetRef, scriptKey tapsdk.PubKey, outpoint *tapsdk.Outpoint) (*tapsdk.ProofFile, error)
ExportProof exports a proof file for a specific asset output.
func (Client) FetchAssetMeta ¶
func (w Client) FetchAssetMeta(ctx context.Context, req *tapsdk.FetchAssetMetaRequest) ( *tapsdk.AssetMeta, error)
FetchAssetMeta fetches the metadata for an asset.
func (Client) FinalizeBatch ¶
func (m Client) FinalizeBatch(ctx context.Context, req *tapsdk.FinalizeBatchRequest) ( *tapsdk.MintingBatch, error)
FinalizeBatch finalizes the current pending mint batch.
func (Client) FundBatch ¶
func (m Client) FundBatch(ctx context.Context, req *tapsdk.FundBatchRequest) ( *tapsdk.VerboseMintingBatch, error)
FundBatch funds the current pending mint batch.
func (Client) FundInteractivePsbt ¶
func (w Client) FundInteractivePsbt(ctx context.Context, psbt []byte) (*tapsdk.FundedTransfer, error)
FundInteractivePsbt funds a virtual PSBT for interactive sends.
func (Client) FundTransfer ¶
func (w Client) FundTransfer(ctx context.Context, recipients []tapsdk.Recipient, inputs []tapsdk.PrevID) (*tapsdk.FundedTransfer, error)
FundTransfer funds a virtual transaction using addresses.
func (Client) ImportBackup ¶
ImportBackup imports assets from a previously exported wallet backup blob.
func (Client) Info ¶
func (u Client) Info( ctx context.Context) (*tapsdk.UniverseInfo, error)
Info returns basic universe server information.
func (Client) InsertProof ¶
func (u Client) InsertProof(ctx context.Context, rawProof []byte, decoded *tapsdk.DecodedProof) error
InsertProof inserts a proof into the local universe.
func (Client) ListAssetGroups ¶
func (w Client) ListAssetGroups( ctx context.Context) ([]tapsdk.AssetGroupRecord, error)
ListAssetGroups lists all known asset groups.
func (Client) ListAssetRecords ¶
func (w Client) ListAssetRecords(ctx context.Context, req *tapsdk.ListAssetsRequest) ([]*tapsdk.AssetRecord, error)
ListAssetRecords lists wallet asset records with optional filtering.
func (Client) ListBalances ¶
func (w Client) ListBalances(ctx context.Context, req *tapsdk.ListBalancesRequest) ( *tapsdk.ListBalancesResponse, error)
ListBalances returns asset balances keyed by AssetRef.
func (Client) ListBatches ¶
func (m Client) ListBatches(ctx context.Context, req *tapsdk.ListBatchesRequest) ( []*tapsdk.VerboseMintingBatch, error)
ListBatches lists mint batches known to the daemon.
func (Client) ListBurns ¶
func (w Client) ListBurns(ctx context.Context, req *tapsdk.ListBurnsRequest) ([]*tapsdk.BurnRecord, error)
ListBurns lists asset burns with optional filtering.
func (Client) ListFederationServers ¶
func (u Client) ListFederationServers( ctx context.Context) ([]tapsdk.FederationServer, error)
ListFederationServers lists the universe federation peers.
func (Client) ListTransfers ¶
func (w Client) ListTransfers(ctx context.Context, req *tapsdk.ListTransfersRequest) ( []*tapsdk.AssetTransfer, error)
ListTransfers lists outgoing transfers with optional filtering.
func (Client) ListUtxos ¶
func (w Client) ListUtxos(ctx context.Context, req *tapsdk.ListUtxosRequest) ( map[string]*tapsdk.ManagedUtxo, error)
ListUtxos lists managed UTXOs with optional filtering.
func (Client) MintAsset ¶
func (m Client) MintAsset(ctx context.Context, req *tapsdk.MintAssetRequest) ( *tapsdk.MintingBatch, error)
MintAsset adds a brand-new asset to the pending mint batch.
func (Client) MintIssuance ¶
func (m Client) MintIssuance(ctx context.Context, req *tapsdk.MintIssuanceRequest) ( *tapsdk.MintingBatch, error)
MintIssuance adds an additional issuance to the pending mint batch.
func (Client) NewAddr ¶
func (w Client) NewAddr(ctx context.Context, req *tapsdk.NewAddressRequest) (*tapsdk.Address, error)
NewAddr creates a new Taproot Asset address.
func (Client) ProveAssetOwnership ¶
func (w Client) ProveAssetOwnership(ctx context.Context, req *tapsdk.ProveOwnershipRequest) ( *tapsdk.OwnershipProof, error)
ProveAssetOwnership generates a proof of ownership for an asset.
func (Client) PublishAndLogTransfer ¶
func (w Client) PublishAndLogTransfer(ctx context.Context, anchorPsbt []byte, virtualPsbts [][]byte, passivePsbts [][]byte, skipAnchorTxBroadcast bool) ( *tapsdk.AssetPacket, error)
PublishAndLogTransfer publishes the anchor transaction and logs the transfer.
func (Client) QueryAddrs ¶
func (w Client) QueryAddrs(ctx context.Context, query *tapsdk.AddressQuery) ([]*tapsdk.Address, error)
QueryAddrs returns addresses previously created by this tapd instance.
func (Client) QueryAssetRoots ¶
func (u Client) QueryAssetRoots(ctx context.Context, id *tapsdk.UniverseID) (*tapsdk.QueryRootResponse, error)
QueryAssetRoots queries the issuance and transfer roots for a specific asset.
func (Client) QueryAssetStats ¶
func (u Client) QueryAssetStats(ctx context.Context, req *tapsdk.AssetStatsQuery) ( []tapsdk.AssetStatsSnapshot, error)
QueryAssetStats returns per-asset statistics.
func (Client) QueryEvents ¶
func (u Client) QueryEvents(ctx context.Context, req *tapsdk.QueryEventsRequest) ( []tapsdk.GroupedUniverseEvents, error)
QueryEvents returns daily sync and proof event counts.
func (Client) QueryFederationSyncConfig ¶
func (u Client) QueryFederationSyncConfig( ctx context.Context, ids []tapsdk.UniverseID) ( *tapsdk.FederationSyncConfig, error)
QueryFederationSyncConfig queries the federation sync config.
func (Client) QueryInternalKey ¶
func (w Client) QueryInternalKey(ctx context.Context, internalKey []byte) (*tapsdk.KeyDescriptor, error)
QueryInternalKey looks up an internal key by its raw public key.
func (Client) QueryProof ¶
func (u Client) QueryProof(ctx context.Context, key *tapsdk.UniverseKey) (*tapsdk.AssetProofResponse, error)
QueryProof queries a specific proof from the universe.
func (Client) QueryScriptKey ¶
func (w Client) QueryScriptKey(ctx context.Context, tweakedScriptKey []byte) (*tapsdk.ScriptKey, error)
QueryScriptKey looks up a script key by its tweaked public key.
func (Client) RegisterTransfer ¶
func (p Client) RegisterTransfer(ctx context.Context, assetRef tapsdk.AssetRef, scriptKey tapsdk.PubKey, outpoint tapsdk.Outpoint) (*tapsdk.RegisteredAsset, error)
RegisterTransfer registers an inbound transfer for an interactive send.
func (Client) RegisterTransferWithIssuance ¶
func (p Client) RegisterTransferWithIssuance(ctx context.Context, assetRef tapsdk.AssetRef, issuanceID tapsdk.AssetID, scriptKey tapsdk.PubKey, outpoint tapsdk.Outpoint) (*tapsdk.RegisteredAsset, error)
RegisterTransferWithIssuance registers an inbound transfer when the user facing asset ref is a group key and tapd still needs the concrete issuance ID from the imported proof.
func (Client) RemoveUTXOLease ¶
RemoveUTXOLease removes a lease on a UTXO.
func (Client) SealBatch ¶
func (m Client) SealBatch(ctx context.Context, req *tapsdk.SealBatchRequest) ( *tapsdk.MintingBatch, error)
SealBatch seals a funded batch before finalization.
func (Client) SendAsset ¶
func (w Client) SendAsset(ctx context.Context, req *tapsdk.SendAssetRequest) ( *tapsdk.AssetTransfer, error)
SendAsset performs a one-shot address-based send.
func (Client) SetFederationSyncConfig ¶
func (u Client) SetFederationSyncConfig( ctx context.Context, global []tapsdk.GlobalFederationSyncConfig, asset []tapsdk.AssetFederationSyncConfig) error
SetFederationSyncConfig sets the federation sync configuration.
func (Client) SignVirtualPsbt ¶
SignVirtualPsbt signs a virtual transaction.
func (Client) SubscribeMintEvents ¶
func (c Client) SubscribeMintEvents(ctx context.Context, req *tapsdk.SubscribeMintEventsRequest) ( <-chan *tapsdk.MintEvent, <-chan error, error)
SubscribeMintEvents opens a WebSocket subscription for minting batch lifecycle events.
func (Client) SubscribeReceiveEvents ¶
func (c Client) SubscribeReceiveEvents(ctx context.Context, req *tapsdk.SubscribeReceiveEventsRequest) ( <-chan *tapsdk.ReceiveEventRecord, <-chan error, error)
SubscribeReceiveEvents opens a WebSocket subscription for incoming asset transfer events.
func (Client) SubscribeSendEvents ¶
func (c Client) SubscribeSendEvents(ctx context.Context, req *tapsdk.SubscribeSendEventsRequest) ( <-chan *tapsdk.SendEventRecord, <-chan error, error)
SubscribeSendEvents opens a WebSocket subscription for outgoing asset transfer events.
func (Client) SyncUniverse ¶
func (u Client) SyncUniverse(ctx context.Context, req *tapsdk.SyncRequest) ( []tapsdk.SyncedUniverse, error)
SyncUniverse synchronizes with a remote universe server.
func (Client) UniverseStats ¶
func (u Client) UniverseStats( ctx context.Context) (*tapsdk.UniverseStats, error)
UniverseStats returns aggregate statistics for the universe.
func (Client) UnpackProofFile ¶
UnpackProofFile unpacks a proof file into individual proofs.
func (Client) VerifyAssetOwnership ¶
func (w Client) VerifyAssetOwnership(ctx context.Context, req *tapsdk.VerifyOwnershipRequest) ( *tapsdk.VerifyOwnershipResponse, error)
VerifyAssetOwnership verifies an asset ownership proof.
func (Client) VerifyProof ¶
func (w Client) VerifyProof(ctx context.Context, rawProofFile []byte) ( *tapsdk.VerifyProofResponse, error)
VerifyProof verifies a proof file.
type Config ¶
type Config struct {
// BaseURL is the base URL of the tapd REST API, e.g.
// "https://localhost:8089". The scheme must be https.
BaseURL string
// Network is the bitcoin network we expect the tapd instance to
// operate on. Used for resolving default macaroon paths.
Network tapsdk.Network
// Macaroon chooses where the SDK reads authentication
// macaroons from. Obtain values from macaroon.FromPath,
// macaroon.FromDir, or macaroon.FromHex. When nil, the SDK
// falls back to tapd's default per-network directory under
// ~/.tapd.
Macaroon macaroon.Source
// TLS chooses how the SDK builds its TLS trust configuration.
// Obtain values from TLSFromPath, TLSFromData, TLSSystemCert,
// or TLSInsecure. When nil, the SDK falls back to tapd's
// default tls.cert path under ~/.tapd.
TLS TLSSource
// TLSMinVersion sets the minimum TLS version the client will accept.
// Defaults to TLS 1.2 when zero. Use crypto/tls constants
// (tls.VersionTLS12, tls.VersionTLS13).
TLSMinVersion uint16
// TLSPinnedCertFingerprint is the hex-encoded SHA-256 fingerprint
// of the expected server certificate. When set, the client rejects
// connections to servers presenting a different leaf certificate.
// The fingerprint is compared against the raw DER encoding of the
// first certificate in the peer's chain.
TLSPinnedCertFingerprint string
// Timeout is an optional custom timeout for HTTP requests. If
// zero, defaults to 30 seconds.
Timeout time.Duration
}
Config holds configuration for connecting to a tapd REST API.
type TLSSource ¶
type TLSSource interface {
// contains filtered or unexported methods
}
TLSSource describes how the REST client should build its TLS trust configuration. Exactly one source is held on Config.TLS, so mutually-exclusive trust choices (pinned cert vs system pool vs insecure) cannot be expressed. Instances are obtained from TLSFromPath, TLSFromData, TLSSystemCert, or TLSInsecure.
func TLSFromData ¶
TLSFromData returns a TLSSource that trusts a PEM certificate supplied directly as a string.
func TLSFromPath ¶
TLSFromPath returns a TLSSource that loads a PEM-encoded certificate from disk and trusts exactly that cert.
func TLSInsecure ¶
func TLSInsecure() TLSSource
TLSInsecure returns a TLSSource that disables TLS verification. Intended for local development only.
func TLSSystemCert ¶
func TLSSystemCert() TLSSource
TLSSystemCert returns a TLSSource that uses the host's system certificate pool.