Skip to content

CBOR deterministic decoding for Array entries for Collaborators and DocumentRefs types. #656

@Mr-Leshiy

Description

@Mr-Leshiy

Summary

Modify the cbork-utils::array::Array Decoding, to optionally apply From RFC 8949 Section 4.2.3 rule for array entries.

The keys in every map must be sorted in the following order:
///  1. If two keys have different lengths, the shorter one sorts earlier;
///  2. If two keys have the same length, the one with the lower value in (byte-wise)
///     lexical order sorts earlier."

So the CBOR array become deterministically sorted.

Apply these freshly added CBOR decoding rules for Collaborators and DocumentRefs.
This would imply for the same set of data, having the deterministic binary representation.

Description

  • Add a new option for DecodeCtx
pub enum DecodeCtx {
    /// Decode a CBOR object applying deterministic decoding rules (RFC 8949
    /// Section 4.2).
    /// Additional apply `RFC 8949 Section 4.2.3` for array entries, so it become deterministically sorted.
    ArrayDeterministic,
   ...
}
  • Apply this new decoding rules for Collaborators and DocumentRefs types

Metadata

Metadata

Assignees

No one assigned

    Labels

    squad: gatekeepersCatalyst App Backend, System Development & Integration Team

    Type

    Projects

    Status

    🔖 Ready

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions