Documentation
¶
Overview ¶
Package irohasign signs Iroha v1 transactions with Ed25519-SHA3 (SHA3-512 in place of SHA-512), incompatible with stdlib crypto/ed25519.
Index ¶
- func FullHash(payload *irohapb.Transaction_Payload) ([]byte, error)
- func ReSignWithBatchMeta(transactionBytes []byte, kp KeyPair, reducedHashesHex []string) (*irohapb.Transaction, error)
- func ReducedHash(reducedPayload *irohapb.Transaction_Payload_ReducedPayload) ([]byte, error)
- type KeyPair
- type TransactionBuilder
- func (b *TransactionBuilder) GrantPermission(accountID string, permission irohapb.GrantablePermission) *TransactionBuilder
- func (b *TransactionBuilder) ReducedHash() ([]byte, error)
- func (b *TransactionBuilder) ReducedHashHex() (string, error)
- func (b *TransactionBuilder) SetQuorum(quorum uint32) *TransactionBuilder
- func (b *TransactionBuilder) Sign(kp KeyPair) (*irohapb.Transaction, error)
- func (b *TransactionBuilder) SignWithBatchMeta(kp KeyPair, reducedHashesHex []string) (*irohapb.Transaction, error)
- func (b *TransactionBuilder) TransferAsset(srcAccountID, destAccountID, assetID, description, amount string) *TransactionBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FullHash ¶
func FullHash(payload *irohapb.Transaction_Payload) ([]byte, error)
FullHash hashes the whole Payload — iroha-java's Utils.hash / toHexHash. This is also the message that gets signed, not the raw payload; see Transaction.sign in transaction.go.
func ReSignWithBatchMeta ¶
func ReSignWithBatchMeta(transactionBytes []byte, kp KeyPair, reducedHashesHex []string) (*irohapb.Transaction, error)
ReSignWithBatchMeta re-signs a built transaction with ATOMIC batch metadata known only after a first round trip.
func ReducedHash ¶
func ReducedHash(reducedPayload *irohapb.Transaction_Payload_ReducedPayload) ([]byte, error)
ReducedHash hashes ReducedPayload alone, excluding batch metadata — iroha-java's Utils.reducedHash.
Types ¶
type KeyPair ¶
KeyPair is an Iroha Ed25519-SHA3 key pair: a 32-byte seed and public key.
func GenerateKeyPair ¶
GenerateKeyPair creates a new random key pair.
func KeyPairFromHex ¶
KeyPairFromHex parses a hex-encoded public key and seed, as produced by AccountRecord.publicKey/privateKey.
func (KeyPair) PrivateHex ¶
PrivateHex is the lowercase hex encoding of the raw seed, not an expanded 64-byte secret key.
type TransactionBuilder ¶
type TransactionBuilder struct {
// contains filtered or unexported fields
}
TransactionBuilder mirrors iroha-java's builder chain; only GrantPermission and TransferAsset commands are implemented so far.
func NewTransactionBuilder ¶
func NewTransactionBuilder(creatorAccountID string, createdTimeUnixMillis uint64) *TransactionBuilder
NewTransactionBuilder starts a transaction with an explicit created-time (Unix ms) — reuse it for any later re-hash or re-sign.
func (*TransactionBuilder) GrantPermission ¶
func (b *TransactionBuilder) GrantPermission(accountID string, permission irohapb.GrantablePermission) *TransactionBuilder
GrantPermission appends a GrantPermission command.
func (*TransactionBuilder) ReducedHash ¶
func (b *TransactionBuilder) ReducedHash() ([]byte, error)
ReducedHash returns the SHA3-256 reduced-payload hash, unsigned — payment-service's grantPermissionReducedHash.
func (*TransactionBuilder) ReducedHashHex ¶
func (b *TransactionBuilder) ReducedHashHex() (string, error)
ReducedHashHex is ReducedHash, hex-encoded uppercase like iroha-java's Utils.toHex.
func (*TransactionBuilder) SetQuorum ¶
func (b *TransactionBuilder) SetQuorum(quorum uint32) *TransactionBuilder
SetQuorum overrides this transaction's default quorum of 1 (signatures required).
func (*TransactionBuilder) Sign ¶
func (b *TransactionBuilder) Sign(kp KeyPair) (*irohapb.Transaction, error)
Sign finalizes and signs a standalone (non-batched) transaction.
func (*TransactionBuilder) SignWithBatchMeta ¶
func (b *TransactionBuilder) SignWithBatchMeta(kp KeyPair, reducedHashesHex []string) (*irohapb.Transaction, error)
SignWithBatchMeta signs as part of an ATOMIC batch; include this transaction's own ReducedHashHex in reducedHashesHex.
func (*TransactionBuilder) TransferAsset ¶
func (b *TransactionBuilder) TransferAsset(srcAccountID, destAccountID, assetID, description, amount string) *TransactionBuilder
TransferAsset appends a TransferAsset command.