trusty-sdk-go

module
v0.0.0-...-377e0d1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2024 License: Apache-2.0

README

Go Reference

trusty-sdk-go - Enhanced

A Golang SDK for trusty

The SDK has been enhanced to fully decode the package reports.

package main

import (
	"fmt"
	"context"

	"github.com/mintoolkit/mint/pkg/util/jsonutil"
	"github.com/autonomous-plane/trusty-sdk-go/pkg/client"
	"github.com/autonomous-plane/trusty-sdk-go/pkg/types"
)

func main() {
	trusty := client.New()

	if report, err := trusty.Report(context.TODO(), 
		&types.Dependency{
			Name: "express",
			Version: "4.17.1",
			Ecosystem: types.EcosystemNpm}); err == nil {
		fmt.Println(jsonutil.ToPretty(report))
	}
}

Overview

Supported package types/ecosystems:

  • NPM - types.EcosystemNpm - Node.js packages (purl type: npm)
  • Go - types.EcosystemGo - Go packages (purl type: golang)
  • PyPI - types.EcosystemPypi - Python packages (purl type: pypi)
  • Maven - types.EcosystemMaven - Java packages (purl type: maven)
  • Crates - types.EcosystemCrates - Rust/Cargo packages (purl type: cargo)

Changes

  • Ecosystem constants follow Go standards (e.g., EcosystemNpm instead of ECOSYSTEM_NPM)

References

Online portal to lookup dependency information: https://www.trustypkg.dev/

Directories

Path Synopsis
pkg
client
Package client provides a rest client to talk to the Trusty API.
Package client provides a rest client to talk to the Trusty API.
githubapi
Package githubapi offers some utility functions to interact with GitHub from the Trusty libraries.
Package githubapi offers some utility functions to interact with GitHub from the Trusty libraries.
parser
Package parser exposes methods to decode dependency information from the supported packaging ecosystems.
Package parser exposes methods to decode dependency information from the supported packaging ecosystems.
types
Package types is the collection of main data types used by the Trusty libraries
Package types is the collection of main data types used by the Trusty libraries

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL