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

getSubtypes() → {Set.<String>}

Get types used in this condition.

This is a type of condition that contains a subcondition. A complete set of subtypes must contain the set of types that must be supported in order to validate this fulfillment. Therefore, we need to join the type of this condition to the types used in the subcondition.

Source:
Returns:

Complete type names for this fulfillment.

Type
Set.<String>

setMaxMessageLength(maxMessageLength)

Set the threshold.

Determines the threshold that is used to consider this condition fulfilled. If the number of valid subfulfillments is greater or equal to this number, the threshold condition is considered to be fulfilled.

Parameters:
Name Type Description
maxMessageLength Number

Integer threshold

Source:

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 | String

Condition object or URI string representing the condition that will receive the prefixed message.

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 | String

Fulfillment object or URI string representing the fulfillment to use as the subcondition.

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