ni

package module
v0.0.0-...-6f01ba1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2019 License: MIT Imports: 9 Imported by: 1

Documentation

Overview

Package ni implements RFC6920: https://tools.ietf.org/html/rfc6920

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidScheme     = errors.New("invalid scheme")
	ErrInvalidDigestLen  = errors.New("invalid digest len")
	ErrSuiteNotSupported = errors.New("suite not supported")
	ErrCheckDigit        = errors.New("wrong check digit")
)

Functions

This section is empty.

Types

type URL

type URL struct {
	Authority string
	Alg       string
	Val       string
	// contains filtered or unexported fields
}

URL represents a ni-url in memory. For the specification of the properties, see RFC6920: https://tools.ietf.org/html/rfc6920

func DigestToNI

func DigestToNI(digest []byte, suite, authority string) (*URL, error)

DigestToNI constructs a URL from a digest and the corresponding suite. Authority may be an empty string, as defined in RFC6920. The suite string must conform the the table here: https://www.iana.org/assignments/named-information/named-information.xhtml

func ParseNI

func ParseNI(rawurl string) (*URL, error)

ParseNI parses a string containing an ni url, e.g. "ni:///sha-256;UyaQV-Ev4rdLoHyJJWCi11OHfrYv9E1aGQAlMO2X_-Q" into a URL struct.

func ParseNIH

func ParseNIH(raw