Skip to content

Commit

Permalink
Moves bat-native-confirmations into core
Browse files Browse the repository at this point in the history
* Initial commit

* Added SetTimer and OnTimer

* Added missing #include for wallet_info data structure

* Added catalog issuers data structure

* Added OnCatalogIssuersChanged

* Added OnTimer

* Changed LOG to BLOG due to conflicts with base::

* wip, builds

* build w/ all class code

* port steps 1-5

* match server regex update

* Integration for brave-core

* Temporarily use std::cout instead of BLOG due to build issues

* Resolve linking issue with IsReadyToShowAds

* Only start filling confirmations, retrieving payments and cashing in payments once initialized

* Revert "Temporarily use std::cout instead of BLOG due to build issues"

This reverts commit 7baad78.

* Refactor to use callbacks

* Improve logging to help diagnose issues

* Confirmations fails to initialize when creating a new wallet (#42)

* Improve logging to help diagnose issues (#43)

* Confirmations fails to initialize when creating a new wallet (#44)

* Ads Serve failures should retry (#45)

* Resolves initiating profile DCHECK failure (#47)

* Improve logging to help diagnose issues (#48)

* Fix unit test build errors #53 (#54)

* Changes to how unblind and BatchDLEQProof::verify are being called in challenge-bypass-ristretto-ffi

* Decouple refill tokens

* Decouple redeem token

* Decouple payout tokens

* Added Ads Serve helper

* Decouple security into security helper

* Updated static values

* Updated BUILD.gn

* Refactor ConfirmationsImpl to use decoupled logic

* Added string helper

* Remove unused HappyHTTP dependency

* Add support for _is_production flag to choose between production and staging environments

* refactor dependencies

* Decoupled unblinded tokens and url request builder for unit tests

* Resolve compiler errors and decouple logic in preparation for unit testing

* Added unit tests

* Fix build for Windows/Linux

* Fix linter errors

* Confirmations should not be initialized if the wallet is invalid

* Removed unecessary boolean logic

* Return if wallet info is not ready

* Fix build error

* Fix header files

* Fix unit tests

* Remove redundant #include for unblinded_tokens.h

* Fixed unit test #include paths

* Revert "Remove redundant #include for unblinded_tokens.h"

This reverts commit 35f055e82f0a22428c600360a75336351f34458d.

* Remove redundant #include for unblinded_tokens.h

* Fixed unit test #include paths

* Refactor new to unique_ptr for unit tests

* Remove logging for unit tests

* Resolved lint error

* Added README.md

* Fixed linter errors

* Fix Linux and Windows build errors

* Resolve logging issue with wallet info

* Add support for VLOG to help reduce noise in logs for INFO

* Added ability to retrieve transaction history

* Fixed build error and refactored ctime to use base::Time

* Redeem tokens when notifications are viewed

* Update client when transaction history changes

* Reduced maximum persisted unblinded tokens from 100 to 50

Reduced maximum persisted unblinded tokens from 100 to 50 to reduce the chance that the server fails to generate the tokens before the next request. If the server still does not generate the tokens in time we retry after 15 seconds.

* Updated Copyright in BUILD.gn

* Updated README.md

* Revert "Merge pull request #75 from brave-intl/issues/52"

This reverts commit fc7de34, reversing
changes made to 211e767.

* Fixed unit tests
  • Loading branch information
NejcZdovc authored and tmancey committed Feb 27, 2019
1 parent 1bdec2c commit 53e24fb
Show file tree
Hide file tree
Showing 57 changed files with 85,101 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/out/
/vendor/*
!/vendor/bat-native-ledger
!/vendor/bat-native-confirmations
!/vendor/CPPLINT.cfg
node_modules/
*.xcodeproj
Expand Down
9 changes: 9 additions & 0 deletions vendor/bat-native-confirmations/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
deps/challenge-bypass-ristretto-ffi
build/*
.vscode/*
.gn
.DS_Store
/target
**/*.rs.bk
Cargo.lock
.gdb_history
112 changes: 112 additions & 0 deletions vendor/bat-native-confirmations/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# Copyright (c) 2019 The Brave Authors. All rights reserved.
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import("//brave/vendor/challenge_bypass_ristretto_ffi/config.gni")

if (is_android) {
import("//build/config/android/rules.gni")
}
if (is_android || defined(is_docker)) {
dep_base = rebase_path("./", "//")
} else {
dep_base = rebase_path("../..", "//")
}

config("external_config") {
visibility = [
":*",
]
include_dirs = [ "include" ]
}

config("internal_config") {
visibility = [
":*",
"//brave/test:*",
]
include_dirs = [ "src" ]
}

source_set("bat-native-confirmations") {
public_configs = [ ":external_config" ]
configs += [ ":internal_config" ]

visibility = [
":*",
rebase_path("bat-native-ledger", dep_base) + ":*",
"//brave/test:*",
]

sources = [
"include/bat/confirmations/confirmations_client.h",
"include/bat/confirmations/export.h",
"include/bat/confirmations/notification_info.h",
"src/bat/confirmations/notification_info.cc",
"src/bat/confirmations/issuer_info.cc",
"include/bat/confirmations/issuer_info.h",
"src/bat/confirmations/issuers_info.cc",
"include/bat/confirmations/issuers_info.h",
"src/bat/confirmations/wallet_info.cc",
"include/bat/confirmations/wallet_info.h",
"src/confirmations.cc",
"include/bat/confirmations/confirmations.h",
"src/refill_tokens.cc",
"src/refill_tokens.h",
"src/request_signed_tokens_request.cc",
"src/request_signed_tokens_request.h",
"src/get_signed_tokens_request.cc",
"src/get_signed_tokens_request.h",
"src/logging.h",
"src/redeem_token.cc",
"src/redeem_token.h",
"src/create_confirmation_request.cc",
"src/create_confirmation_request.h",
"src/fetch_payment_token_request.cc",
"src/fetch_payment_token_request.h",
"src/payout_tokens.cc",
"src/payout_tokens.h",
"src/redeem_payment_tokens_request.cc",
"src/redeem_payment_tokens_request.h",
"src/unblinded_tokens.cc",
"src/unblinded_tokens.h",
"src/ads_serve_helper.cc",
"src/ads_serve_helper.h",
"src/string_helper.cc",
"src/string_helper.h",
"src/security_helper.cc",
"src/security_helper.h",
"src/confirmations_impl.cc",
"src/confirmations_impl.h",
]

public_deps = [
":challenge_bypass_libs",
]

deps = [
"//base",
"//third_party/boringssl",
"//third_party/re2",
rebase_path("bat-native-ledger:headers", dep_base),
rebase_path("bat-native-tweetnacl:tweetnacl", dep_base),
rebase_path("challenge_bypass_ristretto_ffi", dep_base),
]
}

if (is_mac) {
bundle_data("challenge_bypass_libs") {
sources = [
challenge_bypass_lib_path,
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
]
public_deps = [
rebase_path("challenge_bypass_ristretto_ffi:challenge_bypass_ristretto", dep_base),
]
}
} else {
group("challenge_bypass_libs") {}
}
Loading

0 comments on commit 53e24fb

Please sign in to comment.