by Wolf McNally and Christopher Allen
© 2020 Blockchain Commons
This framework is pure Swift 5, has no dependencies, and is available via Swift Package Manager. It contains several major components:
UREncoderandURDecoder, A codec for URs that supports single-part and multi-part transmission using fountain codes.FountainEncoderandFountainDecoder: A general codec for binary strings based on Luby Transform code.Bytewords: A codec for Bytewords.- A codec for CBOR based on SwiftCBOR, from the Public Domain.
If you are using this framework at it's highest level, the main types of interest will be UR, UREncoder, and URDecoder.
The CBOR codec is provided because the message of a compliant UR must be encoded in CBOR, and multi-part URs embed fragment data in a CBOR structure containing metadata needed by the decoder. For your own UR structures, you can use a different CBOR codec as long as the message encoded is well-formed CBOR.
The other layers may be used independently if desired.
There is also an iOS app, URDemo, that demonstrates URKit by sending and receiving long binary messages via animated QR codes containing multi-part URs.
- Swift 5, iOS 13 or macOS 10.15, and Xcode 11.5
- Build or include like any other Swift package. Unit tests are included.