api

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2019 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

* Copyright (c) 2018-2019 vChain, Inc. All Rights Reserved. * This software is released under GPL3. * The full license information can be found under: * https://www.gnu.org/licenses/gpl-3.0.en.html *

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TrackPublisher

func TrackPublisher(user *User, event string) (err error)

TrackPublisher is deprecated and will be removed

func TrackSign

func TrackSign(user *User, hash string, filename string, status meta.Status) (err error)

TrackSign is deprecated and will be removed

func TrackVerify

func TrackVerify(user *User, hash string, filename string) (err error)

TrackVerify is deprecated and will be removed

Types

type Artifact

type Artifact struct {
	Kind        string
	Name        string
	Hash        string
	Size        uint64
	ContentType string
	Metadata
}

func (Artifact) Copy added in v0.5.2

func (a Artifact) Copy() Artifact

type ArtifactRequest

type ArtifactRequest struct {
	// root fields
	Kind        string `json:"kind"`
	Name        string `json:"name"`
	Hash        string `json:"hash"`
	Size        uint64 `json:"size,omitempty"`
	ContentType string `json:"contentType"`
	URL         string `json:"url"`

	// custom metadata
	Metadata Metadata `json:"metadata"`

	// ArtifactRequest specific
	Visibility string `json:"visibility"`
	Status     string `json:"status"`
	MetaHash   string `json:"metaHash"`
}

type ArtifactResponse

type ArtifactResponse struct {
	// root fields
	Kind        string `json:"kind" vcn:"Kind"`
	Name        string `json:"name" vcn:"Name"`
	Hash        string `json:"hash" vcn:"Hash"`
	Size        uint64 `json:"size" vcn:"Size"`
	ContentType string `json:"contentType" vcn:"ContentType"`
	URL         string `json:"url" vcn:"URL"`

	// custom metadata
	Metadata Metadata `json:"metadata" vcn:"Metadata"`

	// ArtifactResponse specific
	Level             int64  `json:"level"`
	Visibility        string `json:"visibility" vcn:"Visibility"`
	Status            string `json:"status"`
	CreatedAt         string `json:"createdAt"`
	VerificationCount uint64 `json:"verificationCount"`
	SignerCount       uint64 `json:"signerCount"`
	Signer            string `json:"signer" vcn:"Signer"`
	Company           string `json:"company" vcn:"Company"`
	Website           string `json:"website" vcn:"Website"`
}

func LoadArtifactForHash

func LoadArtifactForHash(user *User, hash string, metahash string) (*ArtifactResponse, error)

func (ArtifactResponse) Artifact

func (a ArtifactResponse) Artifact() *Artifact

Artifact returns an new *Artifact from a

func (ArtifactResponse) String

func (a ArtifactResponse) String() string

type BlockchainOrganisation

type BlockchainOrganisation struct {
	Owner     common.Address   `json:"owner"`
	Members   []common.Address `json:"members"`
	Hash      string           `json:"hash"`
	Timestamp time.Time        `json:"timestamp"`
}

func BlockChainGetOrganisation

func BlockChainGetOrganisation(name string) (*BlockchainOrganisation, error)

func (*BlockchainOrganisation) Key

func (o *BlockchainOrganisation) Key() string

Key returns org owner's key as string for o, if any, otherwise an empty string

func (*BlockchainOrganisation) MembersKeys

func (o *BlockchainOrganisation) MembersKeys() []string

MembersKeys returns org members' keys as slice of strings for o, if any, otherwise a zero-len slice

type BlockchainVerification

type BlockchainVerification struct {
	Owner     common.Address `json:"owner"`
	Level     meta.Level     `json:"level"`
	Status    meta.Status    `json:"status"`
	Timestamp time.Time      `json:"timestamp"`
}

func BlockChainInspect added in v0.5.1

func BlockChainInspect(hash string) ([]BlockchainVerification, error)

BlockChainInspect returns an array of BlockchainVerification containing all verifications found for the given hash

func BlockChainVerify

func BlockChainVerify(hash string) (*BlockchainVerification, error)

BlockChainVerify returns *BlockchainVerification for the hash

func BlockChainVerifyMatchingPublicKey

func BlockChainVerifyMatchingPublicKey(hash string, pubKey string) (*BlockchainVerification, error)

BlockChainVerifyMatchingPublicKey returns *BlockchainVerification for hash matching pubKey.

func BlockChainVerifyMatchingPublicKeys

func BlockChainVerifyMatchingPublicKeys(hash string, pubKeys []string) (*BlockchainVerification, error)

BlockChainVerifyMatchingPublicKeys returns *BlockchainVerification for hash matching at least one of pubKeys

