PrefixSha256

types~ PrefixSha256

PREFIX-SHA-256: Prefix condition using SHA-256.

A prefix condition will prepend a static prefix to the message before passing the prefixed message on to a single subcondition.

You can use prefix conditions to effectively narrow the scope of a public key or set of public keys. Simply take the condition representing the public key and place it as a subcondition in a prefix condition. Now any message passed to the subcondition will be prepended with a prefix.

Prefix conditions are especially useful in conjunction with threshold conditions. You could have a group of signers, each using a different prefix to sign a common message.

PREFIX-SHA-256 is assigned the type ID 1. It relies on the SHA-256 and PREFIX feature suites which corresponds to a feature bitmask of 0x05.

Constructor

new PrefixSha256()

Source:

Methods

getBitmask() → {Number}

Get full bitmask.

This is a type of condition that contains a subcondition. A complete bitmask must contain the set of types that must be supported in order to validate this fulfillment. Therefore, we need to calculate the bitwise OR of this condition's TYPE_BIT and the subcondition's bitmask.

Source:
Returns:

Complete bitmask for this fulfillment.

Type
Number

setPrefix(prefix)

Set the prefix.

The prefix will be prepended to the message during validation before the message is passed on to the subcondition.

Parameters:
Name Type Description
prefix Buffer

Prefix to apply to the message.

Source:

setSubcondition(subcondition)

Set the (unfulfilled) subcondition.

Each prefix condition builds on an existing condition which is provided via this method.

Parameters:
Name Type Description
subcondition Condition

Condition that will receive the prefixed message.

Source:

setSubconditionUri(Subcondition)

Set the (unfulfilled) subcondition.

This will automatically parse the URI and call setSubcondition.

Parameters:
Name Type Description
Subcondition String

URI.

Source:

setSubfulfillment(fulfillment)

Set the (fulfilled) subcondition.

When constructing a prefix fulfillment, this method allows you to pass in a fulfillment for the condition that will receive the prefixed message.

Note that you only have to add either the subcondition or a subfulfillment, but not both.

Parameters:
Name Type Description
fulfillment Fulfillment

Fulfillment to use for the subcondition.

Source:

setSubfulfillmentUri(Subfulfillment)

Set the (fulfilled) subcondition.

This will automatically parse the URI and call setSubfulfillment.

Parameters:
Name Type Description
Subfulfillment String

URI.

Source:

validate(message) → {Boolean}

Check whether this fulfillment meets all validation criteria.

This will validate the subfulfillment. The message will be prepended with the prefix before being passed to the subfulfillment's validation routine.

Parameters:
Name Type Description
message Buffer

Message to validate against.

Source:
Returns:

Whether this fulfillment is valid.

Type
Boolean