api

package
v3.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddNewOwner

func AddNewOwner(
	ctx context.Context, resolverClient register.ResolverClient, newOwnerName string, newOwnerPublicBase58 string,
	identity register.RegisteredIdentity,
) error

AddNewOwner Add new register document owner.

func CreateAgentAuthToken

func CreateAgentAuthToken(
	agentID register.RegisteredIdentity, userDid string, duration time.Duration, audience string,
) (register.JwtToken, error)

CreateAgentAuthToken Create an agent authentication token.

func CreateAgentIdentity

func CreateAgentIdentity(
	ctx context.Context, resolverClient register.ResolverClient, opts *CreateIdentityOpts,
) (register.RegisteredIdentity, error)

CreateAgentIdentity Create and register a agent identity.

func CreateDefaultSeed

func CreateDefaultSeed() ([]byte, error)

CreateDefaultSeed Create a new seed (secrets) with the default length.

func CreateSeed

func CreateSeed(length int) ([]byte, error)

CreateSeed Create a new seed (secrets).

func CreateTwinIdentity

func CreateTwinIdentity(
	ctx context.Context, resolverClient register.ResolverClient, opts *CreateIdentityOpts,
) (register.RegisteredIdentity, error)

CreateTwinIdentity Create and register a twin identity.

func CreateTwinWithControlDelegation

func CreateTwinWithControlDelegation(
	ctx context.Context, resolverClient register.ResolverClient, opts *CreateTwinOpts,
) (register.RegisteredIdentity, error)

CreateTwinWithControlDelegation Create a twin with control delegation to Agent.

func CreateUserAndAgentWithAuthDelegation

func CreateUserAndAgentWithAuthDelegation(
	ctx context.Context, resolverClient register.ResolverClient, opts *CreateUserAndAgentWithAuthDelegationOpts,
) (userID register.RegisteredIdentity, agentID register.RegisteredIdentity, err error)

CreateUserAndAgentWithAuthDelegation Create and register a user and an agent identities with user delegating authentication to the agent.

func CreateUserIdentity

func CreateUserIdentity(
	ctx context.Context, resolverClient register.ResolverClient, opts *CreateIdentityOpts,
) (register.RegisteredIdentity, error)

CreateUserIdentity Create and register a user identity.

func DelegateControl

func DelegateControl(
	ctx context.Context, resolverClient register.ResolverClient, twinID register.RegisteredIdentity,
	agentID register.RegisteredIdentity, delegationName string,
) error

DelegateControl registers a twin identity with twin delegating control to the agent NOTE: this is a duplicate of regularApi - TwinDelegatesControlToAgent

func DelegateControlByPrivateExponentHex

func DelegateControlByPrivateExponentHex(
	ctx context.Context, resolverClient register.ResolverClient, twinIssuer *register.Issuer, twinPrivateExponent string,
	agentID register.RegisteredIdentity, delegationName string,
) error

DelegateControlByPrivateExponentHex registers a twin identity with a control delegate to agent

func GetAgentIdentity

func GetAgentIdentity(opts *GetIdentityOpts) (register.RegisteredIdentity, error)

GetAgentIdentity Get agent registered identity from secrets.

func GetKeyPairFromAgent

func GetKeyPairFromAgent(opts *GetKeyPairOpts) (*crypto.KeyPair, error)

GetKeyPairFromAgent Get key pair from agent secrets.

func GetKeyPairFromTwin

func GetKeyPairFromTwin(opts *GetKeyPairOpts) (*crypto.KeyPair, error)

GetKeyPairFromTwin Get key pair from twin secrets.

func GetKeyPairFromUser

func GetKeyPairFromUser(opts *GetKeyPairOpts) (*crypto.KeyPair, error)

GetKeyPairFromUser Get key pair from user secrets.

func GetOwnershipOfTwinFromRegisteredIdentity

func GetOwnershipOfTwinFromRegisteredIdentity(
	ctx context.Context, resolverClient register.ResolverClient, twinID register.RegisteredIdentity,
	newOwnerID register.RegisteredIdentity, newOwnerKeyName string,
) error

GetOwnershipOfTwinFromRegisteredIdentity Get Ownership of a twin using a registered identity you owned.

func GetRegisteredDocument

func GetRegisteredDocument(
	ctx context.Context, resolverClient register.ResolverClient, did string,
) (*register.RegisterDocument, error)

GetRegisteredDocument Get a register document from the resolver.

func GetTwinIdentity

func GetTwinIdentity(opts *GetIdentityOpts) (register.RegisteredIdentity, error)

GetTwinIdentity Get twin registered identity from secrets.

