Documentation
¶
Index ¶
- Constants
- Variables
- func PublicKeyToIDBytes(pub *ecdsa.PublicKey) []byte
- func ScriptHashToIDBytes(sh util.Uint160) []byte
- type ID
- func (id *ID) Equal(id2 *ID) bool
- func (id *ID) Marshal() ([]byte, error)
- func (id *ID) MarshalJSON() ([]byte, error)
- func (id *ID) Parse(s string) error
- func (id *ID) SetPublicKey(pub *ecdsa.PublicKey)
- func (id *ID) SetScriptHash(u util.Uint160)
- func (id *ID) String() string
- func (id *ID) ToV2() *refs.OwnerID
- func (id *ID) Unmarshal(data []byte) error
- func (id *ID) UnmarshalJSON(data []byte) error
- func (id *ID) Valid() bool
Constants ¶
const NEO3WalletSize = 25
NEO3WalletSize contains size of neo3 wallet.
Variables ¶
var ErrEmptyPublicKey = errors.New("empty public key")
ErrEmptyPublicKey when public key passed to Verify method is nil.
Functions ¶
func PublicKeyToIDBytes ¶
PublicKeyToIDBytes converts public key to a byte slice of NEO3WalletSize length. It is similar to decoding a NEO3 address but is inlined to skip base58 encoding-decoding step make it clear that no errors can occur.
func ScriptHashToIDBytes ¶
ScriptHashToIDBytes converts NEO3 script hash to a byte slice of NEO3WalletSize length.
Types ¶
type ID ¶
ID represents v2-compatible owner identifier.
func NewID ¶
func NewID() *ID
NewID creates and initializes blank ID.
Works similar as NewIDFromV2(new(OwnerID)).
Defaults:
- value: nil.
func NewIDFromN3Account ¶
NewIDFromN3Account creates new owner identity from N3 wallet account.
func NewIDFromPublicKey ¶
NewIDFromPublicKey creates new owner identity from ECDSA public key.
func (*ID) Equal ¶
Equal defines a comparison relation on ID's.
ID's are equal if they have the same binary representation.
func (*ID) MarshalJSON ¶
MarshalJSON encodes ID to protobuf JSON format.
func (*ID) SetPublicKey ¶
SetPublicKey sets owner identifier value to the provided NEO3 public key.
func (*ID) SetScriptHash ¶
SetScriptHash sets owner identifier value to the provided NEO3 script hash.
func (*ID) UnmarshalJSON ¶
UnmarshalJSON decodes ID from protobuf JSON format.