assets

package
v0.0.0-...-4da71f4 Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AssetAttributesRead   = "asset_attributes_read"
	AssetAttributesWrite  = "asset_attributes_write"
	EventDisplayTypeRead  = "event_arc_display_type_read"
	EventDisplayTypeWrite = "event_arc_display_type_write"
	WalletValueMarker     = "wallet"
	TesseraPubValueMarker = "tessera"
	AttributeItem         = "attribute"
	ValueItem             = "value"
	AttributeWildcard     = "*"
)

Variables

View Source
var (
	ConfirmationStatus_name = map[int32]string{
		0: "CONFIRMATION_STATUS_UNSPECIFIED",
		1: "PENDING",
		2: "CONFIRMED",
		3: "FAILED",
	}
	ConfirmationStatus_value = map[string]int32{
		"CONFIRMATION_STATUS_UNSPECIFIED": 0,
		"PENDING":                         1,
		"CONFIRMED":                       2,
		"FAILED":                          3,
	}
)

Enum value maps for ConfirmationStatus.

View Source
var (
	TrackedStatus_name = map[int32]string{
		0: "TRACKED_STATUS_UNSPECIFIED",
		1: "TRACKED",
		2: "NOT_TRACKED",
		3: "ANY",
	}
	TrackedStatus_value = map[string]int32{
		"TRACKED_STATUS_UNSPECIFIED": 0,
		"TRACKED":                    1,
		"NOT_TRACKED":                2,
		"ANY":                        3,
	}
)

Enum value maps for TrackedStatus.

View Source
var (
	StorageIntegrity_name = map[int32]string{
		0: "STORAGE_INTEGRITY_UNSPECIFIED",
		1: "LEDGER",
		2: "TENANT_STORAGE",
	}
	StorageIntegrity_value = map[string]int32{
		"STORAGE_INTEGRITY_UNSPECIFIED": 0,
		"LEDGER":                        1,
		"TENANT_STORAGE":                2,
	}
)

Enum value maps for StorageIntegrity.

View Source
var (
	ProofMechanism_name = map[int32]string{
		0: "PROOF_MECHANISM_UNSPECIFIED",
		1: "KHIPU",
		2: "SIMPLE_HASH",
		3: "TRIE_HASH",
		4: "TRIE_HASH_MERKLE",
		5: "TRIE_HASH_VERKLE",
	}
	ProofMechanism_value = map[string]int32{
		"PROOF_MECHANISM_UNSPECIFIED": 0,
		"KHIPU":                       1,
		"SIMPLE_HASH":                 2,
		"TRIE_HASH":                   3,
		"TRIE_HASH_MERKLE":            4,
		"TRIE_HASH_VERKLE":            5,
	}
)

Enum value maps for ProofMechanism.

View Source
var File_assets_v2_assets_enums_proto protoreflect.FileDescriptor
View Source
var File_assets_v2_assets_eventresponse_proto protoreflect.FileDescriptor
View Source
var File_assets_v2_assets_principal_proto protoreflect.FileDescriptor

Functions

func AssetIdentityFromUuid

func AssetIdentityFromUuid(uuid string) string

AssetIdentityFromUuid derives RRN identity for asset from a bare uuid id

func AssetUuidFromEventIdentity

func AssetUuidFromEventIdentity(eventIdentity string) string

AssetUuidFromEventIdentity gets the asset UUID from an event identity

func AssetUuidFromIdentity

func AssetUuidFromIdentity(assetIdentity string) string

AssetUuidFromIdentity derives asset base uuid id from RRN identity When the prefix does not match this will return the original identity unchanged

func ChainIDFromString

func ChainIDFromString(chainID string) (*big.Int, error)

ChainIDFromString converts the string representation of a chain id to a big integer. Ensuring it is <= floor(MAX_UINT64/2) - 36

We operate private consortia style networks and so can decide the range of chain ids we support for our networks. We choose to stick inside the uint64 representable range specified in the *stale* EIP-2294. We could in future relax this.

History: EIP-155 which introduced replay protection, does not specify an upper bound for chainId. The subsequent EIP-1344 for the ChainID opcode implicitly bounds it at 256bit (because that is the maximum the the evm allows for an atomic type).

func EventIdentityFromUuid

func EventIdentityFromUuid(assetUuid, eventUuid string) string

EventIdentityFromUuid derives RRN identity for asset from base uuid ids

func EventUuidFromIdentity

func EventUuidFromIdentity(eventIdentity string) string

EventUuidFromIdentity gets the event UUID from an event identity

func NewFlatMarshalerForAssets

func NewFlatMarshalerForAssets(ignoreFields []string) *simpleoneof.Marshaler

NewFlatMarshalerForAssets creates marshaler configured to handle assets/events

func NewFlatMarshalerForEvents

func NewFlatMarshalerForEvents() *simpleoneof.Marshaler

NewFlatMarshalerForEvents creates marshaler configured to handle assets/events

func NewFlatMarshalerForNotifications

func NewFlatMarshalerForNotifications() *simpleoneof.Marshaler

NewFlatMarshalerForNotifications create marshaler configured to handle event message - we send it to UI

func PermissionedIdentityFromPublic

func PermissionedIdentityFromPublic(publicIdentity string) string

PermissionedIdentityFromPublic returns the permissioned identity from the public identity

NOTE: if the given identity is already a permissioned identity, return the permissioned identity unchanged.

func PrivacyStringToPublicBool

func PrivacyStringToPublicBool(b string) (bool, error)

PrivacyStringToPublicBool converts a string repr of Privacy enum to bool.

func PrivacyToPublicBool

func PrivacyToPublicBool(b Privacy) bool

PrivacyToPublicBool converts Privacy to bool

func PublicIdentityFromPermissioned

func PublicIdentityFromPermissioned(permissionedIdentity string) string

PublicIdentityFromPermissioned returns the public identity from the permissioned identity

Types

type ConfirmationStatus

type ConfirmationStatus int32
const (
	ConfirmationStatus_CONFIRMATION_STATUS_UNSPECIFIED ConfirmationStatus = 0
	ConfirmationStatus_PENDING                         ConfirmationStatus = 1 // not yet committed
	ConfirmationStatus_CONFIRMED                       ConfirmationStatus = 2 // committed
	ConfirmationStatus_FAILED                          ConfirmationStatus = 3 // permanent failure
)

func (ConfirmationStatus) Descriptor

func (ConfirmationStatus) Enum

func (ConfirmationStatus) EnumDescriptor deprecated

func (ConfirmationStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use ConfirmationStatus.Descriptor instead.

func (ConfirmationStatus) Number

func (ConfirmationStatus) String

func (x ConfirmationStatus) String() string

func (ConfirmationStatus) Type

type EventResponse

type EventResponse struct {

	// Relative Resource Name for the operation event
	Identity string `protobuf:"bytes,1,opt,name=identity,proto3" json:"identity,omitempty"`
	// relative resource name for associated asset ( asset the operation is performed on  - has to have specific behaviour enabled)
	AssetIdentity string `protobuf:"bytes,2,opt,name=asset_identity,json=assetIdentity,proto3" json:"asset_identity,omitempty"`
	// map of event attributes. Specific behaviours define required and optional event attributes for each supported operation.
	EventAttributes map[string]*attribute.Attribute `` /* 195-byte string literal not displayed */
	// map of asset attributes. Specific behaviours define required and optional asset attributes. These attributes cause the corresponding attributes on the asset to be updated.
	AssetAttributes map[string]*attribute.Attribute `` /* 195-byte string literal not displayed */
	// name of operation on this behviour
	Operation string `protobuf:"bytes,4,opt,name=operation,proto3" json:"operation,omitempty"`
	// name of this behaviour
	Behaviour string `protobuf:"bytes,14,opt,name=behaviour,proto3" json:"behaviour,omitempty"`
	// timestamp when operation was actually performed - if not provided will be set to timestamp_accepted
	TimestampDeclared *timestamppb.Timestamp `protobuf:"bytes,5,opt,name=timestamp_declared,json=timestampDeclared,proto3" json:"timestamp_declared,omitempty"`
	// timestamp when system received operation request
	TimestampAccepted *timestamppb.Timestamp `protobuf:"bytes,6,opt,name=timestamp_accepted,json=timestampAccepted,proto3" json:"timestamp_accepted,omitempty"`
	// timestamp operation has been committed on the blockchain
	TimestampCommitted *timestamppb.Timestamp `protobuf:"bytes,7,opt,name=timestamp_committed,json=timestampCommitted,proto3" json:"timestamp_committed,omitempty"`
	// principal information associated with event - if not provided will be set to principal_accepted
	PrincipalDeclared *Principal `protobuf:"bytes,8,opt,name=principal_declared,json=principalDeclared,proto3" json:"principal_declared,omitempty"`
	// principal logged into the system that performed the operation
	PrincipalAccepted *Principal `protobuf:"bytes,9,opt,name=principal_accepted,json=principalAccepted,proto3" json:"principal_accepted,omitempty"`
	// indicated if operation has been committed to the blockchain
	ConfirmationStatus ConfirmationStatus `` /* 154-byte string literal not displayed */
	// hash of transaction committing this operation on blockchain
	TransactionId string `protobuf:"bytes,11,opt,name=transaction_id,json=transactionId,proto3" json:"transaction_id,omitempty"`
	// block number of committing transaction
	BlockNumber uint64 `protobuf:"varint,12,opt,name=block_number,json=blockNumber,proto3" json:"block_number,omitempty"`
	// transaction index of committing transaction
	TransactionIndex uint64 `protobuf:"varint,13,opt,name=transaction_index,json=transactionIndex,proto3" json:"transaction_index,omitempty"`
	// wallet address for the creator of this event
	From           string `protobuf:"bytes,15,opt,name=from,proto3" json:"from,omitempty"`
	TenantIdentity string `protobuf:"bytes,18,opt,name=tenant_identity,json=tenantIdentity,proto3" json:"tenant_identity,omitempty"`
	// contains filtered or unexported fields
}

func (*EventResponse) Descriptor deprecated

func (*EventResponse) Descriptor() ([]byte, []int)

Deprecated: Use EventResponse.ProtoReflect.Descriptor instead.

func (*EventResponse) GetAssetAttributes

func (x *EventResponse) GetAssetAttributes() map[string]*attribute.Attribute

func (*EventResponse) GetAssetIdentity

func (x *EventResponse) GetAssetIdentity() string

func (*EventResponse) GetBehaviour

func (x *EventResponse) GetBehaviour() string

func (*EventResponse) GetBlockNumber

func (x *EventResponse) GetBlockNumber() uint64

func (*EventResponse) GetConfirmationStatus

func (x *EventResponse) GetConfirmationStatus() ConfirmationStatus

func (*EventResponse) GetEventAttributes

func (x *EventResponse) GetEventAttributes() map[string]*attribute.Attribute

func (*EventResponse) GetFrom

func (x *EventResponse) GetFrom() string

func (*EventResponse) GetIdentity

func (x *EventResponse) GetIdentity() string

func (*EventResponse) GetOperation

func (x *EventResponse) GetOperation() string

func (*EventResponse) GetPrincipalAccepted

func (x *EventResponse) GetPrincipalAccepted() *Principal

func (*EventResponse) GetPrincipalDeclared

func (x *EventResponse) GetPrincipalDeclared() *Principal

func (*EventResponse) GetTenantIdentity

func (x *EventResponse) GetTenantIdentity() string

func (*EventResponse) GetTimestampAccepted

func (x *EventResponse) GetTimestampAccepted() *timestamppb.Timestamp

func (*EventResponse) GetTimestampCommitted

func (x *EventResponse) GetTimestampCommitted() *timestamppb.Timestamp

func (*EventResponse) GetTimestampDeclared

func (x *EventResponse) GetTimestampDeclared() *timestamppb.Timestamp

func (*EventResponse) GetTransactionId

func (x *EventResponse) GetTransactionId() string

func (*EventResponse) GetTransactionIndex

func (x *EventResponse) GetTransactionIndex() uint64

func (*EventResponse) ProtoMessage

func (*EventResponse) ProtoMessage()

func (*EventResponse) ProtoReflect

func (x *EventResponse) ProtoReflect() protoreflect.Message

func (*EventResponse) Reset

func (x *EventResponse) Reset()

func (*EventResponse) String

func (x *EventResponse) String() string

func (*EventResponse) Validate

func (m *EventResponse) Validate() error

Validate checks the field values on EventResponse with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*EventResponse) ValidateAll

func (m *EventResponse) ValidateAll() error

ValidateAll checks the field values on EventResponse with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in EventResponseMultiError, or nil if none found.

type EventResponseMultiError

type EventResponseMultiError []error

EventResponseMultiError is an error wrapping multiple validation errors returned by EventResponse.ValidateAll() if the designated constraints aren't met.

func (EventResponseMultiError) AllErrors

func (m EventResponseMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (EventResponseMultiError) Error

func (m EventResponseMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type EventResponseValidationError

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

EventResponseValidationError is the validation error returned by EventResponse.Validate if the designated constraints aren't met.

func (EventResponseValidationError) Cause

Cause function returns cause value.

func (EventResponseValidationError) Error

Error satisfies the builtin error interface

func (EventResponseValidationError) ErrorName

func (e EventResponseValidationError) ErrorName() string

ErrorName returns error name.

func (EventResponseValidationError) Field

Field function returns field value.

func (EventResponseValidationError) Key

Key function returns key value.

func (EventResponseValidationError) Reason

Reason function returns reason value.

type IdentityFactory

type IdentityFactory interface {
	// GenerateAssetIdentity produces RRN for asset
	GenerateAssetIdentity() string
	// GenerateEventIdentity produces RRN for event
	GenerateEventIdentity(string) string
}

IdentityFactory generates idintities for Events and Assets base on random UUIDv4

type Principal

type Principal struct {
	Issuer      string `protobuf:"bytes,1,opt,name=issuer,proto3" json:"issuer,omitempty"`
	Subject     string `protobuf:"bytes,2,opt,name=subject,proto3" json:"subject,omitempty"`
	DisplayName string `protobuf:"bytes,3,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"`
	Email       string `protobuf:"bytes,4,opt,name=email,proto3" json:"email,omitempty"`
	// contains filtered or unexported fields
}

func (*Principal) Descriptor deprecated

func (*Principal) Descriptor() ([]byte, []int)

Deprecated: Use Principal.ProtoReflect.Descriptor instead.

func (*Principal) GetDisplayName

func (x *Principal) GetDisplayName() string

func (*Principal) GetEmail

func (x *Principal) GetEmail() string

func (*Principal) GetIssuer

func (x *Principal) GetIssuer() string

func (*Principal) GetSubject

func (x *Principal) GetSubject() string

func (*Principal) ProtoMessage

func (*Principal) ProtoMessage()

func (*Principal) ProtoReflect

func (x *Principal) ProtoReflect() protoreflect.Message

func (*Principal) Reset

func (x *Principal) Reset()

func (*Principal) String

func (x *Principal) String() string

func (*Principal) Validate

func (m *Principal) Validate() error

Validate checks the field values on Principal with the rules defined in the proto definition for this message. If any rules are violated, the first error encountered is returned, or nil if there are no violations.

func (*Principal) ValidateAll

func (m *Principal) ValidateAll() error

ValidateAll checks the field values on Principal with the rules defined in the proto definition for this message. If any rules are violated, the result is a list of violation errors wrapped in PrincipalMultiError, or nil if none found.

type PrincipalMultiError

type PrincipalMultiError []error

PrincipalMultiError is an error wrapping multiple validation errors returned by Principal.ValidateAll() if the designated constraints aren't met.

func (PrincipalMultiError) AllErrors

func (m PrincipalMultiError) AllErrors() []error

AllErrors returns a list of validation violation errors.

func (PrincipalMultiError) Error

func (m PrincipalMultiError) Error() string

Error returns a concatenation of all the error messages it wraps.

type PrincipalValidationError

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

PrincipalValidationError is the validation error returned by Principal.Validate if the designated constraints aren't met.

func (PrincipalValidationError) Cause

func (e PrincipalValidationError) Cause() error

Cause function returns cause value.

func (PrincipalValidationError) Error

func (e PrincipalValidationError) Error() string

Error satisfies the builtin error interface

func (PrincipalValidationError) ErrorName

func (e PrincipalValidationError) ErrorName() string

ErrorName returns error name.

func (PrincipalValidationError) Field

func (e PrincipalValidationError) Field() string

Field function returns field value.

func (PrincipalValidationError) Key

Key function returns key value.

func (PrincipalValidationError) Reason

func (e PrincipalValidationError) Reason() string

Reason function returns reason value.

type ProofMechanism

type ProofMechanism int32
const (
	ProofMechanism_PROOF_MECHANISM_UNSPECIFIED ProofMechanism = 0
	ProofMechanism_KHIPU                       ProofMechanism = 1
	ProofMechanism_SIMPLE_HASH                 ProofMechanism = 2
	ProofMechanism_TRIE_HASH                   ProofMechanism = 3
	ProofMechanism_TRIE_HASH_MERKLE            ProofMechanism = 4
	ProofMechanism_TRIE_HASH_VERKLE            ProofMechanism = 5
)

func (ProofMechanism) Descriptor

func (ProofMechanism) Enum

func (x ProofMechanism) Enum() *ProofMechanism

func (ProofMechanism) EnumDescriptor deprecated

func (ProofMechanism) EnumDescriptor() ([]byte, []int)

Deprecated: Use ProofMechanism.Descriptor instead.

func (ProofMechanism) Number

func (ProofMechanism) String

func (x ProofMechanism) String() string

func (ProofMechanism) Type

type StorageIntegrity

type StorageIntegrity int32

Specifies how the asset data will be stored. This is set once on creation and does not change.

const (
	StorageIntegrity_STORAGE_INTEGRITY_UNSPECIFIED StorageIntegrity = 0
	StorageIntegrity_LEDGER                        StorageIntegrity = 1
	StorageIntegrity_TENANT_STORAGE                StorageIntegrity = 2
)

func (StorageIntegrity) Descriptor

func (StorageIntegrity) Enum

func (StorageIntegrity) EnumDescriptor deprecated

func (StorageIntegrity) EnumDescriptor() ([]byte, []int)

Deprecated: Use StorageIntegrity.Descriptor instead.

func (StorageIntegrity) Number

func (StorageIntegrity) String

func (x StorageIntegrity) String() string

func (StorageIntegrity) Type

type TrackedStatus

type TrackedStatus int32
const (
	TrackedStatus_TRACKED_STATUS_UNSPECIFIED TrackedStatus = 0
	TrackedStatus_TRACKED                    TrackedStatus = 1
	TrackedStatus_NOT_TRACKED                TrackedStatus = 2
	TrackedStatus_ANY                        TrackedStatus = 3
)

func (TrackedStatus) Descriptor

func (TrackedStatus) Enum

func (x TrackedStatus) Enum() *TrackedStatus

func (TrackedStatus) EnumDescriptor deprecated

func (TrackedStatus) EnumDescriptor() ([]byte, []int)

Deprecated: Use TrackedStatus.Descriptor instead.

func (TrackedStatus) Number

func (TrackedStatus) String

func (x TrackedStatus) String() string

func (TrackedStatus) Type

type UUIDIdentityFactory

type UUIDIdentityFactory struct{}

UUIDIdentityFactory generates UUID based identities

func (*UUIDIdentityFactory) GenerateAssetIdentity

func (u *UUIDIdentityFactory) GenerateAssetIdentity() string

GenerateAssetIdentity produces RRN for asset

func (*UUIDIdentityFactory) GenerateEventIdentity

func (u *UUIDIdentityFactory) GenerateEventIdentity(assetIdentity string) string

GenerateEventIdentity produces RRN for event

Jump to

Keyboard shortcuts

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