Show / Hide Table of Contents

Struct AppProtocolVersion

A claim of a version.

Every peer in network shows others their AppProtocolVersion information. As every peer can change its software by itself, this AppProtocolVersion is theoretically arbitrary, hence a “claim.” (i.e., no authority).

In order to verify who claimed a version, every AppProtocolVersion has its Signature which is made by its Signer. Verify(PublicKey) method purposes to determine whether an information is claimed by its corresponding Signer in fact.

Implements
IEquatable<AppProtocolVersion>
Namespace: Libplanet.Net
Assembly: Libplanet.dll
Syntax
public struct AppProtocolVersion : IEquatable<AppProtocolVersion>

Constructors

| Improve this Doc View Source

AppProtocolVersion(Int32, IValue, ImmutableArray<Byte>, Address)

Initializes an AppProtocolVersion value with field values.

Declaration
public AppProtocolVersion(int version, IValue extra, ImmutableArray<byte> signature, Address signer)
Parameters
Type Name Description
Int32 version

Sets the Version.

IValue extra

Sets the Extra.

ImmutableArray<Byte> signature

Sets the Signature.

Address signer

Gets the Signer.

Fields

| Improve this Doc View Source

Extra

Optional extra data about the version. This can be used for any purpose by apps, such as a URL to download the software.

Declaration
public readonly IValue Extra
Field Value
Type Description
IValue
| Improve this Doc View Source

Signer

A signer who claims presence of a version.

Declaration
public readonly Address Signer
Field Value
Type Description
Address
| Improve this Doc View Source

Version

The version number. This does not have to be increased by only 1, but can be more than that.

Declaration
public readonly int Version
Field Value
Type Description
Int32

Properties

| Improve this Doc View Source

Signature

A signature which verifies Signer's claim of a version.

Declaration
public ImmutableArray<byte> Signature { get; }
Property Value
Type Description
ImmutableArray<Byte>
| Improve this Doc View Source

Token

A token string which serializes an AppProtocolVersion.

As this is designed to be easy to copy and paste, the format consists of only printable characters in the ASCII character set.

A token can be deserialized into an AppProtocolVersion through FromToken(String) method.

Declaration
public string Token { get; }
Property Value
Type Description
String
See Also
FromToken(String)

Methods

| Improve this Doc View Source

Equals(AppProtocolVersion)

Declaration
public bool Equals(AppProtocolVersion other)
Parameters
Type Name Description
AppProtocolVersion other
Returns
Type Description
Boolean
| Improve this Doc View Source

Equals(Object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj
Returns
Type Description
Boolean
| Improve this Doc View Source

FromToken(String)

Deserializes a Token into an AppProtocolVersion object.

Declaration
public static AppProtocolVersion FromToken(string token)
Parameters
Type Name Description
String token

A Token string.

Returns
Type Description
AppProtocolVersion

A deserialized AppProtocolVersion object.

See Also
Token
| Improve this Doc View Source

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
Int32
| Improve this Doc View Source

Sign(PrivateKey, Int32, IValue)

Claim a version with extra data and sign it using the given private key.

Declaration
public static AppProtocolVersion Sign(PrivateKey signer, int version, IValue extra = null)
Parameters
Type Name Description
PrivateKey signer

A private key to sign the claim.

Int32 version

A version to claim.

IValue extra

Extra data to claim.

Returns
Type Description
AppProtocolVersion

A signed version claim.

| Improve this Doc View Source

ToString()

Declaration
public override string ToString()
Returns
Type Description
String
| Improve this Doc View Source

Verify(PublicKey)

Verifies whether the claim is certainly signed by the Signer.

Declaration
public bool Verify(PublicKey publicKey)
Parameters
Type Name Description
PublicKey publicKey

A public key of the Signer.

Returns
Type Description
Boolean

true if and only if the given publicKey is Signer's and the Signature is certainly signed by the Signer.

Operators

| Improve this Doc View Source

Equality(AppProtocolVersion, AppProtocolVersion)

Declaration
public static bool operator ==(AppProtocolVersion left, AppProtocolVersion right)
Parameters
Type Name Description
AppProtocolVersion left
AppProtocolVersion right
Returns
Type Description
Boolean
| Improve this Doc View Source

Inequality(AppProtocolVersion, AppProtocolVersion)

Declaration
public static bool operator !=(AppProtocolVersion left, AppProtocolVersion right)
Parameters
Type Name Description
AppProtocolVersion left
AppProtocolVersion right
Returns
Type Description
Boolean

Implements

IEquatable<>
  • Improve this Doc
  • View Source
Back to top Copyright © 2019–2020 Planetarium