Documentation ¶
Overview ¶
Package dir implements Notation directory structure. [directory spec]: https://notaryproject.dev/docs/user-guides/how-to/directory-structure/
Example:
Read config.json: file, err := dir.ConfigFS().Open(dir.PathConfigFile)
Get the path of config.json: path, err := dir.ConfigFS().SysPath(dir.PathConfigFile)
Read trustpolicy.json: file, err := dir.ConfigFS().Open(dir.PathTrustPolicy)
Get the path of trustpolicy.json: path, err := dir.ConfigFS().SysPath(dir.PathTrustPolicy)
Set custom configurations directory: dir.UserConfigDir = '/path/to/configurations/'
Only user level directory is supported, and system level directory may be added later.
Index ¶
Constants ¶
const ( // PathConfigFile is the config.json file relative path. PathConfigFile = "config.json" // PathSigningKeys is the signingkeys file relative path. PathSigningKeys = "signingkeys.json" // PathTrustPolicy is the trust policy file relative path. PathTrustPolicy = "trustpolicy.json" // LocalKeysDir is the directory name for local key relative path. LocalKeysDir = "localkeys" // LocalCertificateExtension defines the extension of the certificate files. LocalCertificateExtension = ".crt" // LocalKeyExtension defines the extension of the key files. LocalKeyExtension = ".key" // TrustStoreDir is the directory name of trust store. TrustStoreDir = "truststore" )
The relative path to {NOTATION_CONFIG}
const (
// PathCRLCache is the crl file cache directory relative path.
PathCRLCache = "crl"
)
The relative path to {NOTATION_CACHE}
const (
// PathPlugins is the plugins directory relative path.
PathPlugins = "plugins"
)
The relative path to {NOTATION_LIBEXEC}
Variables ¶
var ( UserConfigDir string // Absolute path of user level {NOTATION_CONFIG} UserLibexecDir string // Absolute path of user level {NOTATION_LIBEXEC} UserCacheDir string // Absolute path of user level {NOTATION_CACHE} )
Functions ¶
func LocalKeyPath ¶
LocalKeyPath returns the local key and local cert relative paths.
func X509TrustStoreDir ¶
X509TrustStoreDir returns the trust store relative path.
items includes named-store and cert-file names. the directory follows the pattern of {NOTATION_CONFIG}/truststore/x509/{store-type}/{named-store}/{cert-file}
Types ¶
type SysFS ¶
type SysFS interface { fs.FS // SysPath returns the real system path of the given path items in the SysFS. SysPath(items ...string) (string, error) }
SysFS is virtual file system interface that support fs.FS and SysPath method.
func CacheFS ¶ added in v1.3.0
func CacheFS() SysFS
CacheFS is the cache SysFS.
To get the root of crl file cache, use `CacheFS().SysFS(PathCRLCache)`.