Skip to content
This repository has been archived by the owner on Apr 19, 2022. It is now read-only.

feat: Functions required for metadata handling #8

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
7dd85e3
feat: outline parallel QR message parser with unsafe global channel
Slesarew Mar 30, 2021
bb9ba69
feat: fountain message parser and reference encoder with a simple test
Slesarew Mar 31, 2021
6d3e85f
fix: actually read later packets
Slesarew Mar 31, 2021
5147cc5
build: build for android
Slesarew Mar 31, 2021
cd77890
test: rust program to convert large data chunks into qr fountain codes
Slesarew Apr 7, 2021
c727656
feat: compress the payload by parsing as numbers
Slesarew Apr 7, 2021
0279f61
perf: optimize parameters for signer usability
Slesarew Apr 8, 2021
6426a8a
docs: lint
Slesarew Apr 8, 2021
5752418
fix: removed parallel processing attempts, so as not to hang RN runtime
Slesarew Apr 8, 2021
a5622cd
fix: a typo in native android export
Slesarew Apr 8, 2021
4deb795
fix: typo
Slesarew Apr 9, 2021
a30d00c
fix: type conversion in android export
Slesarew Apr 9, 2021
ea9f298
fix: error handling and communication string formatting
Slesarew Apr 9, 2021
d7554a1
fix: logic in decoder
Slesarew Apr 9, 2021
2f44a3c
fix: exporting function to react (index.d.ts) syntax
Slesarew Apr 9, 2021
2469b8d
test!: I have to build and push these to search for elusive bugs; thi…
Slesarew Apr 12, 2021
9a39632
test: proceed with dirty hack tests
Slesarew Apr 12, 2021
afd31ca
test: more tests
Slesarew Apr 12, 2021
faaf92c
test: end of ugly tests
Slesarew Apr 12, 2021
528ae8c
test: more tests to find elusive sigabrt
Slesarew Apr 12, 2021
2759859
fix: corrected foreign types in qr parser
Slesarew Apr 12, 2021
89372c4
test: another test of the same kind
Slesarew Apr 12, 2021
ab2ae1e
test: reverting test state
Slesarew Apr 12, 2021
8718f76
fix: add metadata sample movie usable for tests
Slesarew Apr 12, 2021
5dd1c77
fix: ios export
Slesarew Apr 12, 2021
43d2eae
feat: selectable shunk size to support smaller screens and other situ…
Slesarew Apr 13, 2021
b02f365
feat: add compatibility byte to video qr payload
Slesarew Apr 13, 2021
f1982fa
perf!: compactified transfer envelope format
Slesarew Apr 14, 2021
189519c
feat: add legacy compatibility to example qr video
Slesarew Apr 14, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ buck-out/

#rust
rust/signer/target
rust/qr-fountain-gen/target
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ After update the rust code, you need to change the following files for updating
- ios/signer.h
- ios/SubstrateSign.m
- ios/SubstrateSign.swift
- android/src/main/java/com/reactlibrary/SubstrateSignModule.java
- android/src/main/java/io/parity/substrateSign/SubstrateSignModule.java
- index.js
- index.d.ts

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,16 @@ public void substrateSecret(String suri, Promise promise) {
}
}

@ReactMethod
public void tryDecodeQrSequence(int size, int chunkSize, String data, Promise promise) {
try {
String decoded = qrparserTryDecodeQrSequence(size, chunkSize, data);
promise.resolve(decoded);
} catch (Exception e) {
rejectWithException(promise, "try to decode qr goblet", e);
}
}

private static native String ethkeyBrainwalletAddress(String seed);
private static native String ethkeyBrainwalletBIP39Address(String seed);
private static native String ethkeyBrainwalletSign(String seed, String message);
Expand All @@ -261,4 +271,5 @@ public void substrateSecret(String suri, Promise promise) {
private static native String ethkeyBrainWalletAddressWithRef(long seedRef);
private static native String ethkeySubstrateMiniSecretKey(String suri);
private static native String ethkeySubstrateMiniSecretKeyWithRef(long seedRef, String suriSuffix);
private static native String qrparserTryDecodeQrSequence(int size, int chunkSize, String data);
}
Binary file modified android/src/main/jniLibs/arm64-v8a/libsigner.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/armeabi-v7a/libsigner.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/x86/libsigner.so
Binary file not shown.
Binary file modified android/src/main/jniLibs/x86_64/libsigner.so
Binary file not shown.
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,6 @@ declare module 'react-native-substrate-sign' {
export function substrateSecret(suri: string): Promise<string>;

export function substrateSecretWithRef(dataRef: number, suriSuffix: string): Promise<string>;

export function tryDecodeQrSequence(size: number, chunk_size: number, data: string): Promise<string>;
}
1 change: 1 addition & 0 deletions ios/SubstrateSign.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,5 @@ + (BOOL)requiresMainQueueSetup
RCT_EXTERN_METHOD(brainWalletAddressWithRef:(int64_t)seedRef resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(substrateSecret:(NSString*)suri resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(substrateSecretWithRef:(int64_t*)seedRef suri_suffix:(NSString*)suri_suffix resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
RCT_EXTERN_METHOD(tryDecodeQrSequence:(NSInteger*)size chunk_size:(NSInteger*)chunk_size data:(NSString*)data resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject)
@end
14 changes: 14 additions & 0 deletions ios/SubstrateSign.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,3 +293,17 @@ class SubstrateSign: NSObject {
}
}

@objc func tryDecodeQrSequence(_ size: NSInteger, chunk_size: NSInteger, data: String, resolve: RCTPromiseResolveBlock, reject: RCTPromiseRejectBlock) -> Void {
handle_error(
resolve: resolve,
reject: reject,
get_result: { try_decode_qr_sequence($0, Int32(size), Int32(chunk_size), data) },
success: { (res: Optional<UnsafePointer<CChar>>) -> String in
let val = String(cString: res!)
signer_destroy_string(res!)
return val
})
}
}


4 changes: 4 additions & 0 deletions ios/signer.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,7 @@ const char* brain_wallet_address_with_ref(struct ExternError*, int64_t seed_ref)
const char* substrate_mini_secret_key_with_ref(struct ExternError*, int64_t seed_ref, const char* suri_suffix);

const char* substrate_mini_secret_key(struct ExternError*, const char* suri);

// qr fountain decoder
const char * try_decode_qr_sequence(struct ExternError*, int size, int chunk_size, const char* data_json);

253 changes: 253 additions & 0 deletions rust/qr-fountain-gen/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions rust/qr-fountain-gen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[package]
name = "qr-fountain-gen"
version = "0.1.0"
authors = ["Slesarev <[email protected]>"]
edition = "2018"

[dependencies]
raptorq = "1.6.3"
qrcodegen = "1.6.0"
apng-encoder = "0.3.0"
hex = "0.4.3"
num-integer = "0.1.41"

1 change: 1 addition & 0 deletions rust/qr-fountain-gen/networkMetadata.ts

Large diffs are not rendered by default.

Binary file added rust/qr-fountain-gen/out.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading