keychain

package
v1.5.3 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2025 License: MIT Imports: 14 Imported by: 2

Documentation

Index

Constants

View Source
const EXT_CERT = ".cert"
View Source
const EXT_KEY = ".key"
View Source
const EXT_PEM = ".pem"

Variables

This section is empty.

Functions

func InsertFile

func InsertFile(kc ndn.KeyChain, content []byte) error

InsertFile inserts all signers and certs from the given content.

func NewKeyChain

func NewKeyChain(uri string, pubStore ndn.Store) (ndn.KeyChain, error)

(AI GENERATED DESCRIPTION): Creates a new keychain instance from the given URI, selecting either an in‑memory or directory‑based implementation based on the URI scheme and attaching the supplied public key store, returning an error for unsupported schemes.

func NewKeyChainDir

func NewKeyChainDir(path string, pubStore ndn.Store) (ndn.KeyChain, error)

NewKeyChainDir creates a new in-memory keychain.

func NewKeyChainMem

func NewKeyChainMem(pubStore ndn.Store) ndn.KeyChain

NewKeyChainMem creates a new in-memory keychain.

Types

type KeyChainDir

type KeyChainDir struct {
	// contains filtered or unexported fields
}

KeyChainDir is a directory-based keychain.

func (*KeyChainDir) Identities

func (kc *KeyChainDir) Identities() []ndn.KeyChainIdentity

(AI GENERATED DESCRIPTION): Returns a slice of all identities currently stored in the key‑chain directory.

func (*KeyChainDir) IdentityByName

func (kc *KeyChainDir) IdentityByName(name enc.Name) ndn.KeyChainIdentity

(AI GENERATED DESCRIPTION): Retrieves and returns the identity that matches the specified name from the keychain directory’s in‑memory store.

func (*KeyChainDir) InsertCert

func (kc *KeyChainDir) InsertCert(wire []byte) error

(AI GENERATED DESCRIPTION): Inserts the given certificate (in wire format) into the in‑memory key chain and writes it to disk with the certificate file extension.

func (*KeyChainDir) InsertKey

func (kc *KeyChainDir) InsertKey(signer ndn.Signer) error

(AI GENERATED DESCRIPTION): Adds a signer to the in‑memory key chain and writes its secret key to disk in a file with the key extension.

func (*KeyChainDir) Store

func (kc *KeyChainDir) Store() ndn.Store

(AI GENERATED DESCRIPTION): Returns the underlying in‑memory store that backs the KeyChainDir.

func (*KeyChainDir) String

func (kc *KeyChainDir) String() string

(AI GENERATED DESCRIPTION): Returns a string representation of the KeyChainDir, displaying the path to the keychain directory.

type KeyChainMem

type KeyChainMem struct {
	// contains filtered or unexported fields
}

KeyChainMem is an in-memory keychain.

func (*KeyChainMem) Identities

func (kc *KeyChainMem) Identities() []ndn.KeyChainIdentity

(AI GENERATED DESCRIPTION): Returns a slice of all identities currently stored in the in‑memory key chain.

func (*KeyChainMem) IdentityByName

func (kc *KeyChainMem) IdentityByName(name enc.Name) ndn.KeyChainIdentity

(AI GENERATED DESCRIPTION): Retrieves and returns the KeyChainIdentity from the in‑memory keychain that has the specified name, or nil if no matching identity exists.

func (*KeyChainMem) InsertCert

func (kc *KeyChainMem) InsertCert(wire []byte) error

(AI GENERATED DESCRIPTION): Adds a certificate to the in‑memory key chain after validating its type, format, and expiration, ensuring it is not a duplicate, storing it in the public store, and updating all identities that reference it.

func (*KeyChainMem) InsertKey

func (kc *KeyChainMem) InsertKey(signer ndn.Signer) error

(AI GENERATED DESCRIPTION): Adds a signer key to the in‑memory key chain, creating its identity if needed and linking any existing certificates whose names are prefixed by the key name.

func (*KeyChainMem) Store

func (kc *KeyChainMem) Store() ndn.Store

(AI GENERATED DESCRIPTION): Returns the in‑memory public‑key store associated with the KeyChainMem instance.

func (*KeyChainMem) String

func (kc *KeyChainMem) String() string

(AI GENERATED DESCRIPTION): Returns the string identifier `"keychain-mem"` for the in‑memory keychain instance.

Jump to

Keyboard shortcuts

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