npm

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var REALM = identity.REALM

Functions

func Authorize

func Authorize(req *http.Request, ctx cpi.ContextProvider, repoUrl string, pkgName string) error

Authorize the given request with the bearer token for the given repository URL and package name. If the token is empty (login failed or credentials not found), it will not be set.

func BasicAuth added in v0.11.0

func BasicAuth(req *http.Request, ctx cpi.ContextProvider, repoUrl string, pkgName string) error

func BearerToken

func BearerToken(ctx cpi.ContextProvider, repoUrl string, pkgName string) (string, error)

BearerToken retrieves the bearer token for the given repository URL and package name. Either it's setup in the credentials or it will login to the registry and retrieve it.

func GetCredentials added in v0.11.0

func GetCredentials(ctx cpi.ContextProvider, repoUrl string, pkgName string) (string, string, error)

func Login

func Login(registry string, username string, password string, email string) (string, error)

Login to npm registry (URL) and retrieve bearer token.

Types

type Dist added in v0.11.0

type Dist struct {
	Integrity string `json:"integrity"`
	Shasum    string `json:"shasum"`
	Tarball   string `json:"tarball"`
}

type Project added in v0.11.0

type Project struct {
	Name    string             `json:"name"`
	Version map[string]Version `json:"versions"`
}

type Version added in v0.11.0

type Version struct {
	Name    string `json:"name"`
	Version string `json:"version"`
	Dist    Dist   `json:"dist"`
}

Jump to

Keyboard shortcuts

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