diff --git a/README.md b/README.md index c2ac21b..1e9401c 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It contains both the classes to represent a UR, and a UR encoder and decoder to Hummingbird is hosted in Maven Central and can be added as a dependency with the following: ``` -implementation('com.sparrowwallet:hummingbird:1.4') +implementation('com.sparrowwallet:hummingbird:1.5') ``` ## Usage @@ -68,6 +68,26 @@ if(urRegistryType.equals(RegistryType.CRYPTO_PSBT)) { See `RegistryType.java` for the full list of supported types and their POJO implementation classes where available. +## Legacy (UR1.0) Encoding and Decoding + +Encoding and decoding with the [UR1.0](https://github.com/CoboVault/Research/blob/master/papers/bcr-0005-ur.md) specification is supported. +Note however that these classes are deprecated and will be removed in a future release. + +```java +//decoding +LegacyURDecoder decoder = new LegacyURDecoder(); +while(!decoder.isComplete()) { + //Loop adding QR fragments to the decoder until it has a result + String qrText = getFromNextQR(); + decoder.receivePart(qrText); +} +UR ur = decoder.decode(); + +//encoding +LegacyUREncoder encoder = new LegacyUREncoder(ur); +String[] fragments = legacyUREncoder.encode(); +``` + ## Testing Hummingbird has a thorough testsuite ported from URKit. The tests can be run with: diff --git a/build.gradle b/build.gradle index d83d5e6..596733c 100644 --- a/build.gradle +++ b/build.gradle @@ -16,7 +16,7 @@ apply plugin: 'com.bmuschko.nexus' archivesBaseName = 'hummingbird' group 'com.sparrowwallet' -version '1.4' +version '1.5' repositories { mavenCentral() diff --git a/src/main/java/com/sparrowwallet/hummingbird/LegacyURDecoder.java b/src/main/java/com/sparrowwallet/hummingbird/LegacyURDecoder.java index e99bc73..0263386 100644 --- a/src/main/java/com/sparrowwallet/hummingbird/LegacyURDecoder.java +++ b/src/main/java/com/sparrowwallet/hummingbird/LegacyURDecoder.java @@ -3,6 +3,7 @@ package com.sparrowwallet.hummingbird; import java.security.MessageDigest; import java.util.*; +@Deprecated public class LegacyURDecoder { private final Set fragments = new LinkedHashSet<>(); diff --git a/src/main/java/com/sparrowwallet/hummingbird/LegacyUREncoder.java b/src/main/java/com/sparrowwallet/hummingbird/LegacyUREncoder.java index 888bcc3..77cb955 100644 --- a/src/main/java/com/sparrowwallet/hummingbird/LegacyUREncoder.java +++ b/src/main/java/com/sparrowwallet/hummingbird/LegacyUREncoder.java @@ -5,6 +5,7 @@ import java.security.NoSuchAlgorithmException; import java.util.Arrays; import java.util.stream.IntStream; +@Deprecated public class LegacyUREncoder { public static final int DEFAULT_FRAGMENT_LENGTH = 200;