Status: idealose draftdraftproposalfinal reviewstable

B://inject v1

High-level description:

If you provide content from the blockchain you are compatible with the B://inject protocol v1 if

Please share inputs and comments or see binject.bico.media for more information.

Introduction

The B://inject protocol v1 describes the concept "direct injection". It is a structured way of replacing a specific part of the content in one transaction with the full content of a specific other transaction.

Context

Description

An "injection tag" is a text string consisting of a 'moustache' like syntax of {{...}} directly surrounding a URL starting with B:// followed by a 64 chars hexadecimal transaction ID. Bandlebars are case insensitive.

Injection tags for v1 comes in 2 versions. One for raw data and one for processed data.

Raw data

Injection tags for raw data are formatted like {{B://[TX]}} and indicates that the raw untreated data of the target TX must replace the tag. The replacement must be binary safe and there can be no added content like space or lines.

Processed data

Injection tags for processed data are formatted like {{B://[TX]/}} and indicates that the content provider shall process the data before injectionig. The processing must include replacing aspects described in B://inject v1. The content provider is free to do any other processing of the content as long as its consistent with what would be presented had the client originally requested the target TX.

Hint

Inject tags for processed data may have added a hint at the end of the url to indicate to the content provider what the processing must include. In v1 there are two possible hint that can be given:

Processing a B64 hint

A B64 hint shall be processed by the following sequence before injecting it into the content of the current TX:

Processing a B64/ hint

A B64/ hint shall be processed by the following sequence before injecting it into the content of the current TX:

Other aspects

Errors

If any error happens during the processing this must be signalled to the client by replacing the // part of the url in the bandlebar with an emoji. Example:

{{B:❌66a6e1eb5ebecca707a03740069461a6b8fa9cca3753d00009f47d1d68a15d25}}

It is suggested to use "Cross Mark" as the default emoji but each content provider is free to select other emojis to indicate problems as they see fit. Examples could be 🔥 for internal server errors, ⌛ for timeouts and ☠️ if a base64 decoding fails based on a B64 hint.

Encoding

There shall be no encoding transformation during the flow of processing. This will result in all data being presented in the encoding of the current TX.

Implementation inputs

Any string that matches the following regular expression is a v1 bandlebar:

/\{\{B:\/\/[a-f\d]{64}(\/(B64\/?)?)?\}\}/ig 

Examples:

Base 64 and data urls

Data urls becomes pure content if the following is replaced with an empty string:

/^\s*data:[^,],/i

Please note that the original information about encoding is ignored and that v1 only supports base64.

Loops

As the content can only refer to previous transactions there will be no problem with circular references.


Please share inputs and comments or see binject.bico.media for more information.