@digitalshieldfe/react-native-backup-card-sdk 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -25
- package/android/build.gradle +49 -4
- package/android/consumer-rules.pro +0 -0
- package/android/proguard-rules.pro +21 -0
- package/android/src/main/AndroidManifest.xml +4 -1
- package/android/src/main/java/com/ziancube/backupcardsdk/BackupCardSdk.kt +478 -0
- package/android/src/main/java/com/ziancube/backupcardsdk/GPChannelNatives.java +41 -0
- package/android/src/main/java/com/ziancube/backupcardsdk/listener/ApiAsyncListener.java +13 -0
- package/android/src/main/java/com/ziancube/backupcardsdk/nfc/ApiNfc.java +173 -0
- package/android/src/main/java/com/ziancube/backupcardsdk/nfc/ImplNfc.java +39 -0
- package/android/src/main/java/com/ziancube/backupcardsdk/nfc/NfcComm.java +115 -0
- package/android/src/main/java/com/ziancube/backupcardsdk/utils/ApduParam.java +67 -0
- package/android/src/main/java/com/ziancube/backupcardsdk/utils/CommList.java +41 -0
- package/android/src/main/java/com/ziancube/backupcardsdk/utils/Utils.java +109 -0
- package/android/src/main/jni/CMakeLists.txt +60 -0
- package/android/src/main/jni/GPChannel/include/GPChannelSDK.h +306 -0
- package/android/src/main/jni/GPChannel/include/context/BaseContext.h +56 -0
- package/android/src/main/jni/GPChannel/include/device/ApduBuilder.hpp +72 -0
- package/android/src/main/jni/GPChannel/include/utility/Apdu.hpp +166 -0
- package/android/src/main/jni/GPChannel/include/utility/Debug.hpp +59 -0
- package/android/src/main/jni/GPChannel/include/utility/Singleton.h +34 -0
- package/android/src/main/jni/GPChannel/include/utility/mutex.h +24 -0
- package/android/src/main/jni/GPChannel/include/utility/trim.hpp +155 -0
- package/android/src/main/jni/GPChannel/include/utility/util.h +104 -0
- package/android/src/main/jni/GPChannel/include/utility/xFactory.hpp +26 -0
- package/android/src/main/jni/GPChannel/include/utility/xManager.hpp +84 -0
- package/android/src/main/jni/GPChannel/src/arm64-v8a/libJUB_GPC_APDU_SDK.a +0 -0
- package/android/src/main/jni/GPChannel/src/arm64-v8a/libTrezorCrypto.a +0 -0
- package/android/src/main/jni/GPChannel/src/armeabi-v7a/libJUB_GPC_APDU_SDK.a +0 -0
- package/android/src/main/jni/GPChannel/src/armeabi-v7a/libTrezorCrypto.a +0 -0
- package/android/src/main/jni/GPChannel/src/x86/libJUB_GPC_APDU_SDK.a +0 -0
- package/android/src/main/jni/GPChannel/src/x86/libTrezorCrypto.a +0 -0
- package/android/src/main/jni/src/implJni.cpp +313 -0
- package/android/src/main/jni/src/implJni.h +9 -0
- package/android/src/main/jni/utils/jsoncpp/AUTHORS +111 -0
- package/android/src/main/jni/utils/jsoncpp/CMakeLists.txt +159 -0
- package/android/src/main/jni/utils/jsoncpp/LICENSE +55 -0
- package/android/src/main/jni/utils/jsoncpp/README.md +135 -0
- package/android/src/main/jni/utils/jsoncpp/amalgamate.py +155 -0
- package/android/src/main/jni/utils/jsoncpp/appveyor.yml +22 -0
- package/android/src/main/jni/utils/jsoncpp/dev.makefile +35 -0
- package/android/src/main/jni/utils/jsoncpp/devtools/__init__.py +6 -0
- package/android/src/main/jni/utils/jsoncpp/devtools/agent_vmw7.json +33 -0
- package/android/src/main/jni/utils/jsoncpp/devtools/agent_vmxp.json +26 -0
- package/android/src/main/jni/utils/jsoncpp/devtools/antglob.py +205 -0
- package/android/src/main/jni/utils/jsoncpp/devtools/batchbuild.py +278 -0
- package/android/src/main/jni/utils/jsoncpp/devtools/fixeol.py +70 -0
- package/android/src/main/jni/utils/jsoncpp/devtools/licenseupdater.py +94 -0
- package/android/src/main/jni/utils/jsoncpp/devtools/tarball.py +52 -0
- package/android/src/main/jni/utils/jsoncpp/doxybuild.py +189 -0
- package/android/src/main/jni/utils/jsoncpp/include/CMakeLists.txt +2 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/allocator.h +98 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/assertions.h +54 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/autolink.h +25 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/config.h +187 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/features.h +61 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/forwards.h +37 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/json.h +15 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/reader.h +411 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/value.h +888 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/version.h +20 -0
- package/android/src/main/jni/utils/jsoncpp/include/json/writer.h +357 -0
- package/android/src/main/jni/utils/jsoncpp/makefiles/vs71/jsontest.vcproj +119 -0
- package/android/src/main/jni/utils/jsoncpp/makefiles/vs71/lib_json.vcproj +205 -0
- package/android/src/main/jni/utils/jsoncpp/makefiles/vs71/test_lib_json.vcproj +130 -0
- package/android/src/main/jni/utils/jsoncpp/makerelease.py +390 -0
- package/android/src/main/jni/utils/jsoncpp/meson.build +103 -0
- package/android/src/main/jni/utils/jsoncpp/pkg-config/jsoncpp.pc.in +9 -0
- package/android/src/main/jni/utils/jsoncpp/src/CMakeLists.txt +5 -0
- package/android/src/main/jni/utils/jsoncpp/src/jsontestrunner/CMakeLists.txt +25 -0
- package/android/src/main/jni/utils/jsoncpp/src/jsontestrunner/main.cpp +333 -0
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/CMakeLists.txt +117 -0
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_reader.cpp +2060 -0
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_tool.h +114 -0
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_value.cpp +1661 -0
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_valueiterator.inl +167 -0
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/json_writer.cpp +1233 -0
- package/android/src/main/jni/utils/jsoncpp/src/lib_json/version.h.in +20 -0
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/CMakeLists.txt +38 -0
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/jsontest.cpp +457 -0
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/jsontest.h +286 -0
- package/android/src/main/jni/utils/jsoncpp/src/test_lib_json/main.cpp +2606 -0
- package/android/src/main/jni/utils/jsoncpp/travis.sh +23 -0
- package/android/src/main/jni/utils/jsoncpp/version +1 -0
- package/android/src/main/jni/utils/jsoncpp/version.in +1 -0
- package/android/src/main/jni/utils/logUtils.cpp +108 -0
- package/android/src/main/jni/utils/logUtils.h +87 -0
- package/android/src/main/jni/utils/mSIGNA/stdutils/uchar_vector.h +614 -0
- package/package.json +2 -3
- package/android/libs/backupcardsdk-1.0.0.aar +0 -0
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
|
2
|
+
// Distributed under MIT license, or public domain if desired and
|
|
3
|
+
// recognized in your jurisdiction.
|
|
4
|
+
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
|
5
|
+
|
|
6
|
+
#ifndef JSONTEST_H_INCLUDED
|
|
7
|
+
#define JSONTEST_H_INCLUDED
|
|
8
|
+
|
|
9
|
+
#include <json/config.h>
|
|
10
|
+
#include <json/value.h>
|
|
11
|
+
#include <json/writer.h>
|
|
12
|
+
#include <stdio.h>
|
|
13
|
+
#include <deque>
|
|
14
|
+
#include <sstream>
|
|
15
|
+
#include <string>
|
|
16
|
+
|
|
17
|
+
// //////////////////////////////////////////////////////////////////
|
|
18
|
+
// //////////////////////////////////////////////////////////////////
|
|
19
|
+
// Mini Unit Testing framework
|
|
20
|
+
// //////////////////////////////////////////////////////////////////
|
|
21
|
+
// //////////////////////////////////////////////////////////////////
|
|
22
|
+
|
|
23
|
+
/** \brief Unit testing framework.
|
|
24
|
+
* \warning: all assertions are non-aborting, test case execution will continue
|
|
25
|
+
* even if an assertion namespace.
|
|
26
|
+
* This constraint is for portability: the framework needs to compile
|
|
27
|
+
* on Visual Studio 6 and must not require exception usage.
|
|
28
|
+
*/
|
|
29
|
+
namespace JsonTest {
|
|
30
|
+
|
|
31
|
+
class Failure {
|
|
32
|
+
public:
|
|
33
|
+
const char* file_;
|
|
34
|
+
unsigned int line_;
|
|
35
|
+
JSONCPP_STRING expr_;
|
|
36
|
+
JSONCPP_STRING message_;
|
|
37
|
+
unsigned int nestingLevel_;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/// Context used to create the assertion callstack on failure.
|
|
41
|
+
/// Must be a POD to allow inline initialisation without stepping
|
|
42
|
+
/// into the debugger.
|
|
43
|
+
struct PredicateContext {
|
|
44
|
+
typedef unsigned int Id;
|
|
45
|
+
Id id_;
|
|
46
|
+
const char* file_;
|
|
47
|
+
unsigned int line_;
|
|
48
|
+
const char* expr_;
|
|
49
|
+
PredicateContext* next_;
|
|
50
|
+
/// Related Failure, set when the PredicateContext is converted
|
|
51
|
+
/// into a Failure.
|
|
52
|
+
Failure* failure_;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
class TestResult {
|
|
56
|
+
public:
|
|
57
|
+
TestResult();
|
|
58
|
+
|
|
59
|
+
/// \internal Implementation detail for assertion macros
|
|
60
|
+
/// Not encapsulated to prevent step into when debugging failed assertions
|
|
61
|
+
/// Incremented by one on assertion predicate entry, decreased by one
|
|
62
|
+
/// by addPredicateContext().
|
|
63
|
+
PredicateContext::Id predicateId_;
|
|
64
|
+
|
|
65
|
+
/// \internal Implementation detail for predicate macros
|
|
66
|
+
PredicateContext* predicateStackTail_;
|
|
67
|
+
|
|
68
|
+
void setTestName(const JSONCPP_STRING& name);
|
|
69
|
+
|
|
70
|
+
/// Adds an assertion failure.
|
|
71
|
+
TestResult&
|
|
72
|
+
addFailure(const char* file, unsigned int line, const char* expr = 0);
|
|
73
|
+
|
|
74
|
+
/// Removes the last PredicateContext added to the predicate stack
|
|
75
|
+
/// chained list.
|
|
76
|
+
/// Next messages will be targed at the PredicateContext that was removed.
|
|
77
|
+
TestResult& popPredicateContext();
|
|
78
|
+
|
|
79
|
+
bool failed() const;
|
|
80
|
+
|
|
81
|
+
void printFailure(bool printTestName) const;
|
|
82
|
+
|
|
83
|
+
// Generic operator that will work with anything ostream can deal with.
|
|
84
|
+
template <typename T> TestResult& operator<<(const T& value) {
|
|
85
|
+
JSONCPP_OSTRINGSTREAM oss;
|
|
86
|
+
oss.precision(16);
|
|
87
|
+
oss.setf(std::ios_base::floatfield);
|
|
88
|
+
oss << value;
|
|
89
|
+
return addToLastFailure(oss.str());
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Specialized versions.
|
|
93
|
+
TestResult& operator<<(bool value);
|
|
94
|
+
// std:ostream does not support 64bits integers on all STL implementation
|
|
95
|
+
TestResult& operator<<(Json::Int64 value);
|
|
96
|
+
TestResult& operator<<(Json::UInt64 value);
|
|
97
|
+
|
|
98
|
+
private:
|
|
99
|
+
TestResult& addToLastFailure(const JSONCPP_STRING& message);
|
|
100
|
+
unsigned int getAssertionNestingLevel() const;
|
|
101
|
+
/// Adds a failure or a predicate context
|
|
102
|
+
void addFailureInfo(const char* file,
|
|
103
|
+
unsigned int line,
|
|
104
|
+
const char* expr,
|
|
105
|
+
unsigned int nestingLevel);
|
|
106
|
+
static JSONCPP_STRING indentText(const JSONCPP_STRING& text,
|
|
107
|
+
const JSONCPP_STRING& indent);
|
|
108
|
+
|
|
109
|
+
typedef std::deque<Failure> Failures;
|
|
110
|
+
Failures failures_;
|
|
111
|
+
JSONCPP_STRING name_;
|
|
112
|
+
PredicateContext rootPredicateNode_;
|
|
113
|
+
PredicateContext::Id lastUsedPredicateId_;
|
|
114
|
+
/// Failure which is the target of the messages added using operator <<
|
|
115
|
+
Failure* messageTarget_;
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
class TestCase {
|
|
119
|
+
public:
|
|
120
|
+
TestCase();
|
|
121
|
+
|
|
122
|
+
virtual ~TestCase();
|
|
123
|
+
|
|
124
|
+
void run(TestResult& result);
|
|
125
|
+
|
|
126
|
+
virtual const char* testName() const = 0;
|
|
127
|
+
|
|
128
|
+
protected:
|
|
129
|
+
TestResult* result_;
|
|
130
|
+
|
|
131
|
+
private:
|
|
132
|
+
virtual void runTestCase() = 0;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
/// Function pointer type for TestCase factory
|
|
136
|
+
typedef TestCase* (*TestCaseFactory)();
|
|
137
|
+
|
|
138
|
+
class Runner {
|
|
139
|
+
public:
|
|
140
|
+
Runner();
|
|
141
|
+
|
|
142
|
+
/// Adds a test to the suite
|
|
143
|
+
Runner& add(TestCaseFactory factory);
|
|
144
|
+
|
|
145
|
+
/// Runs test as specified on the command-line
|
|
146
|
+
/// If no command-line arguments are provided, run all tests.
|
|
147
|
+
/// If --list-tests is provided, then print the list of all test cases
|
|
148
|
+
/// If --test <testname> is provided, then run test testname.
|
|
149
|
+
int runCommandLine(int argc, const char* argv[]) const;
|
|
150
|
+
|
|
151
|
+
/// Runs all the test cases
|
|
152
|
+
bool runAllTest(bool printSummary) const;
|
|
153
|
+
|
|
154
|
+
/// Returns the number of test case in the suite
|
|
155
|
+
unsigned int testCount() const;
|
|
156
|
+
|
|
157
|
+
/// Returns the name of the test case at the specified index
|
|
158
|
+
JSONCPP_STRING testNameAt(unsigned int index) const;
|
|
159
|
+
|
|
160
|
+
/// Runs the test case at the specified index using the specified TestResult
|
|
161
|
+
void runTestAt(unsigned int index, TestResult& result) const;
|
|
162
|
+
|
|
163
|
+
static void printUsage(const char* appName);
|
|
164
|
+
|
|
165
|
+
private: // prevents copy construction and assignment
|
|
166
|
+
Runner(const Runner& other);
|
|
167
|
+
Runner& operator=(const Runner& other);
|
|
168
|
+
|
|
169
|
+
private:
|
|
170
|
+
void listTests() const;
|
|
171
|
+
bool testIndex(const JSONCPP_STRING& testName, unsigned int& index) const;
|
|
172
|
+
static void preventDialogOnCrash();
|
|
173
|
+
|
|
174
|
+
private:
|
|
175
|
+
typedef std::deque<TestCaseFactory> Factories;
|
|
176
|
+
Factories tests_;
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
template <typename T, typename U>
|
|
180
|
+
TestResult& checkEqual(TestResult& result,
|
|
181
|
+
T expected,
|
|
182
|
+
U actual,
|
|
183
|
+
const char* file,
|
|
184
|
+
unsigned int line,
|
|
185
|
+
const char* expr) {
|
|
186
|
+
if (static_cast<U>(expected) != actual) {
|
|
187
|
+
result.addFailure(file, line, expr);
|
|
188
|
+
result << "Expected: " << static_cast<U>(expected) << "\n";
|
|
189
|
+
result << "Actual : " << actual;
|
|
190
|
+
}
|
|
191
|
+
return result;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
JSONCPP_STRING ToJsonString(const char* toConvert);
|
|
195
|
+
JSONCPP_STRING ToJsonString(JSONCPP_STRING in);
|
|
196
|
+
#if JSONCPP_USING_SECURE_MEMORY
|
|
197
|
+
JSONCPP_STRING ToJsonString(std::string in);
|
|
198
|
+
#endif
|
|
199
|
+
|
|
200
|
+
TestResult& checkStringEqual(TestResult& result,
|
|
201
|
+
const JSONCPP_STRING& expected,
|
|
202
|
+
const JSONCPP_STRING& actual,
|
|
203
|
+
const char* file,
|
|
204
|
+
unsigned int line,
|
|
205
|
+
const char* expr);
|
|
206
|
+
|
|
207
|
+
} // namespace JsonTest
|
|
208
|
+
|
|
209
|
+
/// \brief Asserts that the given expression is true.
|
|
210
|
+
/// JSONTEST_ASSERT( x == y ) << "x=" << x << ", y=" << y;
|
|
211
|
+
/// JSONTEST_ASSERT( x == y );
|
|
212
|
+
#define JSONTEST_ASSERT(expr) \
|
|
213
|
+
if (expr) { \
|
|
214
|
+
} else \
|
|
215
|
+
result_->addFailure(__FILE__, __LINE__, #expr)
|
|
216
|
+
|
|
217
|
+
/// \brief Asserts that the given predicate is true.
|
|
218
|
+
/// The predicate may do other assertions and be a member function of the
|
|
219
|
+
/// fixture.
|
|
220
|
+
#define JSONTEST_ASSERT_PRED(expr) \
|
|
221
|
+
{ \
|
|
222
|
+
JsonTest::PredicateContext _minitest_Context = { \
|
|
223
|
+
result_->predicateId_, __FILE__, __LINE__, #expr, NULL, NULL \
|
|
224
|
+
}; \
|
|
225
|
+
result_->predicateStackTail_->next_ = &_minitest_Context; \
|
|
226
|
+
result_->predicateId_ += 1; \
|
|
227
|
+
result_->predicateStackTail_ = &_minitest_Context; \
|
|
228
|
+
(expr); \
|
|
229
|
+
result_->popPredicateContext(); \
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/// \brief Asserts that two values are equals.
|
|
233
|
+
#define JSONTEST_ASSERT_EQUAL(expected, actual) \
|
|
234
|
+
JsonTest::checkEqual(*result_, \
|
|
235
|
+
expected, \
|
|
236
|
+
actual, \
|
|
237
|
+
__FILE__, \
|
|
238
|
+
__LINE__, \
|
|
239
|
+
#expected " == " #actual)
|
|
240
|
+
|
|
241
|
+
/// \brief Asserts that two values are equals.
|
|
242
|
+
#define JSONTEST_ASSERT_STRING_EQUAL(expected, actual) \
|
|
243
|
+
JsonTest::checkStringEqual(*result_, \
|
|
244
|
+
JsonTest::ToJsonString(expected), \
|
|
245
|
+
JsonTest::ToJsonString(actual), \
|
|
246
|
+
__FILE__, \
|
|
247
|
+
__LINE__, \
|
|
248
|
+
#expected " == " #actual)
|
|
249
|
+
|
|
250
|
+
/// \brief Asserts that a given expression throws an exception
|
|
251
|
+
#define JSONTEST_ASSERT_THROWS(expr) \
|
|
252
|
+
{ \
|
|
253
|
+
bool _threw = false; \
|
|
254
|
+
try { \
|
|
255
|
+
expr; \
|
|
256
|
+
} \
|
|
257
|
+
catch (...) { \
|
|
258
|
+
_threw = true; \
|
|
259
|
+
} \
|
|
260
|
+
if (!_threw) \
|
|
261
|
+
result_->addFailure( \
|
|
262
|
+
__FILE__, __LINE__, "expected exception thrown: " #expr); \
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/// \brief Begin a fixture test case.
|
|
266
|
+
#define JSONTEST_FIXTURE(FixtureType, name) \
|
|
267
|
+
class Test##FixtureType##name : public FixtureType { \
|
|
268
|
+
public: \
|
|
269
|
+
static JsonTest::TestCase* factory() { \
|
|
270
|
+
return new Test##FixtureType##name(); \
|
|
271
|
+
} \
|
|
272
|
+
\
|
|
273
|
+
public: /* overidden from TestCase */ \
|
|
274
|
+
const char* testName() const JSONCPP_OVERRIDE { return #FixtureType "/" #name; } \
|
|
275
|
+
void runTestCase() JSONCPP_OVERRIDE; \
|
|
276
|
+
}; \
|
|
277
|
+
\
|
|
278
|
+
void Test##FixtureType##name::runTestCase()
|
|
279
|
+
|
|
280
|
+
#define JSONTEST_FIXTURE_FACTORY(FixtureType, name) \
|
|
281
|
+
&Test##FixtureType##name::factory
|
|
282
|
+
|
|
283
|
+
#define JSONTEST_REGISTER_FIXTURE(runner, FixtureType, name) \
|
|
284
|
+
(runner).add(JSONTEST_FIXTURE_FACTORY(FixtureType, name))
|
|
285
|
+
|
|
286
|
+
#endif // ifndef JSONTEST_H_INCLUDED
|