Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- getCabal :: PackageIdentifier -> IO ByteString
- getCabals :: PackageIdentifier -> PackageIdentifier -> IO (ByteString, ByteString)
- withCabalFile :: PackageIdentifier -> (FilePath -> IO a) -> IO a
- listPackages :: IO [String]
- packageVersions :: PackageName -> IO [Version]
- latestVersion :: PackageName -> IO (Maybe Version)
- preferredVersions :: PackageName -> IO (Maybe ByteString)
- getTimestamp :: PackageIdentifier -> IO (Maybe UTCTime)
- indexFiles :: IO [String]
- getPackageDescription :: PackageIdentifier -> IO (Maybe PackageDescription)
- getPackageDescription' :: PackageIdentifier -> IO PackageDescription
- packageIdOrLatest :: PackageIdentifier -> IO PackageIdentifier
- getFileInfo :: PackageIdentifier -> IO FileInfo
- data FileInfo = FileInfo {}
- newtype FileLength = FileLength {
- fileLength :: Int54
- fileInfoSHA256 :: FileInfo -> Maybe Hash
Documentation
getCabal :: PackageIdentifier -> IO ByteString Source #
Get the contents of the .cabal file for package version
getCabals :: PackageIdentifier -> PackageIdentifier -> IO (ByteString, ByteString) Source #
Get two .cabal files at once!
withCabalFile :: PackageIdentifier -> (FilePath -> IO a) -> IO a Source #
Pass a temporary copy of .cabal file to some action
listPackages :: IO [String] Source #
List all packages in the index (unsorted for performance)
packageVersions :: PackageName -> IO [Version] Source #
Get all versions of a package in the index
latestVersion :: PackageName -> IO (Maybe Version) Source #
Get the latest version of package from the index
Note: does not take preferred-versions into account
preferredVersions :: PackageName -> IO (Maybe ByteString) Source #
Get the preferred-versions metadata for package
getTimestamp :: PackageIdentifier -> IO (Maybe UTCTime) Source #
Get the index timestamp for (the latest revision of) pkgid
indexFiles :: IO [String] Source #
List all files in the Hackage index (.cabal files, metadata .json files, preferred-versions files)
getPackageDescription :: PackageIdentifier -> IO (Maybe PackageDescription) Source #
Get and try to parse the PackageDescription of a package version
getPackageDescription' :: PackageIdentifier -> IO PackageDescription Source #
Get and parse PackageDescription of package version
Raises an error on failure.
packageIdOrLatest :: PackageIdentifier -> IO PackageIdentifier Source #
Convert a PackageID if unversioned to latest package version
getFileInfo :: PackageIdentifier -> IO FileInfo Source #
Get FileInfo metadata for package version source
Re-exports from hackage-security
File information
This intentionally does not have an Eq
instance; see knownFileInfoEqual
and verifyFileInfo
instead.
NOTE: Throughout we compute file information always over the raw bytes.
For example, when timestamp.json
lists the hash of snapshot.json
, this
hash is computed over the actual snapshot.json
file (as opposed to the
canonical form of the embedded JSON). This brings it in line with the hash
computed over target files, where that is the only choice available.
Instances
Show FileInfo | |
Monad m => ToJSON m FileInfo | |
Defined in Hackage.Security.TUF.FileInfo | |
ReportSchemaErrors m => FromJSON m FileInfo | |
Defined in Hackage.Security.TUF.FileInfo |
newtype FileLength #
File length
Having verified file length information means we can protect against endless data attacks and similar.
Instances
Eq FileLength | |
Defined in Hackage.Security.TUF.Common (==) :: FileLength -> FileLength -> Bool # (/=) :: FileLength -> FileLength -> Bool # | |
Ord FileLength | |
Defined in Hackage.Security.TUF.Common compare :: FileLength -> FileLength -> Ordering # (<) :: FileLength -> FileLength -> Bool # (<=) :: FileLength -> FileLength -> Bool # (>) :: FileLength -> FileLength -> Bool # (>=) :: FileLength -> FileLength -> Bool # max :: FileLength -> FileLength -> FileLength # min :: FileLength -> FileLength -> FileLength # | |
Show FileLength | |
Defined in Hackage.Security.TUF.Common showsPrec :: Int -> FileLength -> ShowS # show :: FileLength -> String # showList :: [FileLength] -> ShowS # | |
Monad m => ToJSON m FileLength | |
Defined in Hackage.Security.TUF.Common toJSON :: FileLength -> m JSValue # | |
ReportSchemaErrors m => FromJSON m FileLength | |
Defined in Hackage.Security.TUF.Common fromJSON :: JSValue -> m FileLength # |