Documentation ¶
Index ¶
- Constants
- func BindAssumeYesFlag(cmd *cobra.Command)
- func DeleteCookie(authFile string, domain string, userIdentifier []byte) error
- func DialClient(ctx context.Context, cmd *cobra.Command, flags uint8, fn RoundTripper) error
- func GetAssumeYesFlag(cmd *cobra.Command) (bool, error)
- func KGWAuthTokenFilePath() string
- func LoadPersistedCookie(authFile string, domain string, userIdentifier []byte) (*http.Cookie, error)
- func SaveCookie(authFile string, domain string, userIdentifier []byte, ...) error
- type PersistedCookies
- type RoundTripper
Constants ¶
const ( // WithoutPrivateKey is a flag that can be passed to DialClient to indicate // that the client does not require the private key for signing. If set in // the config, the private key will still be loaded to set the call message // sender and to infer owner in database call commands. WithoutPrivateKey uint8 = 1 << iota // UsingGateway is a flag that can be passed to DialClient to indicate that the client is talking to a gateway. // Since very few commands use the gateway, we bind this to specific commands instead of making it a global flag. UsingGateway )
Variables ¶
This section is empty.
Functions ¶
func BindAssumeYesFlag ¶
BindAssumeYesFlag binds the assume yes flag to the passed command If bound, the command will assume yes for all prompts
func DeleteCookie ¶
DeleteCookie will delete a cookie that exists for a given user identifier. If no cookie exists for the user identifier, it will do nothing.
func DialClient ¶
DialClient dials a kwil node and calls the passed function with the client. It includes the command that is being run, so that it can read global flags.
func GetAssumeYesFlag ¶
GetAssumeYesFlag returns the value of the assume yes flag
func KGWAuthTokenFilePath ¶
func KGWAuthTokenFilePath() string
KGWAuthTokenFilePath returns the path to the file that stores the Gateway Authn cookies.
Types ¶
type PersistedCookies ¶
type PersistedCookies map[string]cookie
PersistedCookies is a set of Gateway Auth cookies that can be saved to a file. It maps a base64 user identifier to a cookie, ensuring only one cookie per wallet. It uses a custom cookie type that is json serializable.
type RoundTripper ¶
type RoundTripper func(ctx context.Context, client clientType.Client, conf *config.KwilCliConfig) error