bbclib.libs.bbclib_asset module

Copyright (c) 2018 beyond-blockchain.org.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

class bbclib.libs.bbclib_asset.BBcAsset(user_id=None, asset_file=None, asset_body=None, id_length=None, version=2)[source]

Bases: object

Asset part in a transaction

add(user_id=None, asset_file=None, asset_body=None)[source]

Add parts in this object

digest()[source]

Calculate the digest

The digest corresponds to the asset_id of this object

Returns:asset_id (or digest)
Return type:bytes
get_asset_file()[source]

Get asset file content and its digest

Returns:digest of the file content bytes: the file content
Return type:bytes
pack(for_digest_calculation=False)[source]

Pack this object

Parameters:for_digest_calculation (bool) – True if digest calculation
Returns:packed binary data
Return type:bytes
recover_asset_file(asset_file)[source]

Recover asset file info from the given raw content

unpack(data)[source]

Unpack into this object

Parameters:data (bytes) – packed binary data
Returns:True if successful
Return type:bool