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 ¶
- func TrackPublisher(user *User, event string) (err error)
- func TrackSign(user *User, hash string, filename string, status meta.Status) (err error)
- func TrackVerify(user *User, hash string, filename string) (err error)
- type Artifact
- type ArtifactRequest
- type ArtifactResponse
- type BlockchainOrganisation
- type BlockchainVerification
- func BlockChainInspect(hash string) ([]BlockchainVerification, error)
- func BlockChainVerify(hash string) (*BlockchainVerification, error)
- func BlockChainVerifyMatchingPublicKey(hash string, pubKey string) (*BlockchainVerification, error)
- func BlockChainVerifyMatchingPublicKeys(hash string, pubKeys []string) (*BlockchainVerification, error)
- func (v *BlockchainVerification) Date() string
- func (v *BlockchainVerification) Key() string
- func (v *BlockchainVerification) LevelName() string
- func (v *BlockchainVerification) MarshalJSON() ([]byte, error)
- func (v *BlockchainVerification) MarshalYAML() (interface{}, error)
- func (v *BlockchainVerification) MetaHash() string
- func (v *BlockchainVerification) Trusted() bool
- func (v *BlockchainVerification) Unknown() bool
- func (v *BlockchainVerification) UnmarshalJSON(b []byte) error
- type CountResponse
- type Error
- type Metadata
- type PagedArtifactResponse
- type PagedWalletResponse
- type User
- func (u *User) Authenticate(password string) (err error)
- func (u *User) ClearAuth()
- func (u User) DefaultKey() string
- func (u User) DefaultKeystore() (*store.Keystore, error)
- func (u User) Email() string
- func (u User) HasKey() bool
- func (u User) IsAuthenticated() (bool, error)
- func (u User) IsExist() (bool, error)
- func (u User) Keys() []string
- func (u User) Keystores() []*store.Keystore
- func (u User) ListArtifacts(page uint) (*PagedArtifactResponse, error)
- func (u *User) LoadAllArtifacts() ([]ArtifactResponse, error)
- func (u *User) LoadArtifact(hash string) (*ArtifactResponse, error)
- func (u *User) LoadArtifacts(walletAddress string) ([]ArtifactResponse, error)
- func (u User) RemainingSignOps() (uint64, error)
- func (u User) Sign(artifact Artifact, pubKey string, passphrase string, state meta.Status, ...) (*BlockchainVerification, error)
- func (u User) SyncKeys() error
- func (u User) Wallets() (addresses []string, err error)
- type Wallet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TrackPublisher ¶
TrackPublisher is deprecated and will be removed
Types ¶
type 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 Metadata ¶
type Metadata map[string]interface{}
Metadata holds custom artifact attributes
func (Metadata) Get ¶
Get returns the value for the given key, if any, otherwise returns defaultValue
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 (*User) Authenticate ¶
func (User) DefaultKey ¶
func (User) IsAuthenticated ¶
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 (User) Sign ¶
func (u User) Sign(artifact Artifact, pubKey string, passphrase string, state meta.Status, visibility meta.Visibility) (*BlockchainVerification, error)