func GetUserIdentity

func GetUserIdentity(opts *GetIdentityOpts) (register.RegisteredIdentity, error)

GetUserIdentity Get user registered identity from secrets.

func RemoveOwnership

func RemoveOwnership(
	ctx context.Context, resolverClient register.ResolverClient, removeOwnerName string, identity register.RegisteredIdentity,
) error

RemoveOwnership Remove owner from a register document.

func SetDocumentController

func SetDocumentController(
	ctx context.Context, resolverClient register.ResolverClient, identity register.RegisteredIdentity,
	controller *register.Issuer,
) error

SetDocumentController Set controller issuer to the register document associated to the provided registered identity.

func SetDocumentCreator

func SetDocumentCreator(
	ctx context.Context, resolverClient register.ResolverClient, identity register.RegisteredIdentity,
	creator *register.Issuer,
) error

SetDocumentCreator Set creator to the register document associated to the provided registered identity.

func SetDocumentRevoked

func SetDocumentRevoked(
	ctx context.Context, resolverClient register.ResolverClient, identity register.RegisteredIdentity,
	revoked bool,
) error

SetDocumentRevoked Set register document associated to the provided registered identity revoke field.

func TakeOwnershipOfTwinAndDelegateControlByPrivateExponentHex

func TakeOwnershipOfTwinAndDelegateControlByPrivateExponentHex(
	ctx context.Context, resolverClient register.ResolverClient, twinIssuer *register.Issuer, twinPrivateExponent string,
	newOwnerID register.RegisteredIdentity, newOwnerKeyName string, delegationName string,
) error

TakeOwnershipOfTwinAndDelegateControlByPrivateExponentHex Get Ownership of a twin using the agent identity and delegate control to that agent using twin private key exponent.

func TakeOwnershipOfTwinByPrivateExponentHex

func TakeOwnershipOfTwinByPrivateExponentHex(
	ctx context.Context, resolverClient register.ResolverClient, twinIssuer *register.Issuer, twinPrivateExponent string,
	newOwnerID register.RegisteredIdentity, newOwnerKeyName string,
) error

TakeOwnershipOfTwinByPrivateExponentHex Get Ownership of a twin using the private exponent of the twin.

func TwinDelegatesControlToAgent

func TwinDelegatesControlToAgent(
	ctx context.Context, resolverClient register.ResolverClient, twinIdentity register.RegisteredIdentity,
	agentIdentity register.RegisteredIdentity, delegationName string,
) error

TwinDelegatesControlToAgent Twin delegates control to the agent. The agent can control the twin.

func UserDelegatesAuthenticationToAgent

func UserDelegatesAuthenticationToAgent(
	ctx context.Context, resolverClient register.ResolverClient, userIdentity register.RegisteredIdentity,
	agentIdentity register.RegisteredIdentity, delegationName string,
) error

UserDelegatesAuthenticationToAgent User delegates authentication to agent.

func ValidateDocumentProof

func ValidateDocumentProof(doc *register.RegisterDocument) error

ValidateDocumentProof Verify a register document proof.

Types

type CreateIdentityOpts

type CreateIdentityOpts struct {
	Seed     []byte
	KeyName  string
	Password string
	Name     string
	Method   crypto.SeedMethod
	Override bool
}

CreateIdentityOpts Create identity options for regular API

type CreateTwinOpts

type CreateTwinOpts struct {
	Seed           []byte
	KeyName        string
	Name           string
	Password       string
	AgentID        register.RegisteredIdentity
	AgentDoc       *register.RegisterDocument
	DelegationName string
	Override       bool
}

CreateTwinOpts Create twin options (with agent delegation) for highlevel API

type CreateUserAndAgentWithAuthDelegationOpts

type CreateUserAndAgentWithAuthDelegationOpts struct {
	UserSeed       []byte
	UserKeyName    string
	UserName       string
	UserPassword   string
	AgentSeed      []byte
	AgentKeyName   string
	AgentName      string
	AgentPassword  string
	DelegationName string
	OverrideDocs   bool
}

CreateUserAndAgentWithAuthDelegationOpts Create user and agent options for high level API

type GetIdentityOpts

type GetIdentityOpts struct {
	Did      string
	Seed     []byte
	KeyName  string
	Password string
	Name     string
	Method   crypto.SeedMethod
}

GetIdentityOpts get identity options for regular API

type GetKeyPairOpts

type GetKeyPairOpts struct {
	Seed     []byte
	KeyName  string
	Password string
	Method   crypto.SeedMethod
}

GetKeyPairOpts get key pair options for regular API

Jump to

Keyboard shortcuts

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