hashberg-io / dag-cbor Goto Github PK
View Code? Open in Web Editor NEWPython implementation of the DAG-CBOR codec for IPLD.
Home Page: https://dag-cbor.readthedocs.io
License: MIT License
Python implementation of the DAG-CBOR codec for IPLD.
Home Page: https://dag-cbor.readthedocs.io
License: MIT License
In _decode_head
, under the additional_info == 24
branch, we must raise error if the next byte contains a value less than 24
, since that should have been encoded as the additional_info
instead.
First of all, thank you for providing this library ๐
When trying to create DAG-CBOR data with this libray, I discovered that go-ipfs is not able to import data created this way. Further investigation showed that the encoder doesn't include the Multibase prefix (0x00
) as required by the IPLD spec.
Introduce support for IPLD Schemas, with custom choice of representation strategies.
I just want to mention that we have a repo for IPLD codec test fixtures at https://github.com/ipld/codec-fixtures. You might be interested in adding your library there.
Errors messages should convey detailed information about the specific point in the byte-stream at which the error occurred, together with a snapshow of the relevant byte values, for easier debugging of applications using this library.
Apologies for this unrelated GitHub issue, but I couldn't find a better way to contact you.
I'm one of the maintainers of Quetz, the open-source server for Conda packages. We're currently distributing our library under the 'quetz-server' namespace on PyPI, as 'quetz' is already taken by you. This breaks some of our automation, which makes releasing new versions of Quetz inconvenient.
Are you open to giving us ownership over the 'quetz' namespace on PyPI? This would help us tremendously.
If that's okay with you, I suggest transferring the project ownership to my PyPI account, jan_jagusch.
Thanks a lot in advance for considering my request. If you have any questions, please let me know. ๐
traceback:
File "/Users/ilyasiamionau/projects/atproto/atproto/cbor/__init__.py", line 4, in <module>
import dag_cbor as _dag_cbor
File "/Users/ilyasiamionau/Library/Caches/pypoetry/virtualenvs/atproto-iBRicY1L-py3.8/lib/python3.8/site-packages/dag_cbor/__init__.py", line 9, in <module>
from .ipld import IPLDKind, IPLDScalarKind, IPLDObjPath
File "/Users/ilyasiamionau/Library/Caches/pypoetry/virtualenvs/atproto-iBRicY1L-py3.8/lib/python3.8/site-packages/dag_cbor/ipld.py", line 30, in <module>
from multiformats import CID
File "/Users/ilyasiamionau/Library/Caches/pypoetry/virtualenvs/atproto-iBRicY1L-py3.8/lib/python3.8/site-packages/multiformats/__init__.py", line 22, in <module>
from . import multibase
File "/Users/ilyasiamionau/Library/Caches/pypoetry/virtualenvs/atproto-iBRicY1L-py3.8/lib/python3.8/site-packages/multiformats/multibase/__init__.py", line 22, in <module>
from bases import (base2, base16, base8, base10, base36, base58btc, base58flickr, base58ripple,
File "/Users/ilyasiamionau/Library/Caches/pypoetry/virtualenvs/atproto-iBRicY1L-py3.8/lib/python3.8/site-packages/bases/__init__.py", line 40, in <module>
from . import encoding as encoding
File "/Users/ilyasiamionau/Library/Caches/pypoetry/virtualenvs/atproto-iBRicY1L-py3.8/lib/python3.8/site-packages/bases/encoding/__init__.py", line 293, in <module>
base8 = FixcharBaseEncoding(alphabet.base8, pad_char="=", padding="include")
File "/Users/ilyasiamionau/Library/Caches/pypoetry/virtualenvs/atproto-iBRicY1L-py3.8/lib/python3.8/site-packages/bases/encoding/fixchar.py", line 106, in __init__
validate(char_nbits, Union[int, Literal["auto"]])
File "/Users/ilyasiamionau/Library/Caches/pypoetry/virtualenvs/atproto-iBRicY1L-py3.8/lib/python3.8/site-packages/typing_validation/validation.py", line 635, in validate
_validate_union(val, t)
File "/Users/ilyasiamionau/Library/Caches/pypoetry/virtualenvs/atproto-iBRicY1L-py3.8/lib/python3.8/site-packages/typing_validation/validation.py", line 515, in _validate_union
validate(val, member_t)
File "/Users/ilyasiamionau/Library/Caches/pypoetry/virtualenvs/atproto-iBRicY1L-py3.8/lib/python3.8/site-packages/typing_validation/validation.py", line 691, in validate
raise unsupported_type_error
ValueError: Unsupported validation for type typing_extensions.Literal['auto'].
pls dont drop support of typing-extensions < 4.6.0 during fix, thanks
Hi all! First off, thank you for maintaining dag-cbor. It's great!
I came across an encoded DAG-CBOR object that makes dag-cbor
recurse infinitely, or at least deeper than Python's default max recursion depth. Here it is, base64-encoded: bad.b64.txt
Here's the stack trace snippet:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/ryan/src/bridgy-fed/local/lib/python3.11/site-packages/dag_cbor/decoding/__init__.py", line 127, in decode
data, _ = _decode_item(stream, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ryan/src/bridgy-fed/local/lib/python3.11/site-packages/dag_cbor/decoding/__init__.py", line 149, in _decode_item
value, num_bytes_further_read = _decoders[major_type](stream, arg, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ryan/src/bridgy-fed/local/lib/python3.11/site-packages/dag_cbor/decoding/__init__.py", line 272, in _decode_dict
v, _ = _decode_item(stream, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ryan/src/bridgy-fed/local/lib/python3.11/site-packages/dag_cbor/decoding/__init__.py", line 149, in _decode_item
value, num_bytes_further_read = _decoders[major_type](stream, arg, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ryan/src/bridgy-fed/local/lib/python3.11/site-packages/dag_cbor/decoding/__init__.py", line 231, in _decode_list
item, _ = _decode_item(stream, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ryan/src/bridgy-fed/local/lib/python3.11/site-packages/dag_cbor/decoding/__init__.py", line 149, in _decode_item
value, num_bytes_further_read = _decoders[major_type](stream, arg, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/ryan/src/bridgy-fed/local/lib/python3.11/site-packages/dag_cbor/decoding/__init__.py", line 231, in _decode_list
item, _ = _decode_item(stream, options)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
You're not the only ones, whatever JS lib @ericvolp12 is using on atproto.tools has the same problem ๐: https://atproto.tools/records?did=did%3Aplc%3A4agp2hcrps6ou4vjv7uux7dm
Thanks in advance!
According to this comment and this PR, it should now be provide a fully recursive definition of EncodableType
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.