didorbgenerator

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 14, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ID specifies the ID of the generator.
	ID = "https://w3id.org/orb#v0"

	// Namespace specifies the namespace of the generator.
	Namespace = "did:orb"

	// Version specifies the version of the generator.
	Version = uint64(0)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

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

Generator generates a content object for did:orb anchor events.

func New

func New(opts ...Opt) *Generator

New returns a new generator.

func (*Generator) CreateContentObject

func (g *Generator) CreateContentObject(payload *subject.Payload) (vocab.Document, error)

CreateContentObject creates a content object from the given payload.

func (*Generator) CreatePayload

func (g *Generator) CreatePayload(doc vocab.Document, coreIndexURI *url.URL, anchors []*url.URL) (*subject.Payload, error)

CreatePayload creates a payload from the given document.

func (*Generator) ID

func (g *Generator) ID() *url.URL

ID returns the ID of the generator.

func (*Generator) Namespace

func (g *Generator) Namespace() string

Namespace returns the Namespace for the DID method.

func (*Generator) ValidateAnchorCredential

func (g *Generator) ValidateAnchorCredential(vc *verifiable.Credential, contentBytes []byte) error

ValidateAnchorCredential validates the anchor credential against the given content. - The ID of the credential subject is a hashlink of the content. - The content must be a valid anchor linkset. - If profile is provided then it must be set to https://w3id.org/orb#v0. - If anchor is provided then it is set to the same value as 'anchor' in the anchor linkset.

func (*Generator) Version

func (g *Generator) Version() uint64

Version returns the Version of this generator.

type Opt

type Opt func(opts *options)

Opt defines an option for the generator.

func WithID

func WithID(id *url.URL) Opt

WithID sets the ID of the generator.

func WithNamespace

func WithNamespace(ns string) Opt

WithNamespace sets the namespace of the generator.

func WithVersion

func WithVersion(version uint64) Opt

WithVersion sets the version of the generator.

Jump to

Keyboard shortcuts

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