Documentation ¶
Overview ¶
Package ni implements RFC6920: https://tools.ietf.org/html/rfc6920
Index ¶
Constants ¶
This section is empty.
Variables ¶
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 ¶
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 ¶
ParseNI parses a string containing an ni url, e.g. "ni:///sha-256;UyaQV-Ev4rdLoHyJJWCi11OHfrYv9E1aGQAlMO2X_-Q" into a URL struct.
func ParseNIH ¶
ParseNIH parses a speakable representation of URL as specified in RFC6920, Section 7. If a check digit is included, it is verified. Authority is always an empty string in the returned URL, since nih strings do not carry authority information.
func (*URL) Bytes ¶
Bytes returns the binary representation of an ni-url as specified in RFC6920, Section 6. This representation includes the suide ID in the first byte which MUST be excluded when used in cryptographic operations.
func (*URL) HexString ¶
HexString returns the binary representation of an ni-url as specified in RFC6920, Section 6. In contrast to ToBytes, this function returns a hex string instead. This representation includes the suide ID in the first byte which MUST be excluded when used in cryptographic operations.
func (*URL) NIH ¶
NIH generates a human speakable representation of URL as specified in RFC6920, Section 7. A check digit is included, the Val is divided in groups of 6.
func (*URL) WellKnownURI ¶
WellKnownURI generates a well-known http url. The mapping is specified in RCF6920, Section 4.