package
0.0.0-20190407150747-8b9b72514244
Repository: https://github.com/ipsn/go-ipfs.git
Documentation: pkg.go.dev

# README

go-ipns

standard-readme compliant GoDoc

ipns record definitions

This package contains all of the components necessary to create, understand, and validate IPNS records. It does not publish or resolve those records. go-ipfs uses this package internally to manipulate records.

Usage

To create a new IPNS record:

import (
	"time"

	ipns "github.com/ipfs/go-ipns"
	crypto "github.com/libp2p/go-libp2p-crypto"
)

// Generate a private key to sign the IPNS record with. Most of the time, 
// however, you'll want to retrieve an already-existing key from IPFS using the
// go-ipfs/core/coreapi CoreAPI.KeyAPI() interface.
privateKey, publicKey, err := crypto.GenerateKeyPair(crypto.RSA, 2048)
if err != nil {
  panic(err)
}

// Create an IPNS record that expires in one hour and points to the IPFS address
// /ipfs/Qme1knMqwt1hKZbc1BmQFmnm9f36nyQGwXxPGVpVJ9rMK5
ipnsRecord, err := ipns.Create(privateKey, []byte("/ipfs/Qme1knMqwt1hKZbc1BmQFmnm9f36nyQGwXxPGVpVJ9rMK5"), 0, time.Now().Add(1*time.Hour))
if err != nil {
	panic(err)
}

Once you have the record, you’ll need to use IPFS to publish it.

There are several other major operations you can do with go-ipns. Check out the API docs or look at the tests in this repo for examples.

Documentation

https://godoc.org/github.com/ipfs/go-ipns

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

Want to hack on IPFS?

License

Copyright (c) Protocol Labs, Inc. under the MIT license. See LICENSE file for details.

# Packages

No description provided by the author
No description provided by the author

# Functions

Compare compares two IPNS entries.
Create creates a new IPNS entry and signs it with the given private key.
EmbedPublicKey embeds the given public key in the given ipns entry.
ExtractPublicKey extracts a public key matching `pid` from the IPNS record, if possible.
GetEOL returns the EOL of this IPNS entry This function returns ErrUnrecognizedValidity if the validity type of the record isn't EOL.
RecordKey returns the libp2p record key for a given peer ID.
Validates validates the given IPNS entry against the given public key.

# Variables

ErrBadRecord should be returned when an ipns record cannot be unmarshalled.
ErrExpiredRecord should be returned when an ipns record is invalid due to being too old.
ErrInvalidPath should be returned when an ipns record path is not in a valid format.
ErrKeyFormat should be returned when an ipns record key is incorrectly formatted (not a peer ID).
ErrPublicKeyMismatch should be returned when the public key embedded in the record doesn't match the expected public key.
ErrPublicKeyNotFound should be returned when the public key corresponding to the ipns record path cannot be retrieved from the peer store.
ErrSignature should be returned when an ipns record fails signature verification.
ErrUnrecognizedValidity is returned when an IpnsRecord has an unknown validity type.

# Structs

Validator is an IPNS record validator that satisfies the libp2p record validator interface.