v1.5 deprecate legacyurencoder and legacyurdecoder, add legacy section to readme

This commit is contained in:
Craig Raw 2020-11-16 13:38:51 +02:00
parent 71300aa97d
commit 7457870964
4 changed files with 24 additions and 2 deletions

View file

@ -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:

View file

@ -16,7 +16,7 @@ apply plugin: 'com.bmuschko.nexus'
archivesBaseName = 'hummingbird'
group 'com.sparrowwallet'
version '1.4'
version '1.5'
repositories {
mavenCentral()

View file

@ -3,6 +3,7 @@ package com.sparrowwallet.hummingbird;
import java.security.MessageDigest;
import java.util.*;
@Deprecated
public class LegacyURDecoder {
private final Set<String> fragments = new LinkedHashSet<>();

View file

@ -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;