Documentation ¶
Overview ¶
Package utils contains a variety of small utility functions used by other tokenserver packages.
Index ¶
- Constants
- func DumpPEM(data []byte, header string) string
- func LogRequest(c context.Context, rpc RPC, req proto.Message, caller identity.Identity)
- func ParsePEM(data, header string) ([]byte, error)
- func SerializeSN(sn *big.Int) ([]byte, error)
- func ServiceVersion(c context.Context, s signing.Signer) (string, error)
- func TokenFingerprint(tok string) string
- func ValidateAndNormalizeRequest(c context.Context, oauthScope []string, durationSecs *int64, ...) error
- func ValidateProject(c context.Context, project string) error
- func ValidateTags(tags []string) error
- func ZlibCompress(in []byte) ([]byte, error)
- func ZlibDecompress(in []byte) ([]byte, error)
- type RPC
Constants ¶
const ( // DefaultMinValidityDuration is a value for minimal returned token lifetime if 'min_validity_duration' // field is not specified in the request. DefaultMinValidityDuration = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
func LogRequest ¶
LogRequest logs the RPC request.
func SerializeSN ¶
SerializeSN converts a certificate serial number to a byte blob.
func ServiceVersion ¶
ServiceVersion returns a string that identifies the app and the version.
It is put in some server responses. The function extracts this information from the given signer.
This function almost never returns errors. It can return an error only when called for the first time during the process lifetime. It gets cached after first successful return.
func TokenFingerprint ¶
TokenFingerprint returns first 16 bytes of SHA256 of the token, as hex.
Token fingerprints can be used to identify tokens without parsing them.
func ValidateAndNormalizeRequest ¶
func ValidateAndNormalizeRequest(c context.Context, oauthScope []string, durationSecs *int64, auditTags []string) error
ValidateAndNormalizeRequest validates and normalizes RPC requests.
func ValidateProject ¶
ValidateProject validates a LUCI project string.
func ValidateTags ¶
ValidateTags returns an error if some tags are malformed.
Tags are "key:value" pairs that can be passed with some RPCs. They end up inside the tokens and/or BigQuery logs.
func ZlibCompress ¶
ZlibCompress zips a blob using zlib.
func ZlibDecompress ¶
ZlibDecompress unzips a blob using zlib.
Types ¶
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package bq contains helpers for uploading rows to BigQuery.
|
Package bq contains helpers for uploading rows to BigQuery. |
Package identityset implements a set-like structure for identity.Identity.
|
Package identityset implements a set-like structure for identity.Identity. |
Package policy contains implementation of Policy parsing and querying.
|
Package policy contains implementation of Policy parsing and querying. |
Package revocation contains utilities for implementing token revocation.
|
Package revocation contains utilities for implementing token revocation. |
Package shards provides a low level support for implementing sharded set of []byte blobs.
|
Package shards provides a low level support for implementing sharded set of []byte blobs. |
Package tokensigning implements utilities for RSA-signing of proto messages.
|
Package tokensigning implements utilities for RSA-signing of proto messages. |