func (*BlockchainVerification) Date

func (v *BlockchainVerification) Date() string

Date returns a RFC3339 formatted string of v's timestamp, if any, otherwise an empty string

func (*BlockchainVerification) Key

func (v *BlockchainVerification) Key() string

Key returns signer's key as string for v, if any, otherwise an empty string

func (*BlockchainVerification) LevelName

func (v *BlockchainVerification) LevelName() string

LevelName returns the level's label for v

func (*BlockchainVerification) MarshalJSON

func (v *BlockchainVerification) MarshalJSON() ([]byte, error)

func (*BlockchainVerification) MarshalYAML

func (v *BlockchainVerification) MarshalYAML() (interface{}, error)

func (*BlockchainVerification) MetaHash

func (v *BlockchainVerification) MetaHash() string

func (*BlockchainVerification) Trusted

func (v *BlockchainVerification) Trusted() bool

Trusted returns true if v.Status is meta.StatusTrusted

func (*BlockchainVerification) Unknown

func (v *BlockchainVerification) Unknown() bool

Unknown returns true if v is nil or v.Status is meta.StatusUnknown

func (*BlockchainVerification) UnmarshalJSON added in v0.5.1

func (v *BlockchainVerification) UnmarshalJSON(b []byte) error

type CountResponse

type CountResponse struct {
	Count uint64 `json:"count"`
}

type Error

type Error struct {
	Status    int    `json:"status"`
	Message   string `json:"message"`
	Path      string `json:"path"`
	Timestamp string `json:"timestamp"`
	Error     string `json:"error"`
}

type Metadata

type Metadata map[string]interface{}

Metadata holds custom artifact attributes

func (Metadata) Get

func (m Metadata) Get(key string, defaultValue interface{}) interface{}

Get returns the value for the given key, if any, otherwise returns defaultValue

func (*Metadata) Set

func (m *Metadata) Set(key string, value interface{})

Set sets the value for given key

func (*Metadata) SetValues

func (m *Metadata) SetValues(values map[string]interface{})

SetValues sets given values into this Metadata instance

type PagedArtifactResponse

type PagedArtifactResponse struct {
	Content       []ArtifactResponse `json:"content"`
	TotalElements uint64             `json:"totalElements"`
	Pageable      struct {
		PageSize   uint64 `json:"pageSize"`
		PageNumber uint64 `json:"pageNumber"`
	} `json:"pageable"`
}

type PagedWalletResponse

type PagedWalletResponse struct {
	Content []Wallet `json:"content"`
}

type User

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

func NewUser

func NewUser(email string) *User

func (*User) Authenticate

func (u *User) Authenticate(password string) (err error)

func (*User) ClearAuth

func (u *User) ClearAuth()

func (User) DefaultKey

func (u User) DefaultKey() string

func (User) DefaultKeystore

func (u User) DefaultKeystore() (*store.Keystore, error)

func (User) Email

func (u User) Email() string

func (User) HasKey

func (u User) HasKey() bool

func (User) IsAuthenticated

func (u User) IsAuthenticated() (bool, error)

func (User) IsExist

func (u User) IsExist() (bool, error)

func (User) Keys

func (u User) Keys() []string

func (User) Keystores

func (u User) Keystores() []*store.Keystore

func (User) ListArtifacts added in v0.5.2

func (u User) ListArtifacts(page uint) (*PagedArtifactResponse, error)

func (*User) LoadAllArtifacts

func (u *User) LoadAllArtifacts() ([]ArtifactResponse, error)

func (*User) LoadArtifact

func (u *User) LoadArtifact(hash string) (*ArtifactResponse, error)

LoadArtifact returns an *ArtifactResponse for the given hash and current u, if any

func (*User) LoadArtifacts

func (u *User) LoadArtifacts(walletAddress string) ([]ArtifactResponse, error)

func (User) RemainingSignOps

func (u User) RemainingSignOps() (uint64, error)

func (User) Sign

func (u User) Sign(artifact Artifact, pubKey string, passphrase string, state meta.Status, visibility meta.Visibility) (*BlockchainVerification, error)

func (User) SyncKeys

func (u User) SyncKeys() error

SyncKeys synces local pub keys to the blockchain

func (User) Wallets

func (u User) Wallets() (addresses []string, err error)

Wallets returns addresses (pub keys) of user's wallets on the blockchain

type Wallet

type Wallet struct {
	Address             string `json:"address"`
	CreatedAt           string `json:"createdAt"`
	Name                string `json:"name"`
	PermissionSyncState string `json:"permissionSyncState"`
	LevelSyncState      string `json:"levelSyncState"`
}

Jump to

Keyboard shortcuts

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