mirror of
https://github.com/sparrowwallet/hummingbird.git
synced 2024-12-27 02:26:44 +00:00
v1.5 deprecate legacyurencoder and legacyurdecoder, add legacy section to readme
This commit is contained in:
parent
71300aa97d
commit
7457870964
4 changed files with 24 additions and 2 deletions
22
README.md
22
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:
|
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
|
## 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.
|
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
|
## Testing
|
||||||
|
|
||||||
Hummingbird has a thorough testsuite ported from URKit. The tests can be run with:
|
Hummingbird has a thorough testsuite ported from URKit. The tests can be run with:
|
||||||
|
|
|
@ -16,7 +16,7 @@ apply plugin: 'com.bmuschko.nexus'
|
||||||
|
|
||||||
archivesBaseName = 'hummingbird'
|
archivesBaseName = 'hummingbird'
|
||||||
group 'com.sparrowwallet'
|
group 'com.sparrowwallet'
|
||||||
version '1.4'
|
version '1.5'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.sparrowwallet.hummingbird;
|
||||||
import java.security.MessageDigest;
|
import java.security.MessageDigest;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class LegacyURDecoder {
|
public class LegacyURDecoder {
|
||||||
private final Set<String> fragments = new LinkedHashSet<>();
|
private final Set<String> fragments = new LinkedHashSet<>();
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.security.NoSuchAlgorithmException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.stream.IntStream;
|
import java.util.stream.IntStream;
|
||||||
|
|
||||||
|
@Deprecated
|
||||||
public class LegacyUREncoder {
|
public class LegacyUREncoder {
|
||||||
public static final int DEFAULT_FRAGMENT_LENGTH = 200;
|
public static final int DEFAULT_FRAGMENT_LENGTH = 200;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue