Documentation
¶
Index ¶
- Constants
- Variables
- func ASN1MarshalTxNamespace(tx *protoblocktx.Tx, nsIndex int) ([]byte, error)
- func AsnToProtoVersion(ver int64) *uint64
- func DigestTxNamespace(tx *protoblocktx.Tx, nsIndex int) ([]byte, error)
- func ProtoToAsnVersion(ver *uint64) int64
- type BLSVerifier
- type Digest
- type DigestVerifier
- type EcdsaTxVerifier
- type EdDSAVerifier
- type NsVerifier
- type PrivateKey
- type PublicKey
- type Read
- type ReadWrite
- type Scheme
- type Signature
- type TxWithNamespace
- type Write
Constants ¶
const BlsHashPrefix = "BLS"
BlsHashPrefix is the prefix used to verify a BLS scheme signature.
Variables ¶
var ( // ErrSignatureMismatch is returned when a verifier detect a wrong signature. ErrSignatureMismatch = errors.New("signature mismatch") // AllSchemes all the supported scheme. AllSchemes = []Scheme{ NoScheme, Ecdsa, Bls, Eddsa, } // AllRealSchemes all supported real scheme (excluding NoScheme). AllRealSchemes = []Scheme{ Ecdsa, Bls, Eddsa, } )
Functions ¶
func ASN1MarshalTxNamespace ¶ added in v0.1.4
func ASN1MarshalTxNamespace(tx *protoblocktx.Tx, nsIndex int) ([]byte, error)
ASN1MarshalTxNamespace marshals a transactions for a given namespace index. It uses the schema described in tx_schema.asn.
func AsnToProtoVersion ¶ added in v0.1.4
AsnToProtoVersion converts the ASN.1 version to proto version. ASN.1 uses -1 to encode nil version.
func DigestTxNamespace ¶
func DigestTxNamespace(tx *protoblocktx.Tx, nsIndex int) ([]byte, error)
DigestTxNamespace digests a transactions for a given namespace index.
func ProtoToAsnVersion ¶ added in v0.1.4
ProtoToAsnVersion converts the proto version to ASN.1 version. ASN.1 uses -1 to encode nil version.
Types ¶
type BLSVerifier ¶
type BLSVerifier struct {
// contains filtered or unexported fields
}
BLSVerifier verifies using the BLS scheme.
func NewBLSVerifier ¶
func NewBLSVerifier(key []byte) (*BLSVerifier, error)
NewBLSVerifier instantiate a new BLS scheme verifier.
type DigestVerifier ¶
DigestVerifier verifies a digest.
type EcdsaTxVerifier ¶
type EcdsaTxVerifier struct {
// contains filtered or unexported fields
}
EcdsaTxVerifier verifies using the ECDSA scheme.
func NewEcdsaVerifier ¶
func NewEcdsaVerifier(key []byte) (*EcdsaTxVerifier, error)
NewEcdsaVerifier instantiate a new ECDSA scheme verifier.
type EdDSAVerifier ¶
EdDSAVerifier verifies using the EdDSA scheme.
type NsVerifier ¶
type NsVerifier struct { Scheme Scheme PublicKey PublicKey // contains filtered or unexported fields }
NsVerifier verifies a given namespace.
func NewNsVerifier ¶
func NewNsVerifier(scheme Scheme, key PublicKey) (*NsVerifier, error)
NewNsVerifier creates a new namespace verifier according to the implementation scheme.
func (*NsVerifier) VerifyNs ¶
func (v *NsVerifier) VerifyNs(tx *protoblocktx.Tx, nsIndex int) error
VerifyNs verifies a transaction's namespace signature.
type Read ¶
Read is a stab for protoblocktx.Read. Any change to this protobuf requires a change to these structures.
type ReadWrite ¶
ReadWrite is a stab for protoblocktx.ReadWrite. Any change to this protobuf requires a change to these structures.
type TxWithNamespace ¶ added in v0.1.4
type TxWithNamespace struct { TxID string `asn1:"utf8"` NamespaceID string `asn1:"utf8"` NamespaceVersion int64 ReadsOnly []Read ReadWrites []ReadWrite BlindWrites []Write }
TxWithNamespace is a stab for protoblocktx.Tx and protoblocktx.TxNamespace. Any change to these protobuf requires a change to these structures. It conforms with tx_schema.asn. We force the ASN.1 library to use UTF8 strings to avoid incompatibility with the schema. If not specified, the library choose to use ASCII (PrintableString) for simple strings, and UTF8 otherwise.
func TranslateTx ¶ added in v0.1.4
func TranslateTx(tx *protoblocktx.Tx, nsIndex int) (*TxWithNamespace, error)
TranslateTx translates a TX namespace to a stab struct for tx_schema.asn. Any change to *protoblocktx.Tx requires a change to this method.
type Write ¶ added in v0.1.4
Write is a stab for protoblocktx.Write. Any change to this protobuf requires a change to these structures.