class Stremio::Addon::DevKit::UserData::V1::Header

Overview

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)

Defined in:

stremio-addon-devkit/userdata/v1.cr

Constant Summary

BIT_COUNT = LENGTHS.sum

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)

BYTE_COUNT = (BIT_COUNT / 8.0).ceil.to_i

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)

BYTESIZE = 2

How many bytes this header takes

FIELDS = {reserve => UInt8, keyring => UInt8, compress => UInt8, version => UInt8, iv_random => UInt8} of Nil => Nil

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)

LENGTHS = [1, 3, 1, 3, 8] of Int32

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)

VERSION = 1_u8

The version we register as (must fit within @version)

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.new(bytes : Bytes) #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


Class Method Detail

def self.create(bytes : Bytes) #

Returns a Header constructed with bytes Paramaters:

  • bytes: The header in network byte order, meaning bytes[0] contains the "high" bits

WARNING the use of Header.new() should be avoided (and for some reason we cannot create our own initialize()


[View source]
def self.create(random_generator = Random::Secure) #

Returns an empty Header header with the version set

Parameters:

  • random_generator uses a pseudo or real random number generator, ::Random#new can be used for unit tests

WARNING the use of Header.new() should be avoided (and for some reason we cannot create our own initialize()


[View source]

Instance Method Detail

def compress : UInt8 #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def compress=(v : UInt8) #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def iv(iv_static : Nil) #

Returns a cryptocraphically random initial vector Paramaters:

  • iv_static: An optional fragement of the initial vector. The #iv_random + iv_static create enough entropy that we can build a suitable iv

[View source]
def iv(iv_static) #

Returns a cryptocraphically random initial vector Paramaters:

  • iv_static: An optional fragement of the initial vector. The #iv_random + iv_static create enough entropy that we can build a suitable iv

[View source]
def iv_random : UInt8 #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def iv_random=(v : UInt8) #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def keyring : UInt8 #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def keyring=(v : UInt8) #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def reserve : UInt8 #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def reserve=(v : UInt8) #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def to_s #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def to_slice #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def to_t #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def version : UInt8 #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)


def version=(v : UInt8) #

Our enrypted userdata contains a custom header. We can support different versions of these header. This class defines Version 1.

WARNING Headers are stored and transmitted as big endian (aka: network byte order)