Big bang
This commit is contained in:
commit
687e6939d9
73
.gitignore
vendored
Normal file
73
.gitignore
vendored
Normal file
@ -0,0 +1,73 @@
|
||||
# Xcode
|
||||
#
|
||||
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
|
||||
|
||||
## User settings
|
||||
xcuserdata/
|
||||
|
||||
## Obj-C/Swift specific
|
||||
*.hmap
|
||||
|
||||
## App packaging
|
||||
*.ipa
|
||||
*.dSYM.zip
|
||||
*.dSYM
|
||||
|
||||
## Playgrounds
|
||||
timeline.xctimeline
|
||||
playground.xcworkspace
|
||||
|
||||
# Swift Package Manager
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
|
||||
# Packages/
|
||||
# Package.pins
|
||||
# Package.resolved
|
||||
# *.xcodeproj
|
||||
#
|
||||
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
|
||||
# hence it is not needed unless you have added a package configuration file to your project
|
||||
# .swiftpm
|
||||
|
||||
.build/
|
||||
|
||||
# CocoaPods
|
||||
#
|
||||
# We recommend against adding the Pods directory to your .gitignore. However
|
||||
# you should judge for yourself, the pros and cons are mentioned at:
|
||||
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
||||
#
|
||||
# Pods/
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from the Xcode workspace
|
||||
# *.xcworkspace
|
||||
|
||||
# Carthage
|
||||
#
|
||||
# Add this line if you want to avoid checking in source code from Carthage dependencies.
|
||||
# Carthage/Checkouts
|
||||
|
||||
Carthage/Build/
|
||||
|
||||
# Accio dependency management
|
||||
Dependencies/
|
||||
.accio/
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo.
|
||||
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://docs.fastlane.tools/best-practices/source-control/#source-control
|
||||
|
||||
fastlane/report.xml
|
||||
fastlane/Preview.html
|
||||
fastlane/screenshots/**/*.png
|
||||
fastlane/test_output
|
||||
|
||||
# Code Injection
|
||||
#
|
||||
# After new code Injection tools there's a generated folder /iOSInjectionProject
|
||||
# https://github.com/johnno1962/injectionforxcode
|
||||
|
||||
iOSInjectionProject/
|
||||
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "Vendor/fog"]
|
||||
path = Vendor/fog
|
||||
url = https://github.com/mobilecoinfoundation/fog.git
|
||||
243
Artifacts/include/attest.h
Normal file
243
Artifacts/include/attest.h
Normal file
@ -0,0 +1,243 @@
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
#ifndef ATTEST_H_
|
||||
#define ATTEST_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* ==================== Attestation ==================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ==== Types ==== */
|
||||
|
||||
/// A `VerifyIasReportData` implementation that will check if the enclave in
|
||||
/// question has the given MrEnclave, and has no other IAS report status issues.
|
||||
typedef struct _McMrEnclaveVerifier McMrEnclaveVerifier;
|
||||
|
||||
/// A `VerifyIasReportData` implementation that will check if the enclave in
|
||||
/// question has the given MrSigner value, and has no other IAS report status
|
||||
/// issues.
|
||||
typedef struct _McMrSignerVerifier McMrSignerVerifier;
|
||||
|
||||
/// A builder structure used to construct a report verifier based on the
|
||||
/// criteria specified.
|
||||
typedef struct _McVerifier McVerifier;
|
||||
|
||||
typedef struct _McAttestAke McAttestAke;
|
||||
|
||||
/* ==== McMrEnclaveVerifier ==== */
|
||||
|
||||
/// Create a new status verifier that will check for the existence of the
|
||||
/// given MrEnclave.
|
||||
///
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `mr_enclave` - must be 32 bytes in length.
|
||||
McMrEnclaveVerifier* MC_NULLABLE mc_mr_enclave_verifier_create(
|
||||
const McBuffer* MC_NONNULL mr_enclave
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
void mc_mr_enclave_verifier_free(
|
||||
McMrEnclaveVerifier* MC_NULLABLE mr_enclave_verifier
|
||||
);
|
||||
|
||||
/// Assume an enclave with the specified measurement does not need
|
||||
/// BIOS configuration changes to address the provided advisory ID.
|
||||
///
|
||||
/// This method should only be used when advised by an enclave author.
|
||||
///
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `advisory_id` - must be a nul-terminated C string containing valid UTF-8.
|
||||
bool mc_mr_enclave_verifier_allow_config_advisory(
|
||||
McMrEnclaveVerifier* MC_NONNULL mr_enclave_verifier,
|
||||
const char* MC_NONNULL advisory_id
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/// Assume the given MrEnclave value has the appropriate software/build-time
|
||||
/// hardening for the given advisory ID.
|
||||
///
|
||||
/// This method should only be used when advised by an enclave author.
|
||||
///
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `advisory_id` - must be a nul-terminated C string containing valid UTF-8.
|
||||
bool mc_mr_enclave_verifier_allow_hardening_advisory(
|
||||
McMrEnclaveVerifier* MC_NONNULL mr_enclave_verifier,
|
||||
const char* MC_NONNULL advisory_id
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/* ==== McMrSignerVerifier ==== */
|
||||
|
||||
/// Create a new status verifier that will check for the existence of the
|
||||
/// given MrSigner.
|
||||
///
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `mr_signer` - must be 32 bytes in length.
|
||||
McMrSignerVerifier* MC_NULLABLE mc_mr_signer_verifier_create(
|
||||
const McBuffer* MC_NONNULL mr_signer,
|
||||
uint16_t expected_product_id,
|
||||
uint16_t minimum_security_version
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
void mc_mr_signer_verifier_free(
|
||||
McMrSignerVerifier* MC_NULLABLE mr_signer_verifier
|
||||
);
|
||||
|
||||
/// Assume an enclave with the specified measurement does not need
|
||||
/// BIOS configuration changes to address the provided advisory ID.
|
||||
///
|
||||
/// This method should only be used when advised by an enclave author.
|
||||
///
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `advisory_id` - must be a nul-terminated C string containing valid UTF-8.
|
||||
bool mc_mr_signer_verifier_allow_config_advisory(
|
||||
McMrSignerVerifier* MC_NONNULL mr_signer_verifier,
|
||||
const char* MC_NONNULL advisory_id
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/// Assume an enclave with the specified measurement has the appropriate
|
||||
/// software/build-time hardening for the given advisory ID.
|
||||
///
|
||||
/// This method should only be used when advised by an enclave author.
|
||||
///
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `advisory_id` - must be a nul-terminated C string containing valid UTF-8.
|
||||
bool mc_mr_signer_verifier_allow_hardening_advisory(
|
||||
McMrSignerVerifier* MC_NONNULL mr_signer_verifier,
|
||||
const char* MC_NONNULL advisory_id
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/* ==== McVerifier ==== */
|
||||
|
||||
/// Construct a new builder using the baked-in IAS root certificates and debug
|
||||
/// settings.
|
||||
McVerifier* MC_NULLABLE mc_verifier_create();
|
||||
|
||||
void mc_verifier_free(
|
||||
McVerifier* MC_NULLABLE verifier
|
||||
);
|
||||
|
||||
/// Verify the given MrEnclave-based status verifier succeeds
|
||||
bool mc_verifier_add_mr_enclave(
|
||||
McVerifier* MC_NONNULL verifier,
|
||||
const McMrEnclaveVerifier* MC_NONNULL mr_enclave_verifier
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/// Verify the given MrSigner-based status verifier succeeds
|
||||
bool mc_verifier_add_mr_signer(
|
||||
McVerifier* MC_NONNULL verifier,
|
||||
const McMrSignerVerifier* MC_NONNULL mr_signer_verifier
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/* ==== McAttestAke ==== */
|
||||
|
||||
McAttestAke* MC_NULLABLE mc_attest_ake_create();
|
||||
|
||||
void mc_attest_ake_free(
|
||||
McAttestAke* MC_NULLABLE attest_ake
|
||||
);
|
||||
|
||||
bool mc_attest_ake_is_attested(
|
||||
const McAttestAke* MC_NONNULL attest_ake,
|
||||
bool* MC_NONNULL out_attested
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `attest_ake` - must be in the attested state.
|
||||
/// * `out_binding` - must be null or else length must be >= `binding.len`.
|
||||
ssize_t mc_attest_ake_get_binding(
|
||||
const McAttestAke* MC_NONNULL attest_ake,
|
||||
McMutableBuffer* MC_NULLABLE out_binding
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/* ==== Auth ==== */
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `responder_id` - must be a nul-terminated C string containing a valid responder ID.
|
||||
/// * `out_auth_request` - must be null or else length must be >= auth_request_output.len.
|
||||
ssize_t mc_attest_ake_get_auth_request(
|
||||
McAttestAke* MC_NONNULL attest_ake,
|
||||
const char* MC_NONNULL responder_id,
|
||||
McRngCallback* MC_NULLABLE rng_callback,
|
||||
McMutableBuffer* MC_NULLABLE out_auth_request
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `attest_ake` - must be in the auth pending state.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::AttestationVerificationFailed`
|
||||
/// * `LibMcError::InvalidInput`
|
||||
bool mc_attest_ake_process_auth_response(
|
||||
McAttestAke* MC_NONNULL attest_ake,
|
||||
const McBuffer* MC_NONNULL auth_response_data,
|
||||
const McVerifier* MC_NONNULL verifier,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3);
|
||||
|
||||
/* ==== Message Encryption ==== */
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `attest_ake` - must be in the attested state.
|
||||
/// * `out_ciphertext` - must be null or else length must be >= `ciphertext.len`.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::Aead`
|
||||
/// * `LibMcError::Cipher`
|
||||
ssize_t mc_attest_ake_encrypt(
|
||||
McAttestAke* MC_NONNULL attest_ake,
|
||||
const McBuffer* MC_NONNULL aad,
|
||||
const McBuffer* MC_NONNULL plaintext,
|
||||
McMutableBuffer* MC_NULLABLE out_ciphertext,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `attest_ake` - must be in the attested state.
|
||||
/// * `out_plaintext` - length must be >= `ciphertext.len`.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::Aead`
|
||||
/// * `LibMcError::Cipher`
|
||||
ssize_t mc_attest_ake_decrypt(
|
||||
McAttestAke* MC_NONNULL attest_ake,
|
||||
const McBuffer* MC_NONNULL aad,
|
||||
const McBuffer* MC_NONNULL ciphertext,
|
||||
McMutableBuffer* MC_NONNULL out_plaintext,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3, 4);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !ATTEST_H_ */
|
||||
67
Artifacts/include/bip39.h
Normal file
67
Artifacts/include/bip39.h
Normal file
@ -0,0 +1,67 @@
|
||||
#ifndef BIP39_H_
|
||||
#define BIP39_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* ==================== BIP39 ==================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ==== McBip39 ==== */
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `mnemonic` - must be a nul-terminated C string containing valid UTF-8.
|
||||
/// * `out_entropy` - must be null or else length must be >= `entropy.len`.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
ssize_t mc_bip39_entropy_from_mnemonic(
|
||||
const char* MC_NONNULL mnemonic,
|
||||
McMutableBuffer* MC_NULLABLE out_entropy,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `entropy` - length must be a multiple of 4 and between 16 and 32, inclusive.
|
||||
char* MC_NULLABLE mc_bip39_entropy_to_mnemonic(
|
||||
const McBuffer* MC_NONNULL entropy
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `mnemonic` - must be a nul-terminated C string containing valid UTF-8.
|
||||
/// * `passphrase` - must be a nul-terminated C string containing valid UTF-8. Can be empty.
|
||||
/// * `out_seed` - length must be >= 64.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
bool mc_bip39_get_seed(
|
||||
const char* MC_NONNULL mnemonic,
|
||||
const char* MC_NONNULL passphrase,
|
||||
McMutableBuffer* MC_NONNULL out_seed,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `prefix` - must be a nul-terminated C string containing valid UTF-8.
|
||||
char* MC_NULLABLE mc_bip39_words_by_prefix(
|
||||
const char* MC_NONNULL prefix
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !BIP39_H_ */
|
||||
110
Artifacts/include/common.h
Normal file
110
Artifacts/include/common.h
Normal file
@ -0,0 +1,110 @@
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
#ifndef COMMON_H_
|
||||
#define COMMON_H_
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
// Compatibility with non-clang compilers.
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) 0
|
||||
#endif
|
||||
|
||||
#if __has_attribute(nonnull)
|
||||
# define MC_ATTRIBUTE_NONNULL(...) __attribute__((nonnull(__VA_ARGS__)))
|
||||
#else
|
||||
# define MC_ATTRIBUTE_NONNULL(...)
|
||||
#endif
|
||||
|
||||
#ifdef __llvm__
|
||||
# define MC_NONNULL _Nonnull
|
||||
# define MC_NULLABLE _Nullable
|
||||
#else
|
||||
# define MC_NONNULL
|
||||
# define MC_NULLABLE
|
||||
#endif
|
||||
|
||||
#if __has_attribute(enum_extensibility)
|
||||
# define MC_ATTRIBUTE_ENUM_CLOSED __attribute__((enum_extensibility(closed)))
|
||||
#else
|
||||
# define MC_ATTRIBUTE_ENUM_CLOSED
|
||||
#endif
|
||||
|
||||
/* ==================== Common ==================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ==== Error Codes ==== */
|
||||
|
||||
typedef enum MC_ATTRIBUTE_ENUM_CLOSED {
|
||||
McErrorCodeUnknown = -1,
|
||||
McErrorCodePanic = -2,
|
||||
|
||||
McErrorCodeInvalidInput = 100,
|
||||
McErrorCodeInvalidOutput = 101,
|
||||
|
||||
McErrorCodeAttestationVerificationFailed = 200,
|
||||
|
||||
McErrorCodeAead = 300,
|
||||
McErrorCodeCipher = 301,
|
||||
McErrorCodeUnsupportedCryptoBoxVersion = 302,
|
||||
|
||||
McErrorCodeTransactionCrypto = 400,
|
||||
} McErrorCode;
|
||||
|
||||
/* ==== McError ==== */
|
||||
|
||||
typedef struct {
|
||||
int error_code;
|
||||
const char* MC_NONNULL error_description;
|
||||
} McError;
|
||||
|
||||
void mc_error_free(McError* MC_NULLABLE error);
|
||||
|
||||
/* ==== McString ==== */
|
||||
|
||||
void mc_string_free(char* MC_NULLABLE string);
|
||||
|
||||
/* ==== McBuffer ==== */
|
||||
|
||||
typedef struct {
|
||||
const uint8_t* MC_NONNULL buffer;
|
||||
size_t len;
|
||||
} McBuffer;
|
||||
|
||||
typedef struct {
|
||||
uint8_t* MC_NONNULL buffer;
|
||||
size_t len;
|
||||
} McMutableBuffer;
|
||||
|
||||
/* ==== McData ==== */
|
||||
|
||||
typedef struct _McData McData;
|
||||
|
||||
void mc_data_free(McData* MC_NULLABLE data);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `out_bytes` - must be null or else length must be >= `data.len`.
|
||||
ssize_t mc_data_get_bytes(
|
||||
const McData* MC_NONNULL data,
|
||||
McMutableBuffer* MC_NULLABLE out_bytes
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/* ==== McRngCallback ==== */
|
||||
|
||||
typedef struct {
|
||||
uint64_t (* MC_NONNULL rng)(void* MC_NULLABLE);
|
||||
void* MC_NULLABLE context;
|
||||
} McRngCallback;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !COMMON_H_ */
|
||||
79
Artifacts/include/crypto.h
Normal file
79
Artifacts/include/crypto.h
Normal file
@ -0,0 +1,79 @@
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
#ifndef CRYPTO_H_
|
||||
#define CRYPTO_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* ==================== Crypto ==================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ==== Ristretto ==== */
|
||||
|
||||
bool mc_ristretto_private_validate(
|
||||
const McBuffer* MC_NONNULL ristretto_private,
|
||||
bool* MC_NONNULL out_valid
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `ristretto_private` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `out_ristretto_public` - length must be >= 32.
|
||||
bool mc_ristretto_public_from_ristretto_private(
|
||||
const McBuffer* MC_NONNULL ristretto_private,
|
||||
McMutableBuffer* MC_NONNULL out_ristretto_public
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
bool mc_ristretto_public_validate(
|
||||
const McBuffer* MC_NONNULL ristretto_public,
|
||||
bool* MC_NONNULL out_valid
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/* ==== VersionedCryptoBox ==== */
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `public_key` - must be a valid 32-byte compressed Ristretto point.
|
||||
/// * `out_ciphertext` - must be null or else length must be >= `ciphertext.len`.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::Aead`
|
||||
ssize_t mc_versioned_crypto_box_encrypt(
|
||||
const McBuffer* MC_NONNULL public_key,
|
||||
const McBuffer* MC_NONNULL plaintext,
|
||||
McRngCallback* MC_NULLABLE rng_callback,
|
||||
McMutableBuffer* MC_NULLABLE out_ciphertext,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `out_plaintext` - length must be >= `ciphertext.len`.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::Aead`
|
||||
/// * `LibMcError::InvalidInput`
|
||||
/// * `LibMcError::UnsupportedCryptoBoxVersion`
|
||||
ssize_t mc_versioned_crypto_box_decrypt(
|
||||
const McBuffer* MC_NONNULL private_key,
|
||||
const McBuffer* MC_NONNULL ciphertext,
|
||||
McMutableBuffer* MC_NONNULL out_plaintext,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !CRYPTO_H_ */
|
||||
45
Artifacts/include/encodings.h
Normal file
45
Artifacts/include/encodings.h
Normal file
@ -0,0 +1,45 @@
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
#ifndef ENCODINGS_H_
|
||||
#define ENCODINGS_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* ==================== Encodings ==================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ==== PrintableWrapper ==== */
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `printable_wrapper_proto_bytes` - must be a valid binary-serialized `printable.PrintableWrapper`
|
||||
/// Protobuf.
|
||||
char* MC_NULLABLE mc_printable_wrapper_b58_encode(
|
||||
const McBuffer* MC_NONNULL printable_wrapper_proto_bytes
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `b58_encoded_string` - must be a nul-terminated C string containing valid UTF-8.
|
||||
/// * `out_printable_wrapper_proto_bytes` - must be null or else length must be >=
|
||||
/// `wrapper_bytes.len`.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
ssize_t mc_printable_wrapper_b58_decode(
|
||||
const char* MC_NONNULL b58_encoded_string,
|
||||
McMutableBuffer* MC_NULLABLE out_printable_wrapper_proto_bytes,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !ENCODINGS_H_ */
|
||||
124
Artifacts/include/fog.h
Normal file
124
Artifacts/include/fog.h
Normal file
@ -0,0 +1,124 @@
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
#ifndef FOG_H_
|
||||
#define FOG_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "keys.h"
|
||||
|
||||
/* ==================== Fog ==================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ==== Types ==== */
|
||||
|
||||
typedef struct _McFogResolver McFogResolver;
|
||||
|
||||
typedef struct _McFogRng McFogRng;
|
||||
|
||||
/* ==== McFogResolver ==== */
|
||||
|
||||
McFogResolver* MC_NULLABLE mc_fog_resolver_create(
|
||||
const McVerifier* MC_NONNULL fog_report_verifier
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
void mc_fog_resolver_free(
|
||||
McFogResolver* MC_NULLABLE fog_resolver
|
||||
);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `report_url` - must be a nul-terminated C string containing a valid Fog report uri.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
bool mc_fog_resolver_add_report_response(
|
||||
McFogResolver* MC_NONNULL fog_resolver,
|
||||
const char* MC_NONNULL report_url,
|
||||
const McBuffer* MC_NONNULL report_response,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3);
|
||||
|
||||
/* ==== McFogRng ==== */
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `subaddress_view_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
/// * `LibMcError::UnsupportedCryptoBoxVersion`
|
||||
McFogRng* MC_NULLABLE mc_fog_rng_create(
|
||||
const McBuffer* MC_NONNULL subaddress_view_private_key,
|
||||
const McBuffer* MC_NONNULL rng_public_key,
|
||||
uint32_t rng_version,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
void mc_fog_rng_free(
|
||||
McFogRng* MC_NULLABLE fog_rng);
|
||||
|
||||
McFogRng* MC_NULLABLE mc_fog_rng_clone(
|
||||
const McFogRng* MC_NONNULL fog_rng
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `out_fog_rng_proto_bytes` - must be null or else length must be >= `encoded.len`.
|
||||
ssize_t mc_fog_rng_serialize_proto(
|
||||
const McFogRng* MC_NONNULL fog_rng,
|
||||
McMutableBuffer* MC_NULLABLE out_fog_rng_proto_bytes
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
/// * `LibMcError::UnsupportedCryptoBoxVersion`
|
||||
McFogRng* MC_NULLABLE mc_fog_rng_deserialize_proto(
|
||||
const McBuffer* MC_NONNULL fog_rng_proto_bytes,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
int64_t mc_fog_rng_index(
|
||||
const McFogRng* MC_NONNULL fog_rng
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
ssize_t mc_fog_rng_get_output_len(
|
||||
const McFogRng* MC_NONNULL fog_rng
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `out_output` - length must be >= `output.len`.
|
||||
bool mc_fog_rng_peek(
|
||||
const McFogRng* MC_NONNULL fog_rng,
|
||||
McMutableBuffer* MC_NONNULL out_output
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `out_output` - must be null or else length must be >= `output.len`.
|
||||
bool mc_fog_rng_advance(
|
||||
McFogRng* MC_NONNULL fog_rng,
|
||||
McMutableBuffer* MC_NULLABLE out_output
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !FOG_H_ */
|
||||
99
Artifacts/include/keys.h
Normal file
99
Artifacts/include/keys.h
Normal file
@ -0,0 +1,99 @@
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
#ifndef KEYS_H_
|
||||
#define KEYS_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* ==================== Account Keys ==================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ==== Types ==== */
|
||||
|
||||
typedef struct {
|
||||
const char* MC_NONNULL report_url;
|
||||
const char* MC_NONNULL report_id;
|
||||
const McBuffer* MC_NONNULL authority_fingerprint;
|
||||
} McAccountKeyFogInfo;
|
||||
|
||||
typedef struct {
|
||||
const McBuffer* MC_NONNULL view_private_key;
|
||||
const McBuffer* MC_NONNULL spend_private_key;
|
||||
const McAccountKeyFogInfo* MC_NULLABLE fog_info;
|
||||
} McAccountKey;
|
||||
|
||||
typedef struct {
|
||||
const char* MC_NONNULL report_url;
|
||||
const char* MC_NONNULL report_id;
|
||||
const McBuffer* MC_NONNULL authority_sig;
|
||||
} McPublicAddressFogInfo;
|
||||
|
||||
typedef struct {
|
||||
const McBuffer* MC_NONNULL view_public_key;
|
||||
const McBuffer* MC_NONNULL spend_public_key;
|
||||
const McPublicAddressFogInfo* MC_NULLABLE fog_info;
|
||||
} McPublicAddress;
|
||||
|
||||
/* ==== AccountKey ==== */
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `root_entropy` - must be 32 bytes in length.
|
||||
/// * `out_view_private_key` - length must be >= 32.
|
||||
/// * `out_spend_private_key` - length must be >= 32.
|
||||
bool mc_account_private_keys_from_root_entropy(
|
||||
const McBuffer* MC_NONNULL root_entropy,
|
||||
McMutableBuffer* MC_NONNULL out_view_private_key,
|
||||
McMutableBuffer* MC_NONNULL out_spend_private_key
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `spend_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `out_subaddress_view_private_key` - length must be >= 32.
|
||||
/// * `out_subaddress_spend_private_key` - length must be >= 32.
|
||||
bool mc_account_key_get_subaddress_private_keys(
|
||||
const McBuffer* MC_NONNULL view_private_key,
|
||||
const McBuffer* MC_NONNULL spend_private_key,
|
||||
uint64_t subaddress_index,
|
||||
McMutableBuffer* MC_NONNULL out_subaddress_view_private_key,
|
||||
McMutableBuffer* MC_NONNULL out_subaddress_spend_private_key
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 4, 5);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `spend_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `out_subaddress_view_public_key` - length must be >= 32.
|
||||
/// * `out_subaddress_spend_public_key` - length must be >= 32.
|
||||
bool mc_account_key_get_public_address_public_keys(
|
||||
const McBuffer* MC_NONNULL view_private_key,
|
||||
const McBuffer* MC_NONNULL spend_private_key,
|
||||
uint64_t subaddress_index,
|
||||
McMutableBuffer* MC_NONNULL out_subaddress_view_public_key,
|
||||
McMutableBuffer* MC_NONNULL out_subaddress_spend_public_key
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 4, 5);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `account_key` - must be a valid `AccountKey` with `fog_info`.
|
||||
/// * `out_fog_authority_fingerprint_sig` - length must be >= 64.
|
||||
bool mc_account_key_get_public_address_fog_authority_sig(
|
||||
const McAccountKey* MC_NONNULL account_key,
|
||||
uint64_t subaddress_index,
|
||||
McMutableBuffer* MC_NONNULL out_fog_authority_sig
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 3);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !KEYS_H_ */
|
||||
16
Artifacts/include/libmobilecoin.h
Normal file
16
Artifacts/include/libmobilecoin.h
Normal file
@ -0,0 +1,16 @@
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
#ifndef LIBMOBILECOIN_H_
|
||||
#define LIBMOBILECOIN_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "crypto.h"
|
||||
#include "keys.h"
|
||||
#include "attest.h"
|
||||
#include "encodings.h"
|
||||
#include "fog.h"
|
||||
#include "transaction.h"
|
||||
#include "bip39.h"
|
||||
#include "slip10.h"
|
||||
|
||||
#endif /* !LIBMOBILECOIN_H_ */
|
||||
46
Artifacts/include/slip10.h
Normal file
46
Artifacts/include/slip10.h
Normal file
@ -0,0 +1,46 @@
|
||||
#ifndef SLIP10_H_
|
||||
#define SLIP10_H_
|
||||
|
||||
#include "common.h"
|
||||
|
||||
/* ==================== SLIP10 ==================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ==== Types ==== */
|
||||
|
||||
typedef struct _McSlip10Indices McSlip10Indices;
|
||||
|
||||
/* ==== McSlip10Indices ==== */
|
||||
|
||||
McSlip10Indices* MC_NULLABLE mc_slip10_indices_create(void);
|
||||
|
||||
void mc_slip10_indices_free(
|
||||
McSlip10Indices* MC_NULLABLE indices
|
||||
);
|
||||
|
||||
bool mc_slip10_indices_add(
|
||||
McSlip10Indices* MC_NONNULL indices,
|
||||
uint32_t index
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
/* ==== McSlip10 ==== */
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `out_key` - length must be >= 32.
|
||||
bool mc_slip10_derive_ed25519_private_key(
|
||||
const McBuffer* MC_NONNULL seed,
|
||||
const McSlip10Indices* MC_NONNULL path,
|
||||
McMutableBuffer* MC_NONNULL out_key
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !SLIP10_H_ */
|
||||
230
Artifacts/include/transaction.h
Normal file
230
Artifacts/include/transaction.h
Normal file
@ -0,0 +1,230 @@
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
#ifndef TRANSACTION_H_
|
||||
#define TRANSACTION_H_
|
||||
|
||||
#include "common.h"
|
||||
#include "fog.h"
|
||||
#include "keys.h"
|
||||
|
||||
/* ==================== Transaction ==================== */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* ==== Types ==== */
|
||||
|
||||
typedef struct {
|
||||
const McBuffer* MC_NONNULL commitment;
|
||||
uint64_t masked_value;
|
||||
} McTxOutAmount;
|
||||
|
||||
typedef struct _McTransactionBuilderRing McTransactionBuilderRing;
|
||||
typedef struct _McTransactionBuilder McTransactionBuilder;
|
||||
|
||||
/* ==== TxOut ==== */
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
bool mc_tx_out_matches_any_subaddress(
|
||||
const McTxOutAmount* MC_NONNULL tx_out_amount,
|
||||
const McBuffer* MC_NONNULL tx_out_public_key,
|
||||
const McBuffer* MC_NONNULL view_private_key,
|
||||
bool* MC_NONNULL out_matches
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3, 4);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `subaddress_spend_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
bool mc_tx_out_matches_subaddress(
|
||||
const McBuffer* MC_NONNULL tx_out_target_key,
|
||||
const McBuffer* MC_NONNULL tx_out_public_key,
|
||||
const McBuffer* MC_NONNULL view_private_key,
|
||||
const McBuffer* MC_NONNULL subaddress_spend_private_key,
|
||||
bool* MC_NONNULL out_matches
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3, 4, 5);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `out_subaddress_spend_public_key` - length must be >= 32.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
bool mc_tx_out_get_subaddress_spend_public_key(
|
||||
const McBuffer* MC_NONNULL tx_out_target_key,
|
||||
const McBuffer* MC_NONNULL tx_out_public_key,
|
||||
const McBuffer* MC_NONNULL view_private_key,
|
||||
McMutableBuffer* MC_NONNULL out_subaddress_spend_public_key,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3, 4);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
/// * `LibMcError::TransactionCrypto`
|
||||
bool mc_tx_out_get_value(
|
||||
const McTxOutAmount* MC_NONNULL tx_out_amount,
|
||||
const McBuffer* MC_NONNULL tx_out_public_key,
|
||||
const McBuffer* MC_NONNULL view_private_key,
|
||||
uint64_t* MC_NONNULL out_value,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3, 4);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `subaddress_spend_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `out_key_image` - length must be >= 32.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
/// * `LibMcError::TransactionCrypto`
|
||||
bool mc_tx_out_get_key_image(
|
||||
const McBuffer* MC_NONNULL tx_out_target_key,
|
||||
const McBuffer* MC_NONNULL tx_out_public_key,
|
||||
const McBuffer* MC_NONNULL view_private_key,
|
||||
const McBuffer* MC_NONNULL subaddress_spend_private_key,
|
||||
McMutableBuffer* MC_NONNULL out_key_image,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3, 4, 5);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
bool mc_tx_out_validate_confirmation_number(
|
||||
const McBuffer* MC_NONNULL tx_out_public_key,
|
||||
const McBuffer* MC_NONNULL tx_out_confirmation_number,
|
||||
const McBuffer* MC_NONNULL view_private_key,
|
||||
bool* MC_NONNULL out_valid
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3, 4);
|
||||
|
||||
/* ==== McTransactionBuilderRing ==== */
|
||||
|
||||
McTransactionBuilderRing* MC_NULLABLE mc_transaction_builder_ring_create();
|
||||
|
||||
void mc_transaction_builder_ring_free(
|
||||
McTransactionBuilderRing* MC_NULLABLE transaction_builder_ring
|
||||
);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `tx_out_proto_bytes` - must be a valid binary-serialized `external.TxOut` Protobuf.
|
||||
/// * `membership_proof_proto_bytes` - must be a valid binary-serialized
|
||||
/// `external.TxOutMembershipProof` Protobuf.
|
||||
bool mc_transaction_builder_ring_add_element(
|
||||
McTransactionBuilderRing* MC_NONNULL transaction_builder_ring,
|
||||
const McBuffer* MC_NONNULL tx_out_proto_bytes,
|
||||
const McBuffer* MC_NONNULL membership_proof_proto_bytes
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3);
|
||||
|
||||
/* ==== McTransactionBuilder ==== */
|
||||
|
||||
McTransactionBuilder* MC_NULLABLE mc_transaction_builder_create(
|
||||
uint64_t fee,
|
||||
uint64_t tombstone_block,
|
||||
const McFogResolver* MC_NULLABLE fog_resolver
|
||||
);
|
||||
|
||||
void mc_transaction_builder_free(
|
||||
McTransactionBuilder* MC_NULLABLE transaction_builder
|
||||
);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `transaction_builder` - must not have been previously consumed by a call to `build`.
|
||||
/// * `view_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `subaddress_spend_private_key` - must be a valid 32-byte Ristretto-format scalar.
|
||||
/// * `real_index` - must be within bounds of `ring`.
|
||||
/// * `ring` - `TxOut` at `real_index` must be owned by account keys.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
bool mc_transaction_builder_add_input(
|
||||
McTransactionBuilder* MC_NONNULL transaction_builder,
|
||||
const McBuffer* MC_NONNULL view_private_key,
|
||||
const McBuffer* MC_NONNULL subaddress_spend_private_key,
|
||||
size_t real_index,
|
||||
const McTransactionBuilderRing* MC_NONNULL ring,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 2, 3, 5);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `transaction_builder` - must not have been previously consumed by a call to `build`.
|
||||
/// * `recipient_address` - must be a valid `PublicAddress`.
|
||||
/// * `out_subaddress_spend_public_key` - length must be >= 32.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::AttestationVerification`
|
||||
/// * `LibMcError::InvalidInput`
|
||||
McData* MC_NULLABLE mc_transaction_builder_add_output(
|
||||
McTransactionBuilder* MC_NONNULL transaction_builder,
|
||||
uint64_t amount,
|
||||
const McPublicAddress* MC_NONNULL recipient_address,
|
||||
McRngCallback* MC_NULLABLE rng_callback,
|
||||
McMutableBuffer* MC_NONNULL out_tx_out_confirmation_number,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 3, 6);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `transaction_builder` - must not have been previously consumed by a call to `build`.
|
||||
/// * `recipient_address` - must be a valid `PublicAddress`.
|
||||
/// * `fog_hint_address` - must be a valid `PublicAddress` with `fog_info`.
|
||||
/// * `out_tx_out_confirmation_number` - length must be >= 32.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::AttestationVerification`
|
||||
/// * `LibMcError::InvalidInput`
|
||||
McData* MC_NULLABLE mc_transaction_builder_add_output_with_fog_hint_address(
|
||||
McTransactionBuilder* MC_NONNULL transaction_builder,
|
||||
uint64_t amount,
|
||||
const McPublicAddress* MC_NONNULL recipient_address,
|
||||
const McPublicAddress* MC_NONNULL fog_hint_address,
|
||||
McRngCallback* MC_NULLABLE rng_callback,
|
||||
McMutableBuffer* MC_NONNULL out_tx_out_confirmation_number,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1, 3, 4, 5, 7);
|
||||
|
||||
/// # Preconditions
|
||||
///
|
||||
/// * `transaction_builder` - must not have been previously consumed by a call to `build`.
|
||||
///
|
||||
/// # Errors
|
||||
///
|
||||
/// * `LibMcError::InvalidInput`
|
||||
McData* MC_NULLABLE mc_transaction_builder_build(
|
||||
McTransactionBuilder* MC_NONNULL transaction_builder,
|
||||
McRngCallback* MC_NULLABLE rng_callback,
|
||||
McError* MC_NULLABLE * MC_NULLABLE out_error
|
||||
)
|
||||
MC_ATTRIBUTE_NONNULL(1);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* !TRANSACTION_H_ */
|
||||
BIN
Artifacts/libmobilecoin.a
Normal file
BIN
Artifacts/libmobilecoin.a
Normal file
Binary file not shown.
30
CLA.md
Normal file
30
CLA.md
Normal file
@ -0,0 +1,30 @@
|
||||
## Contributor License Agreement
|
||||
|
||||
Thank you for your contribution to the MobileCoin project from MoblieCoin Inc. (“MobileCoin”).
|
||||
|
||||
This contributor license agreement documents the rights granted by contributors to MobileCoin. This license is for your protection as a Contributor as well as the protection of MobileCoin, its users, and its licensees; you may still license your own Contributions under other terms.
|
||||
|
||||
In exchange for the ability to participate in the MobileCoin community and for other good consideration, the receipt of which is hereby acknowledged, you accept and agree to the following terms and conditions for Your present and future Contributions submitted to MobileCoin. Except for the license granted herein to MobileCoin and recipients of software distributed by MobileCoin, You reserve all right, title, and interest in and to Your Contributions.
|
||||
|
||||
1. Definitions.
|
||||
|
||||
“You” (or “Your”) shall mean the copyright owner or legal entity authorized by the copyright owner that is making this Agreement with MobileCoin. For legal entities, the entity making a Contribution and all other entities that control, are controlled by, or are under common control with that entity are considered to be a single Contributor. For the purposes of this definition, “control” means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
“Contribution” shall mean any original work of authorship or invention, including any modifications or additions to an existing work, that is intentionally submitted by You to MobileCoin for inclusion in, or documentation of, any of the products owned or managed by MobileCoin (the “Work”). For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to MobileCoin or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, MobileCoin for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by You as “Not a Contribution.”
|
||||
|
||||
1. Grant of Copyright License. Subject to the terms and conditions of this Agreement, You hereby grant to MobileCoin and to recipients of software distributed by MobileCoin a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, and distribute Your Contributions and such derivative works, as well as the right to sublicense and have sublicensed all of the foregoing rights, through multiple tiers of sublicensees, provided that in all cases, MobileCoin will make Your Contributions available under an open source license.
|
||||
|
||||
a. Moral Rights. If moral rights apply to the Contribution, to the maximum extent permitted by law, You waive and agree not to assert such moral rights against MobileCoin or its successors in interest, or any of MobileCoin’s licensees, either direct or indirect.
|
||||
|
||||
|
||||
1. Grant of Patent License. Subject to the terms and conditions of this Agreement, You hereby grant to MobileCoin and to recipients of software distributed by MobileCoin a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by You that are necessarily infringed by Your Contribution(s) alone or by combination of Your Contribution(s) with the Work to which such Contribution(s) was submitted. If any entity institutes patent litigation against You or any other entity (including a cross-claim or counterclaim in a lawsuit) alleging that your Contribution, or the Work to which you have contributed, constitutes direct or contributory patent infringement, then any patent licenses granted to that entity under this Agreement for that Contribution or Work shall terminate as of the date such litigation is filed.
|
||||
|
||||
1. You represent that you are legally entitled to grant the above license. If your employer(s) has rights to intellectual property that you create that includes your Contributions, you represent that you have received permission to make Contributions on behalf of that employer, that your employer has waived such rights for your contributions to MobileCoin, or that your employer has executed with MobileCoin a separate contributor license agreement substantially similar to this Agreement.
|
||||
|
||||
1. You represent that each of Your Contributions is Your original creation (see section 7 for submissions on behalf of others). You represent that Your Contribution submissions include complete details of any third-party license or other restriction (including, but not limited to, related patents and trademarks) of which you are personally aware and which are associated with any part of Your Contributions.
|
||||
|
||||
1. You are not expected to provide support for Your Contributions, except to the extent You desire to provide support. You may provide support for free, for a fee, or not at all. Unless required by applicable law or agreed to in writing, You provide Your Contributions on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of title, non-infringement, merchantability, or fitness for a particular purpose.
|
||||
|
||||
1. Should You wish to submit work that is not Your original creation, You may submit it to MobileCoin separately from any Contribution, identifying the complete details of its source and of any license or other restriction (including, but not limited to, related patents, trademarks, and license agreements) of which you are personally aware, and conspicuously marking the work as “Not a Contribution”. Third-party materials licensed pursuant to: [license name(s) here]” (substituting the bracketed text with the appropriate license name(s)).
|
||||
|
||||
1. You agree to notify MobileCoin of any facts or circumstances of which you become aware that would make these representations inaccurate in any respect.
|
||||
83
Dockerfile
Normal file
83
Dockerfile
Normal file
@ -0,0 +1,83 @@
|
||||
FROM swift:focal as plugins
|
||||
|
||||
RUN apt-get -q update && apt-get -q install -y --no-install-recommends \
|
||||
make \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
ARG grpc_swift_version
|
||||
|
||||
WORKDIR /root
|
||||
RUN git clone --depth 1 -b $grpc_swift_version https://github.com/grpc/grpc-swift.git
|
||||
|
||||
WORKDIR grpc-swift
|
||||
RUN make plugins
|
||||
|
||||
|
||||
FROM swift:focal as build
|
||||
|
||||
RUN apt-get -q update && apt-get -q install -y --no-install-recommends \
|
||||
libprotobuf-dev \
|
||||
protobuf-compiler \
|
||||
protobuf-compiler-grpc \
|
||||
&& rm -r /var/lib/apt/lists/*
|
||||
|
||||
COPY --from=plugins \
|
||||
/root/grpc-swift/protoc-gen-grpc-swift \
|
||||
/root/grpc-swift/protoc-gen-swift \
|
||||
/root/grpc-swift-plugins/bin/
|
||||
ENV PATH="/root/grpc-swift-plugins/bin:${PATH}"
|
||||
|
||||
WORKDIR /root/project
|
||||
|
||||
COPY Vendor/fog/mobilecoin/api/proto/blockchain.proto \
|
||||
Vendor/fog/mobilecoin/api/proto/external.proto \
|
||||
Vendor/fog/mobilecoin/api/proto/printable.proto \
|
||||
Vendor/fog/mobilecoin/api/proto/watcher.proto \
|
||||
Vendor/fog/mobilecoin/api/proto/
|
||||
COPY Vendor/fog/mobilecoin/attest/api/proto/attest.proto \
|
||||
Vendor/fog/mobilecoin/attest/api/proto/
|
||||
COPY Vendor/fog/mobilecoin/consensus/api/proto/consensus_client.proto \
|
||||
Vendor/fog/mobilecoin/consensus/api/proto/consensus_common.proto \
|
||||
Vendor/fog/mobilecoin/consensus/api/proto/
|
||||
COPY Vendor/fog/mobilecoin/fog/api/proto/report.proto \
|
||||
Vendor/fog/mobilecoin/fog/api/proto/
|
||||
COPY Vendor/fog/fog/api/proto/fog_common.proto \
|
||||
Vendor/fog/fog/api/proto/ingest.proto \
|
||||
Vendor/fog/fog/api/proto/ingest_common.proto \
|
||||
Vendor/fog/fog/api/proto/kex_rng.proto \
|
||||
Vendor/fog/fog/api/proto/ledger.proto \
|
||||
Vendor/fog/fog/api/proto/view.proto \
|
||||
Vendor/fog/fog/api/proto/
|
||||
|
||||
RUN mkdir -p Sources/Generated/Proto
|
||||
RUN protoc \
|
||||
--swift_out=Sources/Generated/Proto \
|
||||
--swift_opt=Visibility=Public \
|
||||
--grpc-swift_out=Sources/Generated/Proto \
|
||||
--grpc-swift_opt=Client=true,Server=false,Visibility=Public \
|
||||
-IVendor/fog/mobilecoin/api/proto \
|
||||
-IVendor/fog/mobilecoin/attest/api/proto \
|
||||
-IVendor/fog/mobilecoin/consensus/api/proto \
|
||||
-IVendor/fog/mobilecoin/fog/api/proto \
|
||||
-IVendor/fog/fog/api/proto \
|
||||
external.proto \
|
||||
blockchain.proto \
|
||||
printable.proto \
|
||||
watcher.proto \
|
||||
attest.proto \
|
||||
consensus_client.proto \
|
||||
consensus_common.proto \
|
||||
report.proto \
|
||||
fog_common.proto \
|
||||
ingest.proto \
|
||||
ingest_common.proto \
|
||||
kex_rng.proto \
|
||||
ledger.proto \
|
||||
view.proto
|
||||
|
||||
|
||||
FROM scratch
|
||||
|
||||
COPY --from=build \
|
||||
/root/project/Sources/Generated/Proto/ \
|
||||
/Sources/Generated/Proto/
|
||||
93
Gemfile.lock
Normal file
93
Gemfile.lock
Normal file
@ -0,0 +1,93 @@
|
||||
GEM
|
||||
remote: https://rubygems.org/
|
||||
specs:
|
||||
CFPropertyList (3.0.3)
|
||||
activesupport (5.2.4.5)
|
||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||
i18n (>= 0.7, < 2)
|
||||
minitest (~> 5.1)
|
||||
tzinfo (~> 1.1)
|
||||
addressable (2.7.0)
|
||||
public_suffix (>= 2.0.2, < 5.0)
|
||||
algoliasearch (1.27.5)
|
||||
httpclient (~> 2.8, >= 2.8.3)
|
||||
json (>= 1.5.1)
|
||||
atomos (0.1.3)
|
||||
claide (1.0.3)
|
||||
cocoapods (1.10.1)
|
||||
addressable (~> 2.6)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
cocoapods-core (= 1.10.1)
|
||||
cocoapods-deintegrate (>= 1.0.3, < 2.0)
|
||||
cocoapods-downloader (>= 1.4.0, < 2.0)
|
||||
cocoapods-plugins (>= 1.0.0, < 2.0)
|
||||
cocoapods-search (>= 1.0.0, < 2.0)
|
||||
cocoapods-trunk (>= 1.4.0, < 2.0)
|
||||
cocoapods-try (>= 1.1.0, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
escape (~> 0.0.4)
|
||||
fourflusher (>= 2.3.0, < 3.0)
|
||||
gh_inspector (~> 1.0)
|
||||
molinillo (~> 0.6.6)
|
||||
nap (~> 1.0)
|
||||
ruby-macho (~> 1.4)
|
||||
xcodeproj (>= 1.19.0, < 2.0)
|
||||
cocoapods-core (1.10.1)
|
||||
activesupport (> 5.0, < 6)
|
||||
addressable (~> 2.6)
|
||||
algoliasearch (~> 1.0)
|
||||
concurrent-ruby (~> 1.1)
|
||||
fuzzy_match (~> 2.0.4)
|
||||
nap (~> 1.0)
|
||||
netrc (~> 0.11)
|
||||
public_suffix
|
||||
typhoeus (~> 1.0)
|
||||
cocoapods-deintegrate (1.0.4)
|
||||
cocoapods-downloader (1.4.0)
|
||||
cocoapods-plugins (1.0.0)
|
||||
nap
|
||||
cocoapods-search (1.0.0)
|
||||
cocoapods-trunk (1.5.0)
|
||||
nap (>= 0.8, < 2.0)
|
||||
netrc (~> 0.11)
|
||||
cocoapods-try (1.2.0)
|
||||
colored2 (3.1.2)
|
||||
concurrent-ruby (1.1.8)
|
||||
escape (0.0.4)
|
||||
ethon (0.12.0)
|
||||
ffi (>= 1.3.0)
|
||||
ffi (1.15.0)
|
||||
fourflusher (2.3.1)
|
||||
fuzzy_match (2.0.4)
|
||||
gh_inspector (1.1.3)
|
||||
httpclient (2.8.3)
|
||||
i18n (1.8.9)
|
||||
concurrent-ruby (~> 1.0)
|
||||
json (2.5.1)
|
||||
minitest (5.14.4)
|
||||
molinillo (0.6.6)
|
||||
nanaimo (0.3.0)
|
||||
nap (1.1.0)
|
||||
netrc (0.11.0)
|
||||
public_suffix (4.0.6)
|
||||
ruby-macho (1.4.0)
|
||||
thread_safe (0.3.6)
|
||||
typhoeus (1.4.0)
|
||||
ethon (>= 0.9.0)
|
||||
tzinfo (1.2.9)
|
||||
thread_safe (~> 0.1)
|
||||
xcodeproj (1.19.0)
|
||||
CFPropertyList (>= 2.3.3, < 4.0)
|
||||
atomos (~> 0.1.3)
|
||||
claide (>= 1.0.2, < 2.0)
|
||||
colored2 (~> 3.1)
|
||||
nanaimo (~> 0.3.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
cocoapods!
|
||||
|
||||
BUNDLED WITH
|
||||
2.1.4
|
||||
621
LICENSE
Normal file
621
LICENSE
Normal file
@ -0,0 +1,621 @@
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The GNU General Public License is a free, copyleft license for
|
||||
software and other kinds of works.
|
||||
|
||||
The licenses for most software and other practical works are designed
|
||||
to take away your freedom to share and change the works. By contrast,
|
||||
the GNU General Public License is intended to guarantee your freedom to
|
||||
share and change all versions of a program--to make sure it remains free
|
||||
software for all its users. We, the Free Software Foundation, use the
|
||||
GNU General Public License for most of our software; it applies also to
|
||||
any other work released this way by its authors. You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
them if you wish), that you receive source code or can get it if you
|
||||
want it, that you can change the software or use pieces of it in new
|
||||
free programs, and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to prevent others from denying you
|
||||
these rights or asking you to surrender the rights. Therefore, you have
|
||||
certain responsibilities if you distribute copies of the software, or if
|
||||
you modify it: responsibilities to respect the freedom of others.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must pass on to the recipients the same
|
||||
freedoms that you received. You must make sure that they, too, receive
|
||||
or can get the source code. And you must show them these terms so they
|
||||
know their rights.
|
||||
|
||||
Developers that use the GNU GPL protect your rights with two steps:
|
||||
(1) assert copyright on the software, and (2) offer you this License
|
||||
giving you legal permission to copy, distribute and/or modify it.
|
||||
|
||||
For the developers' and authors' protection, the GPL clearly explains
|
||||
that there is no warranty for this free software. For both users' and
|
||||
authors' sake, the GPL requires that modified versions be marked as
|
||||
changed, so that their problems will not be attributed erroneously to
|
||||
authors of previous versions.
|
||||
|
||||
Some devices are designed to deny users access to install or run
|
||||
modified versions of the software inside them, although the manufacturer
|
||||
can do so. This is fundamentally incompatible with the aim of
|
||||
protecting users' freedom to change the software. The systematic
|
||||
pattern of such abuse occurs in the area of products for individuals to
|
||||
use, which is precisely where it is most unacceptable. Therefore, we
|
||||
have designed this version of the GPL to prohibit the practice for those
|
||||
products. If such problems arise substantially in other domains, we
|
||||
stand ready to extend this provision to those domains in future versions
|
||||
of the GPL, as needed to protect the freedom of users.
|
||||
|
||||
Finally, every program is threatened constantly by software patents.
|
||||
States should not allow patents to restrict development and use of
|
||||
software on general-purpose computers, but in those that do, we wish to
|
||||
avoid the special danger that patents applied to a free program could
|
||||
make it effectively proprietary. To prevent this, the GPL assures that
|
||||
patents cannot be used to render the program non-free.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
TERMS AND CONDITIONS
|
||||
|
||||
0. Definitions.
|
||||
|
||||
"This License" refers to version 3 of the GNU General Public License.
|
||||
|
||||
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||
works, such as semiconductor masks.
|
||||
|
||||
"The Program" refers to any copyrightable work licensed under this
|
||||
License. Each licensee is addressed as "you". "Licensees" and
|
||||
"recipients" may be individuals or organizations.
|
||||
|
||||
To "modify" a work means to copy from or adapt all or part of the work
|
||||
in a fashion requiring copyright permission, other than the making of an
|
||||
exact copy. The resulting work is called a "modified version" of the
|
||||
earlier work or a work "based on" the earlier work.
|
||||
|
||||
A "covered work" means either the unmodified Program or a work based
|
||||
on the Program.
|
||||
|
||||
To "propagate" a work means to do anything with it that, without
|
||||
permission, would make you directly or secondarily liable for
|
||||
infringement under applicable copyright law, except executing it on a
|
||||
computer or modifying a private copy. Propagation includes copying,
|
||||
distribution (with or without modification), making available to the
|
||||
public, and in some countries other activities as well.
|
||||
|
||||
To "convey" a work means any kind of propagation that enables other
|
||||
parties to make or receive copies. Mere interaction with a user through
|
||||
a computer network, with no transfer of a copy, is not conveying.
|
||||
|
||||
An interactive user interface displays "Appropriate Legal Notices"
|
||||
to the extent that it includes a convenient and prominently visible
|
||||
feature that (1) displays an appropriate copyright notice, and (2)
|
||||
tells the user that there is no warranty for the work (except to the
|
||||
extent that warranties are provided), that licensees may convey the
|
||||
work under this License, and how to view a copy of this License. If
|
||||
the interface presents a list of user commands or options, such as a
|
||||
menu, a prominent item in the list meets this criterion.
|
||||
|
||||
1. Source Code.
|
||||
|
||||
The "source code" for a work means the preferred form of the work
|
||||
for making modifications to it. "Object code" means any non-source
|
||||
form of a work.
|
||||
|
||||
A "Standard Interface" means an interface that either is an official
|
||||
standard defined by a recognized standards body, or, in the case of
|
||||
interfaces specified for a particular programming language, one that
|
||||
is widely used among developers working in that language.
|
||||
|
||||
The "System Libraries" of an executable work include anything, other
|
||||
than the work as a whole, that (a) is included in the normal form of
|
||||
packaging a Major Component, but which is not part of that Major
|
||||
Component, and (b) serves only to enable use of the work with that
|
||||
Major Component, or to implement a Standard Interface for which an
|
||||
implementation is available to the public in source code form. A
|
||||
"Major Component", in this context, means a major essential component
|
||||
(kernel, window system, and so on) of the specific operating system
|
||||
(if any) on which the executable work runs, or a compiler used to
|
||||
produce the work, or an object code interpreter used to run it.
|
||||
|
||||
The "Corresponding Source" for a work in object code form means all
|
||||
the source code needed to generate, install, and (for an executable
|
||||
work) run the object code and to modify the work, including scripts to
|
||||
control those activities. However, it does not include the work's
|
||||
System Libraries, or general-purpose tools or generally available free
|
||||
programs which are used unmodified in performing those activities but
|
||||
which are not part of the work. For example, Corresponding Source
|
||||
includes interface definition files associated with source files for
|
||||
the work, and the source code for shared libraries and dynamically
|
||||
linked subprograms that the work is specifically designed to require,
|
||||
such as by intimate data communication or control flow between those
|
||||
subprograms and other parts of the work.
|
||||
|
||||
The Corresponding Source need not include anything that users
|
||||
can regenerate automatically from other parts of the Corresponding
|
||||
Source.
|
||||
|
||||
The Corresponding Source for a work in source code form is that
|
||||
same work.
|
||||
|
||||
2. Basic Permissions.
|
||||
|
||||
All rights granted under this License are granted for the term of
|
||||
copyright on the Program, and are irrevocable provided the stated
|
||||
conditions are met. This License explicitly affirms your unlimited
|
||||
permission to run the unmodified Program. The output from running a
|
||||
covered work is covered by this License only if the output, given its
|
||||
content, constitutes a covered work. This License acknowledges your
|
||||
rights of fair use or other equivalent, as provided by copyright law.
|
||||
|
||||
You may make, run and propagate covered works that you do not
|
||||
convey, without conditions so long as your license otherwise remains
|
||||
in force. You may convey covered works to others for the sole purpose
|
||||
of having them make modifications exclusively for you, or provide you
|
||||
with facilities for running those works, provided that you comply with
|
||||
the terms of this License in conveying all material for which you do
|
||||
not control copyright. Those thus making or running the covered works
|
||||
for you must do so exclusively on your behalf, under your direction
|
||||
and control, on terms that prohibit them from making any copies of
|
||||
your copyrighted material outside their relationship with you.
|
||||
|
||||
Conveying under any other circumstances is permitted solely under
|
||||
the conditions stated below. Sublicensing is not allowed; section 10
|
||||
makes it unnecessary.
|
||||
|
||||
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||
|
||||
No covered work shall be deemed part of an effective technological
|
||||
measure under any applicable law fulfilling obligations under article
|
||||
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||
similar laws prohibiting or restricting circumvention of such
|
||||
measures.
|
||||
|
||||
When you convey a covered work, you waive any legal power to forbid
|
||||
circumvention of technological measures to the extent such circumvention
|
||||
is effected by exercising rights under this License with respect to
|
||||
the covered work, and you disclaim any intention to limit operation or
|
||||
modification of the work as a means of enforcing, against the work's
|
||||
users, your or third parties' legal rights to forbid circumvention of
|
||||
technological measures.
|
||||
|
||||
4. Conveying Verbatim Copies.
|
||||
|
||||
You may convey verbatim copies of the Program's source code as you
|
||||
receive it, in any medium, provided that you conspicuously and
|
||||
appropriately publish on each copy an appropriate copyright notice;
|
||||
keep intact all notices stating that this License and any
|
||||
non-permissive terms added in accord with section 7 apply to the code;
|
||||
keep intact all notices of the absence of any warranty; and give all
|
||||
recipients a copy of this License along with the Program.
|
||||
|
||||
You may charge any price or no price for each copy that you convey,
|
||||
and you may offer support or warranty protection for a fee.
|
||||
|
||||
5. Conveying Modified Source Versions.
|
||||
|
||||
You may convey a work based on the Program, or the modifications to
|
||||
produce it from the Program, in the form of source code under the
|
||||
terms of section 4, provided that you also meet all of these conditions:
|
||||
|
||||
a) The work must carry prominent notices stating that you modified
|
||||
it, and giving a relevant date.
|
||||
|
||||
b) The work must carry prominent notices stating that it is
|
||||
released under this License and any conditions added under section
|
||||
7. This requirement modifies the requirement in section 4 to
|
||||
"keep intact all notices".
|
||||
|
||||
c) You must license the entire work, as a whole, under this
|
||||
License to anyone who comes into possession of a copy. This
|
||||
License will therefore apply, along with any applicable section 7
|
||||
additional terms, to the whole of the work, and all its parts,
|
||||
regardless of how they are packaged. This License gives no
|
||||
permission to license the work in any other way, but it does not
|
||||
invalidate such permission if you have separately received it.
|
||||
|
||||
d) If the work has interactive user interfaces, each must display
|
||||
Appropriate Legal Notices; however, if the Program has interactive
|
||||
interfaces that do not display Appropriate Legal Notices, your
|
||||
work need not make them do so.
|
||||
|
||||
A compilation of a covered work with other separate and independent
|
||||
works, which are not by their nature extensions of the covered work,
|
||||
and which are not combined with it such as to form a larger program,
|
||||
in or on a volume of a storage or distribution medium, is called an
|
||||
"aggregate" if the compilation and its resulting copyright are not
|
||||
used to limit the access or legal rights of the compilation's users
|
||||
beyond what the individual works permit. Inclusion of a covered work
|
||||
in an aggregate does not cause this License to apply to the other
|
||||
parts of the aggregate.
|
||||
|
||||
6. Conveying Non-Source Forms.
|
||||
|
||||
You may convey a covered work in object code form under the terms
|
||||
of sections 4 and 5, provided that you also convey the
|
||||
machine-readable Corresponding Source under the terms of this License,
|
||||
in one of these ways:
|
||||
|
||||
a) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by the
|
||||
Corresponding Source fixed on a durable physical medium
|
||||
customarily used for software interchange.
|
||||
|
||||
b) Convey the object code in, or embodied in, a physical product
|
||||
(including a physical distribution medium), accompanied by a
|
||||
written offer, valid for at least three years and valid for as
|
||||
long as you offer spare parts or customer support for that product
|
||||
model, to give anyone who possesses the object code either (1) a
|
||||
copy of the Corresponding Source for all the software in the
|
||||
product that is covered by this License, on a durable physical
|
||||
medium customarily used for software interchange, for a price no
|
||||
more than your reasonable cost of physically performing this
|
||||
conveying of source, or (2) access to copy the
|
||||
Corresponding Source from a network server at no charge.
|
||||
|
||||
c) Convey individual copies of the object code with a copy of the
|
||||
written offer to provide the Corresponding Source. This
|
||||
alternative is allowed only occasionally and noncommercially, and
|
||||
only if you received the object code with such an offer, in accord
|
||||
with subsection 6b.
|
||||
|
||||
d) Convey the object code by offering access from a designated
|
||||
place (gratis or for a charge), and offer equivalent access to the
|
||||
Corresponding Source in the same way through the same place at no
|
||||
further charge. You need not require recipients to copy the
|
||||
Corresponding Source along with the object code. If the place to
|
||||
copy the object code is a network server, the Corresponding Source
|
||||
may be on a different server (operated by you or a third party)
|
||||
that supports equivalent copying facilities, provided you maintain
|
||||
clear directions next to the object code saying where to find the
|
||||
Corresponding Source. Regardless of what server hosts the
|
||||
Corresponding Source, you remain obligated to ensure that it is
|
||||
available for as long as needed to satisfy these requirements.
|
||||
|
||||
e) Convey the object code using peer-to-peer transmission, provided
|
||||
you inform other peers where the object code and Corresponding
|
||||
Source of the work are being offered to the general public at no
|
||||
charge under subsection 6d.
|
||||
|
||||
A separable portion of the object code, whose source code is excluded
|
||||
from the Corresponding Source as a System Library, need not be
|
||||
included in conveying the object code work.
|
||||
|
||||
A "User Product" is either (1) a "consumer product", which means any
|
||||
tangible personal property which is normally used for personal, family,
|
||||
or household purposes, or (2) anything designed or sold for incorporation
|
||||
into a dwelling. In determining whether a product is a consumer product,
|
||||
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||
product received by a particular user, "normally used" refers to a
|
||||
typical or common use of that class of product, regardless of the status
|
||||
of the particular user or of the way in which the particular user
|
||||
actually uses, or expects or is expected to use, the product. A product
|
||||
is a consumer product regardless of whether the product has substantial
|
||||
commercial, industrial or non-consumer uses, unless such uses represent
|
||||
the only significant mode of use of the product.
|
||||
|
||||
"Installation Information" for a User Product means any methods,
|
||||
procedures, authorization keys, or other information required to install
|
||||
and execute modified versions of a covered work in that User Product from
|
||||
a modified version of its Corresponding Source. The information must
|
||||
suffice to ensure that the continued functioning of the modified object
|
||||
code is in no case prevented or interfered with solely because
|
||||
modification has been made.
|
||||
|
||||
If you convey an object code work under this section in, or with, or
|
||||
specifically for use in, a User Product, and the conveying occurs as
|
||||
part of a transaction in which the right of possession and use of the
|
||||
User Product is transferred to the recipient in perpetuity or for a
|
||||
fixed term (regardless of how the transaction is characterized), the
|
||||
Corresponding Source conveyed under this section must be accompanied
|
||||
by the Installation Information. But this requirement does not apply
|
||||
if neither you nor any third party retains the ability to install
|
||||
modified object code on the User Product (for example, the work has
|
||||
been installed in ROM).
|
||||
|
||||
The requirement to provide Installation Information does not include a
|
||||
requirement to continue to provide support service, warranty, or updates
|
||||
for a work that has been modified or installed by the recipient, or for
|
||||
the User Product in which it has been modified or installed. Access to a
|
||||
network may be denied when the modification itself materially and
|
||||
adversely affects the operation of the network or violates the rules and
|
||||
protocols for communication across the network.
|
||||
|
||||
Corresponding Source conveyed, and Installation Information provided,
|
||||
in accord with this section must be in a format that is publicly
|
||||
documented (and with an implementation available to the public in
|
||||
source code form), and must require no special password or key for
|
||||
unpacking, reading or copying.
|
||||
|
||||
7. Additional Terms.
|
||||
|
||||
"Additional permissions" are terms that supplement the terms of this
|
||||
License by making exceptions from one or more of its conditions.
|
||||
Additional permissions that are applicable to the entire Program shall
|
||||
be treated as though they were included in this License, to the extent
|
||||
that they are valid under applicable law. If additional permissions
|
||||
apply only to part of the Program, that part may be used separately
|
||||
under those permissions, but the entire Program remains governed by
|
||||
this License without regard to the additional permissions.
|
||||
|
||||
When you convey a copy of a covered work, you may at your option
|
||||
remove any additional permissions from that copy, or from any part of
|
||||
it. (Additional permissions may be written to require their own
|
||||
removal in certain cases when you modify the work.) You may place
|
||||
additional permissions on material, added by you to a covered work,
|
||||
for which you have or can give appropriate copyright permission.
|
||||
|
||||
Notwithstanding any other provision of this License, for material you
|
||||
add to a covered work, you may (if authorized by the copyright holders of
|
||||
that material) supplement the terms of this License with terms:
|
||||
|
||||
a) Disclaiming warranty or limiting liability differently from the
|
||||
terms of sections 15 and 16 of this License; or
|
||||
|
||||
b) Requiring preservation of specified reasonable legal notices or
|
||||
author attributions in that material or in the Appropriate Legal
|
||||
Notices displayed by works containing it; or
|
||||
|
||||
c) Prohibiting misrepresentation of the origin of that material, or
|
||||
requiring that modified versions of such material be marked in
|
||||
reasonable ways as different from the original version; or
|
||||
|
||||
d) Limiting the use for publicity purposes of names of licensors or
|
||||
authors of the material; or
|
||||
|
||||
e) Declining to grant rights under trademark law for use of some
|
||||
trade names, trademarks, or service marks; or
|
||||
|
||||
f) Requiring indemnification of licensors and authors of that
|
||||
material by anyone who conveys the material (or modified versions of
|
||||
it) with contractual assumptions of liability to the recipient, for
|
||||
any liability that these contractual assumptions directly impose on
|
||||
those licensors and authors.
|
||||
|
||||
All other non-permissive additional terms are considered "further
|
||||
restrictions" within the meaning of section 10. If the Program as you
|
||||
received it, or any part of it, contains a notice stating that it is
|
||||
governed by this License along with a term that is a further
|
||||
restriction, you may remove that term. If a license document contains
|
||||
a further restriction but permits relicensing or conveying under this
|
||||
License, you may add to a covered work material governed by the terms
|
||||
of that license document, provided that the further restriction does
|
||||
not survive such relicensing or conveying.
|
||||
|
||||
If you add terms to a covered work in accord with this section, you
|
||||
must place, in the relevant source files, a statement of the
|
||||
additional terms that apply to those files, or a notice indicating
|
||||
where to find the applicable terms.
|
||||
|
||||
Additional terms, permissive or non-permissive, may be stated in the
|
||||
form of a separately written license, or stated as exceptions;
|
||||
the above requirements apply either way.
|
||||
|
||||
8. Termination.
|
||||
|
||||
You may not propagate or modify a covered work except as expressly
|
||||
provided under this License. Any attempt otherwise to propagate or
|
||||
modify it is void, and will automatically terminate your rights under
|
||||
this License (including any patent licenses granted under the third
|
||||
paragraph of section 11).
|
||||
|
||||
However, if you cease all violation of this License, then your
|
||||
license from a particular copyright holder is reinstated (a)
|
||||
provisionally, unless and until the copyright holder explicitly and
|
||||
finally terminates your license, and (b) permanently, if the copyright
|
||||
holder fails to notify you of the violation by some reasonable means
|
||||
prior to 60 days after the cessation.
|
||||
|
||||
Moreover, your license from a particular copyright holder is
|
||||
reinstated permanently if the copyright holder notifies you of the
|
||||
violation by some reasonable means, this is the first time you have
|
||||
received notice of violation of this License (for any work) from that
|
||||
copyright holder, and you cure the violation prior to 30 days after
|
||||
your receipt of the notice.
|
||||
|
||||
Termination of your rights under this section does not terminate the
|
||||
licenses of parties who have received copies or rights from you under
|
||||
this License. If your rights have been terminated and not permanently
|
||||
reinstated, you do not qualify to receive new licenses for the same
|
||||
material under section 10.
|
||||
|
||||
9. Acceptance Not Required for Having Copies.
|
||||
|
||||
You are not required to accept this License in order to receive or
|
||||
run a copy of the Program. Ancillary propagation of a covered work
|
||||
occurring solely as a consequence of using peer-to-peer transmission
|
||||
to receive a copy likewise does not require acceptance. However,
|
||||
nothing other than this License grants you permission to propagate or
|
||||
modify any covered work. These actions infringe copyright if you do
|
||||
not accept this License. Therefore, by modifying or propagating a
|
||||
covered work, you indicate your acceptance of this License to do so.
|
||||
|
||||
10. Automatic Licensing of Downstream Recipients.
|
||||
|
||||
Each time you convey a covered work, the recipient automatically
|
||||
receives a license from the original licensors, to run, modify and
|
||||
propagate that work, subject to this License. You are not responsible
|
||||
for enforcing compliance by third parties with this License.
|
||||
|
||||
An "entity transaction" is a transaction transferring control of an
|
||||
organization, or substantially all assets of one, or subdividing an
|
||||
organization, or merging organizations. If propagation of a covered
|
||||
work results from an entity transaction, each party to that
|
||||
transaction who receives a copy of the work also receives whatever
|
||||
licenses to the work the party's predecessor in interest had or could
|
||||
give under the previous paragraph, plus a right to possession of the
|
||||
Corresponding Source of the work from the predecessor in interest, if
|
||||
the predecessor has it or can get it with reasonable efforts.
|
||||
|
||||
You may not impose any further restrictions on the exercise of the
|
||||
rights granted or affirmed under this License. For example, you may
|
||||
not impose a license fee, royalty, or other charge for exercise of
|
||||
rights granted under this License, and you may not initiate litigation
|
||||
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||
any patent claim is infringed by making, using, selling, offering for
|
||||
sale, or importing the Program or any portion of it.
|
||||
|
||||
11. Patents.
|
||||
|
||||
A "contributor" is a copyright holder who authorizes use under this
|
||||
License of the Program or a work on which the Program is based. The
|
||||
work thus licensed is called the contributor's "contributor version".
|
||||
|
||||
A contributor's "essential patent claims" are all patent claims
|
||||
owned or controlled by the contributor, whether already acquired or
|
||||
hereafter acquired, that would be infringed by some manner, permitted
|
||||
by this License, of making, using, or selling its contributor version,
|
||||
but do not include claims that would be infringed only as a
|
||||
consequence of further modification of the contributor version. For
|
||||
purposes of this definition, "control" includes the right to grant
|
||||
patent sublicenses in a manner consistent with the requirements of
|
||||
this License.
|
||||
|
||||
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||
patent license under the contributor's essential patent claims, to
|
||||
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||
propagate the contents of its contributor version.
|
||||
|
||||
In the following three paragraphs, a "patent license" is any express
|
||||
agreement or commitment, however denominated, not to enforce a patent
|
||||
(such as an express permission to practice a patent or covenant not to
|
||||
sue for patent infringement). To "grant" such a patent license to a
|
||||
party means to make such an agreement or commitment not to enforce a
|
||||
patent against the party.
|
||||
|
||||
If you convey a covered work, knowingly relying on a patent license,
|
||||
and the Corresponding Source of the work is not available for anyone
|
||||
to copy, free of charge and under the terms of this License, through a
|
||||
publicly available network server or other readily accessible means,
|
||||
then you must either (1) cause the Corresponding Source to be so
|
||||
available, or (2) arrange to deprive yourself of the benefit of the
|
||||
patent license for this particular work, or (3) arrange, in a manner
|
||||
consistent with the requirements of this License, to extend the patent
|
||||
license to downstream recipients. "Knowingly relying" means you have
|
||||
actual knowledge that, but for the patent license, your conveying the
|
||||
covered work in a country, or your recipient's use of the covered work
|
||||
in a country, would infringe one or more identifiable patents in that
|
||||
country that you have reason to believe are valid.
|
||||
|
||||
If, pursuant to or in connection with a single transaction or
|
||||
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||
covered work, and grant a patent license to some of the parties
|
||||
receiving the covered work authorizing them to use, propagate, modify
|
||||
or convey a specific copy of the covered work, then the patent license
|
||||
you grant is automatically extended to all recipients of the covered
|
||||
work and works based on it.
|
||||
|
||||
A patent license is "discriminatory" if it does not include within
|
||||
the scope of its coverage, prohibits the exercise of, or is
|
||||
conditioned on the non-exercise of one or more of the rights that are
|
||||
specifically granted under this License. You may not convey a covered
|
||||
work if you are a party to an arrangement with a third party that is
|
||||
in the business of distributing software, under which you make payment
|
||||
to the third party based on the extent of your activity of conveying
|
||||
the work, and under which the third party grants, to any of the
|
||||
parties who would receive the covered work from you, a discriminatory
|
||||
patent license (a) in connection with copies of the covered work
|
||||
conveyed by you (or copies made from those copies), or (b) primarily
|
||||
for and in connection with specific products or compilations that
|
||||
contain the covered work, unless you entered into that arrangement,
|
||||
or that patent license was granted, prior to 28 March 2007.
|
||||
|
||||
Nothing in this License shall be construed as excluding or limiting
|
||||
any implied license or other defenses to infringement that may
|
||||
otherwise be available to you under applicable patent law.
|
||||
|
||||
12. No Surrender of Others' Freedom.
|
||||
|
||||
If conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot convey a
|
||||
covered work so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you may
|
||||
not convey it at all. For example, if you agree to terms that obligate you
|
||||
to collect a royalty for further conveying from those to whom you convey
|
||||
the Program, the only way you could satisfy both those terms and this
|
||||
License would be to refrain entirely from conveying the Program.
|
||||
|
||||
13. Use with the GNU Affero General Public License.
|
||||
|
||||
Notwithstanding any other provision of this License, you have
|
||||
permission to link or combine any covered work with a work licensed
|
||||
under version 3 of the GNU Affero General Public License into a single
|
||||
combined work, and to convey the resulting work. The terms of this
|
||||
License will continue to apply to the part which is the covered work,
|
||||
but the special requirements of the GNU Affero General Public License,
|
||||
section 13, concerning interaction through a network will apply to the
|
||||
combination as such.
|
||||
|
||||
14. Revised Versions of this License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions of
|
||||
the GNU General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Program specifies that a certain numbered version of the GNU General
|
||||
Public License "or any later version" applies to it, you have the
|
||||
option of following the terms and conditions either of that numbered
|
||||
version or of any later version published by the Free Software
|
||||
Foundation. If the Program does not specify a version number of the
|
||||
GNU General Public License, you may choose any version ever published
|
||||
by the Free Software Foundation.
|
||||
|
||||
If the Program specifies that a proxy can decide which future
|
||||
versions of the GNU General Public License can be used, that proxy's
|
||||
public statement of acceptance of a version permanently authorizes you
|
||||
to choose that version for the Program.
|
||||
|
||||
Later license versions may give you additional or different
|
||||
permissions. However, no additional obligations are imposed on any
|
||||
author or copyright holder as a result of your choosing to follow a
|
||||
later version.
|
||||
|
||||
15. Disclaimer of Warranty.
|
||||
|
||||
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. Limitation of Liability.
|
||||
|
||||
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGES.
|
||||
|
||||
17. Interpretation of Sections 15 and 16.
|
||||
|
||||
If the disclaimer of warranty and limitation of liability provided
|
||||
above cannot be given local legal effect according to their terms,
|
||||
reviewing courts shall apply local law that most closely approximates
|
||||
an absolute waiver of all civil liability in connection with the
|
||||
Program, unless a warranty or assumption of liability accompanies a
|
||||
copy of the Program in return for a fee.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
15
LICENSE.md
Normal file
15
LICENSE.md
Normal file
@ -0,0 +1,15 @@
|
||||
Software License Agreement (GPLv3 License)
|
||||
========================================
|
||||
|
||||
Copyright (c) 2018-2021 MobileCoin Inc.
|
||||
----------------------------------------------------
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
69
LibMobileCoin.podspec
Normal file
69
LibMobileCoin.podspec
Normal file
@ -0,0 +1,69 @@
|
||||
Pod::Spec.new do |s|
|
||||
|
||||
# ――― Spec Metadata ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
|
||||
|
||||
s.name = "LibMobileCoin"
|
||||
s.version = "1.0.1-pre1"
|
||||
s.summary = "A library for communicating with MobileCoin network"
|
||||
|
||||
s.author = "MobileCoin"
|
||||
s.homepage = "https://www.mobilecoin.com/"
|
||||
|
||||
s.license = { :type => "GPLv3" }
|
||||
|
||||
s.source = { :git => "https://github.com/mobilecoinofficial/libmobilecoin-ios-artifacts.git", :tag => "#{s.version}" }
|
||||
|
||||
|
||||
# ――― Platform Specifics ――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
|
||||
|
||||
s.platform = :ios, "10.0"
|
||||
|
||||
|
||||
# ――― Sources -――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
|
||||
|
||||
s.source_files = [
|
||||
"Artifacts/include/*.h",
|
||||
"Sources/Generated/Proto/*.{grpc,pb}.swift",
|
||||
]
|
||||
|
||||
s.vendored_library = "Artifacts/libmobilecoin.a"
|
||||
|
||||
|
||||
# ――― Dependencies ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
|
||||
|
||||
s.dependency "gRPC-Swift", "~> 1.0.0"
|
||||
s.dependency "SwiftProtobuf", "~> 1.5"
|
||||
|
||||
|
||||
# ――― Project Settings ――――――――――――――――――――――――――――――――――――――――――――――――――――――――― #
|
||||
|
||||
s.swift_version = "5.2"
|
||||
|
||||
s.pod_target_xcconfig = {
|
||||
# Rust bitcode is not verified to be compatible with Apple Xcode's LLVM bitcode,
|
||||
# so this is disabled to be on the safe side.
|
||||
"ENABLE_BITCODE" => "NO",
|
||||
# HACK: this forces the libmobilecoin.a static archive to be included when the
|
||||
# linker is linking LibMobileCoin as a shared framework
|
||||
"OTHER_LDFLAGS" => "-u _mc_string_free",
|
||||
# Mac Catalyst is not supported since this library includes a vendored binary
|
||||
# that only includes support for iOS archictures.
|
||||
"SUPPORTS_MACCATALYST" => "NO",
|
||||
# The vendored binary doesn't include support for 32-bit architectures or arm64
|
||||
# for iphonesimulator. This must be manually configured to avoid Xcode's default
|
||||
# setting of building 32-bit and Xcode 12's default setting of including the
|
||||
# arm64 simulator. Note: 32-bit is officially dropped in iOS 11
|
||||
"VALID_ARCHS[sdk=iphoneos*]" => "arm64",
|
||||
"VALID_ARCHS[sdk=iphonesimulator*]" => "x86_64",
|
||||
}
|
||||
|
||||
# `user_target_xcconfig` should only be set when the setting needs to propogate to
|
||||
# all targets that depend on this library.
|
||||
s.user_target_xcconfig = {
|
||||
"ENABLE_BITCODE" => "NO",
|
||||
"SUPPORTS_MACCATALYST" => "NO",
|
||||
"VALID_ARCHS[sdk=iphoneos*]" => "arm64",
|
||||
"VALID_ARCHS[sdk=iphonesimulator*]" => "x86_64",
|
||||
}
|
||||
|
||||
end
|
||||
60
Makefile
Normal file
60
Makefile
Normal file
@ -0,0 +1,60 @@
|
||||
FOG_DIR = Vendor/fog
|
||||
LIBMOBILECOIN_LIB_DIR = $(FOG_DIR)/libmobilecoin
|
||||
LIBMOBILECOIN_ARTIFACTS_DIR = $(LIBMOBILECOIN_LIB_DIR)/out/ios
|
||||
ARTIFACTS_DIR = Artifacts
|
||||
IOS_TARGETS = x86_64-apple-ios aarch64-apple-ios
|
||||
|
||||
.PHONY: default
|
||||
default: setup build generate
|
||||
|
||||
.PHONY: setup
|
||||
setup:
|
||||
cd "$(FOG_DIR)" && rustup target add $(IOS_TARGETS)
|
||||
bundle install
|
||||
|
||||
# Unexport conditional environment variables so the build is more predictable
|
||||
unexport SGX_MODE
|
||||
unexport IAS_MODE
|
||||
unexport CARGO_BUILD_FLAGS
|
||||
unexport CARGO_TARGET_DIR
|
||||
unexport CARGO_PROFILE
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
cd "$(LIBMOBILECOIN_LIB_DIR)" && $(MAKE) ios
|
||||
rm -r "$(ARTIFACTS_DIR)" 2>/dev/null || true
|
||||
mkdir -p "$(ARTIFACTS_DIR)"
|
||||
cp -R "$(LIBMOBILECOIN_ARTIFACTS_DIR)/" "$(ARTIFACTS_DIR)"
|
||||
|
||||
.PHONY: generate
|
||||
generate:
|
||||
rm -r Sources/Generated/Proto 2>/dev/null || true
|
||||
docker build . \
|
||||
--build-arg grpc_swift_version=1.0.0 \
|
||||
--output .
|
||||
|
||||
.PHONY: lint
|
||||
lint: lint-podspec
|
||||
|
||||
.PHONY: publish
|
||||
publish: tag-release publish-podspec
|
||||
|
||||
# Release
|
||||
|
||||
.PHONY: tag-release
|
||||
tag-release:
|
||||
@[[ "$$(git rev-parse --abbrev-ref HEAD)" == "master" ]] || \
|
||||
{ echo 'Error: Must be on branch "master" when tagging a release.'; exit 1; }
|
||||
VERSION="$$(bundle exec pod ipc spec LibMobileCoin.podspec | jq -r '.version')" && \
|
||||
git tag "$$VERSION" && \
|
||||
git push git@github.com:mobilecoinofficial/libmobilecoin-ios-artifacts.git "refs/tags/$$VERSION"
|
||||
|
||||
# LibMobileCoin pod
|
||||
|
||||
.PHONY: lint-podspec
|
||||
lint-podspec:
|
||||
bundle exec pod spec lint LibMobileCoin.podspec --allow-warnings
|
||||
|
||||
.PHONY: publish-podspec
|
||||
publish-podspec:
|
||||
bundle exec pod trunk push LibMobileCoin.podspec --allow-warnings
|
||||
58
README.md
Normal file
58
README.md
Normal file
@ -0,0 +1,58 @@
|
||||

|
||||
|
||||
# libmobilecoin-ios-artifacts
|
||||
|
||||
MobileCoin is a privacy-preserving payments network designed for use on mobile devices.
|
||||
|
||||
# Sending your First Payment
|
||||
|
||||
* You must read and accept the [Terms of Use for MobileCoins and MobileCoin Wallets](./TERMS-OF-USE.md) to use MobileCoin Software.
|
||||
* Please note that currently, MobileCoin Wallets are not available for download or use by U.S. persons or entities, persons or entities located in the U.S., or persons or entities in other prohibited jurisdictions.
|
||||
|
||||
### Note to Developers
|
||||
|
||||
* MobileCoin is a prototype. Expect substantial changes before the release.
|
||||
* Please see [*CONTRIBUTING.md*](./CONTRIBUTING.md) for notes on contributing bug reports and code.
|
||||
|
||||
# Table of Contents
|
||||
- [License](#license)
|
||||
- [Cryptography Notice](#cryptography-notice)
|
||||
- [Repository Structure](#repository-structure)
|
||||
- [Overview](#overview)
|
||||
- [Support](#support)
|
||||
- [Trademarks](#trademarks)
|
||||
|
||||
## License
|
||||
|
||||
MobileCoin is available under open-source licenses. Please read the [*LICENSE.md*](./LICENSE.md) and corresponding [*LICENSE*](./LICENSE).
|
||||
|
||||
## Cryptography Notice
|
||||
This distribution includes cryptographic software. Your country may have restrictions on the use of encryption software.
|
||||
Please check your country's laws before downloading or using this software.
|
||||
|
||||
## Repository Structure
|
||||
|Directory |Description |
|
||||
| :-- | :-- |
|
||||
| [Artifacts](./Artifacts) | The libmobilecoin library. |
|
||||
| [Sources](./Sources) | Autogenerated grpc protobufs. |
|
||||
| [Vendor](./Vendor) | Fog submodule. |
|
||||
|
||||
## Overview
|
||||
|
||||
MobileCoin is a payment network with no central authority. The fundamental goal of the network is to safely and
|
||||
efficiently enable the exchange of value, represented as fractional ownership of the total value of the network.
|
||||
Like most cryptocurrencies, MobileCoin maintains a permanent and immutable record of all successfully completed
|
||||
payments in a blockchain data structure. Cryptography is used extensively to establish ownership, control transfers,
|
||||
and to preserve cash-like privacy for users.
|
||||
|
||||
For more information about the cryptocurrency, see [MobileCoinFoundation/MobileCoin](https://github.com/mobilecoinfoundation/mobilecoin).
|
||||
|
||||
## Support
|
||||
|
||||
For troubleshooting help and other questions, please visit our [community forum](https://community.mobilecoin.foundation/).
|
||||
|
||||
You can also open a technical support ticket via [email](mailto://support@mobilecoin.com).
|
||||
|
||||
#### Trademarks
|
||||
|
||||
MobileCoin is a registered trademark of MobileCoin Inc.
|
||||
105
Sources/Generated/Proto/attest.grpc.swift
Normal file
105
Sources/Generated/Proto/attest.grpc.swift
Normal file
@ -0,0 +1,105 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// Source: attest.proto
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright 2018, gRPC Authors All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
import GRPC
|
||||
import NIO
|
||||
import SwiftProtobuf
|
||||
|
||||
|
||||
//// A server-authenticated service for SGX enclaves. The responder is the
|
||||
//// attesting enclave, and the client is unauthenticated. When described
|
||||
//// within the noise protocol, this is similar to the "IX" style key exchange:
|
||||
////
|
||||
//// ```txt
|
||||
//// IX:
|
||||
//// -> e, s
|
||||
//// <- e, ee, se, s, es
|
||||
//// ->
|
||||
//// <-
|
||||
//// ```
|
||||
////
|
||||
//// The first two messages are contained within the Auth and AuthResponse
|
||||
///
|
||||
/// Usage: instantiate `Attest_AttestedApiClient`, then call methods of this protocol to make API calls.
|
||||
public protocol Attest_AttestedApiClientProtocol: GRPCClient {
|
||||
var serviceName: String { get }
|
||||
var interceptors: Attest_AttestedApiClientInterceptorFactoryProtocol? { get }
|
||||
|
||||
func auth(
|
||||
_ request: Attest_AuthMessage,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<Attest_AuthMessage, Attest_AuthMessage>
|
||||
}
|
||||
|
||||
extension Attest_AttestedApiClientProtocol {
|
||||
public var serviceName: String {
|
||||
return "attest.AttestedApi"
|
||||
}
|
||||
|
||||
//// This API call is made when one enclave wants to start a mutually-
|
||||
//// authenticated key-exchange session with an enclave.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to Auth.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func auth(
|
||||
_ request: Attest_AuthMessage,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<Attest_AuthMessage, Attest_AuthMessage> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/attest.AttestedApi/Auth",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeAuthInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public protocol Attest_AttestedApiClientInterceptorFactoryProtocol {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'auth'.
|
||||
func makeAuthInterceptors() -> [ClientInterceptor<Attest_AuthMessage, Attest_AuthMessage>]
|
||||
}
|
||||
|
||||
public final class Attest_AttestedApiClient: Attest_AttestedApiClientProtocol {
|
||||
public let channel: GRPCChannel
|
||||
public var defaultCallOptions: CallOptions
|
||||
public var interceptors: Attest_AttestedApiClientInterceptorFactoryProtocol?
|
||||
|
||||
/// Creates a client for the attest.AttestedApi service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - channel: `GRPCChannel` to the service host.
|
||||
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
||||
/// - interceptors: A factory providing interceptors for each RPC.
|
||||
public init(
|
||||
channel: GRPCChannel,
|
||||
defaultCallOptions: CallOptions = CallOptions(),
|
||||
interceptors: Attest_AttestedApiClientInterceptorFactoryProtocol? = nil
|
||||
) {
|
||||
self.channel = channel
|
||||
self.defaultCallOptions = defaultCallOptions
|
||||
self.interceptors = interceptors
|
||||
}
|
||||
}
|
||||
|
||||
146
Sources/Generated/Proto/attest.pb.swift
Normal file
146
Sources/Generated/Proto/attest.pb.swift
Normal file
@ -0,0 +1,146 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: attest.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
//// This file defines the API to allow for a client to conduct an authenticated
|
||||
//// key exchange using a derivative of the noise protocol
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
//// The first message of an exchange, sent by a client.
|
||||
////
|
||||
//// This contains the client's one-time ephemeral public key, and the
|
||||
//// cryptographic parameters which will be used in future messages.
|
||||
public struct Attest_AuthMessage {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// A potentially encrypted bytestream containing opaque data intended
|
||||
//// for use in the enclave.
|
||||
public var data: Data = Data()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
//// AEAD messages sent to and from authenticated clients.
|
||||
public struct Attest_Message {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// A byte array containing plaintext authenticated data.
|
||||
public var aad: Data = Data()
|
||||
|
||||
//// An byte array containing the channel ID this message is
|
||||
//// associated with. A zero-length channel ID is not valid.
|
||||
public var channelID: Data = Data()
|
||||
|
||||
//// A potentially encrypted bytestream containing opaque data intended
|
||||
//// for use in the enclave.
|
||||
public var data: Data = Data()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "attest"
|
||||
|
||||
extension Attest_AuthMessage: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".AuthMessage"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "data"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBytesField(value: &self.data) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.data.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.data, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Attest_AuthMessage, rhs: Attest_AuthMessage) -> Bool {
|
||||
if lhs.data != rhs.data {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Attest_Message: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".Message"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "aad"),
|
||||
2: .standard(proto: "channel_id"),
|
||||
3: .same(proto: "data"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBytesField(value: &self.aad) }()
|
||||
case 2: try { try decoder.decodeSingularBytesField(value: &self.channelID) }()
|
||||
case 3: try { try decoder.decodeSingularBytesField(value: &self.data) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.aad.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.aad, fieldNumber: 1)
|
||||
}
|
||||
if !self.channelID.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.channelID, fieldNumber: 2)
|
||||
}
|
||||
if !self.data.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.data, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Attest_Message, rhs: Attest_Message) -> Bool {
|
||||
if lhs.aad != rhs.aad {return false}
|
||||
if lhs.channelID != rhs.channelID {return false}
|
||||
if lhs.data != rhs.data {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
601
Sources/Generated/Proto/blockchain.pb.swift
Normal file
601
Sources/Generated/Proto/blockchain.pb.swift
Normal file
@ -0,0 +1,601 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: blockchain.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
// Blockchain-related data types.
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
/// Block ID.
|
||||
public struct Blockchain_BlockID {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var data: Data = Data()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/// Hash of the block's contents.
|
||||
public struct Blockchain_BlockContentsHash {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var data: Data = Data()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/// A block in the blockchain.
|
||||
public struct Blockchain_Block {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
/// Block ID.
|
||||
public var id: Blockchain_BlockID {
|
||||
get {return _id ?? Blockchain_BlockID()}
|
||||
set {_id = newValue}
|
||||
}
|
||||
/// Returns true if `id` has been explicitly set.
|
||||
public var hasID: Bool {return self._id != nil}
|
||||
/// Clears the value of `id`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearID() {self._id = nil}
|
||||
|
||||
/// Block format version.
|
||||
public var version: UInt32 = 0
|
||||
|
||||
/// Id of the previous block.
|
||||
public var parentID: Blockchain_BlockID {
|
||||
get {return _parentID ?? Blockchain_BlockID()}
|
||||
set {_parentID = newValue}
|
||||
}
|
||||
/// Returns true if `parentID` has been explicitly set.
|
||||
public var hasParentID: Bool {return self._parentID != nil}
|
||||
/// Clears the value of `parentID`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearParentID() {self._parentID = nil}
|
||||
|
||||
/// The index of this block in the blockchain.
|
||||
public var index: UInt64 = 0
|
||||
|
||||
/// The cumulative number of TXOs in the blockchain, including this block
|
||||
public var cumulativeTxoCount: UInt64 = 0
|
||||
|
||||
/// Root hash of the membership proofs provided by the untrusted local system for validation.
|
||||
/// This captures the state of all TxOuts in the ledger that this block was validated against.
|
||||
public var rootElement: External_TxOutMembershipElement {
|
||||
get {return _rootElement ?? External_TxOutMembershipElement()}
|
||||
set {_rootElement = newValue}
|
||||
}
|
||||
/// Returns true if `rootElement` has been explicitly set.
|
||||
public var hasRootElement: Bool {return self._rootElement != nil}
|
||||
/// Clears the value of `rootElement`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearRootElement() {self._rootElement = nil}
|
||||
|
||||
/// Hash of the block's contents.
|
||||
public var contentsHash: Blockchain_BlockContentsHash {
|
||||
get {return _contentsHash ?? Blockchain_BlockContentsHash()}
|
||||
set {_contentsHash = newValue}
|
||||
}
|
||||
/// Returns true if `contentsHash` has been explicitly set.
|
||||
public var hasContentsHash: Bool {return self._contentsHash != nil}
|
||||
/// Clears the value of `contentsHash`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearContentsHash() {self._contentsHash = nil}
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _id: Blockchain_BlockID? = nil
|
||||
fileprivate var _parentID: Blockchain_BlockID? = nil
|
||||
fileprivate var _rootElement: External_TxOutMembershipElement? = nil
|
||||
fileprivate var _contentsHash: Blockchain_BlockContentsHash? = nil
|
||||
}
|
||||
|
||||
public struct Blockchain_BlockContents {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
/// Key images spent in this block.
|
||||
public var keyImages: [External_KeyImage] = []
|
||||
|
||||
/// Outputs created in this block.
|
||||
public var outputs: [External_TxOut] = []
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public struct Blockchain_BlockSignature {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
/// The signature of the block.
|
||||
public var signature: External_Ed25519Signature {
|
||||
get {return _signature ?? External_Ed25519Signature()}
|
||||
set {_signature = newValue}
|
||||
}
|
||||
/// Returns true if `signature` has been explicitly set.
|
||||
public var hasSignature: Bool {return self._signature != nil}
|
||||
/// Clears the value of `signature`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearSignature() {self._signature = nil}
|
||||
|
||||
/// The signer that generated the above signature.
|
||||
public var signer: External_Ed25519Public {
|
||||
get {return _signer ?? External_Ed25519Public()}
|
||||
set {_signer = newValue}
|
||||
}
|
||||
/// Returns true if `signer` has been explicitly set.
|
||||
public var hasSigner: Bool {return self._signer != nil}
|
||||
/// Clears the value of `signer`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearSigner() {self._signer = nil}
|
||||
|
||||
/// An approximate time in which the block was signed.
|
||||
/// Represented as seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
|
||||
public var signedAt: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _signature: External_Ed25519Signature? = nil
|
||||
fileprivate var _signer: External_Ed25519Public? = nil
|
||||
}
|
||||
|
||||
/// Version 1 of an archived block.
|
||||
public struct Blockchain_ArchiveBlockV1 {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
/// Block
|
||||
public var block: Blockchain_Block {
|
||||
get {return _block ?? Blockchain_Block()}
|
||||
set {_block = newValue}
|
||||
}
|
||||
/// Returns true if `block` has been explicitly set.
|
||||
public var hasBlock: Bool {return self._block != nil}
|
||||
/// Clears the value of `block`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearBlock() {self._block = nil}
|
||||
|
||||
/// Contents of the block.
|
||||
public var blockContents: Blockchain_BlockContents {
|
||||
get {return _blockContents ?? Blockchain_BlockContents()}
|
||||
set {_blockContents = newValue}
|
||||
}
|
||||
/// Returns true if `blockContents` has been explicitly set.
|
||||
public var hasBlockContents: Bool {return self._blockContents != nil}
|
||||
/// Clears the value of `blockContents`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearBlockContents() {self._blockContents = nil}
|
||||
|
||||
/// Block signature, when available.
|
||||
public var signature: Blockchain_BlockSignature {
|
||||
get {return _signature ?? Blockchain_BlockSignature()}
|
||||
set {_signature = newValue}
|
||||
}
|
||||
/// Returns true if `signature` has been explicitly set.
|
||||
public var hasSignature: Bool {return self._signature != nil}
|
||||
/// Clears the value of `signature`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearSignature() {self._signature = nil}
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _block: Blockchain_Block? = nil
|
||||
fileprivate var _blockContents: Blockchain_BlockContents? = nil
|
||||
fileprivate var _signature: Blockchain_BlockSignature? = nil
|
||||
}
|
||||
|
||||
/// An archived block.
|
||||
public struct Blockchain_ArchiveBlock {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var block: Blockchain_ArchiveBlock.OneOf_Block? = nil
|
||||
|
||||
public var v1: Blockchain_ArchiveBlockV1 {
|
||||
get {
|
||||
if case .v1(let v)? = block {return v}
|
||||
return Blockchain_ArchiveBlockV1()
|
||||
}
|
||||
set {block = .v1(newValue)}
|
||||
}
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public enum OneOf_Block: Equatable {
|
||||
case v1(Blockchain_ArchiveBlockV1)
|
||||
|
||||
#if !swift(>=4.1)
|
||||
public static func ==(lhs: Blockchain_ArchiveBlock.OneOf_Block, rhs: Blockchain_ArchiveBlock.OneOf_Block) -> Bool {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch (lhs, rhs) {
|
||||
case (.v1, .v1): return {
|
||||
guard case .v1(let l) = lhs, case .v1(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/// A collection of archived blocks.
|
||||
public struct Blockchain_ArchiveBlocks {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var blocks: [Blockchain_ArchiveBlock] = []
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "blockchain"
|
||||
|
||||
extension Blockchain_BlockID: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".BlockID"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "data"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBytesField(value: &self.data) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.data.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.data, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Blockchain_BlockID, rhs: Blockchain_BlockID) -> Bool {
|
||||
if lhs.data != rhs.data {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Blockchain_BlockContentsHash: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".BlockContentsHash"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "data"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBytesField(value: &self.data) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.data.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.data, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Blockchain_BlockContentsHash, rhs: Blockchain_BlockContentsHash) -> Bool {
|
||||
if lhs.data != rhs.data {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Blockchain_Block: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".Block"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "id"),
|
||||
2: .same(proto: "version"),
|
||||
3: .standard(proto: "parent_id"),
|
||||
4: .same(proto: "index"),
|
||||
5: .standard(proto: "cumulative_txo_count"),
|
||||
6: .standard(proto: "root_element"),
|
||||
7: .standard(proto: "contents_hash"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularMessageField(value: &self._id) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.version) }()
|
||||
case 3: try { try decoder.decodeSingularMessageField(value: &self._parentID) }()
|
||||
case 4: try { try decoder.decodeSingularUInt64Field(value: &self.index) }()
|
||||
case 5: try { try decoder.decodeSingularUInt64Field(value: &self.cumulativeTxoCount) }()
|
||||
case 6: try { try decoder.decodeSingularMessageField(value: &self._rootElement) }()
|
||||
case 7: try { try decoder.decodeSingularMessageField(value: &self._contentsHash) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if let v = self._id {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if self.version != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.version, fieldNumber: 2)
|
||||
}
|
||||
if let v = self._parentID {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}
|
||||
if self.index != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.index, fieldNumber: 4)
|
||||
}
|
||||
if self.cumulativeTxoCount != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.cumulativeTxoCount, fieldNumber: 5)
|
||||
}
|
||||
if let v = self._rootElement {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 6)
|
||||
}
|
||||
if let v = self._contentsHash {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 7)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Blockchain_Block, rhs: Blockchain_Block) -> Bool {
|
||||
if lhs._id != rhs._id {return false}
|
||||
if lhs.version != rhs.version {return false}
|
||||
if lhs._parentID != rhs._parentID {return false}
|
||||
if lhs.index != rhs.index {return false}
|
||||
if lhs.cumulativeTxoCount != rhs.cumulativeTxoCount {return false}
|
||||
if lhs._rootElement != rhs._rootElement {return false}
|
||||
if lhs._contentsHash != rhs._contentsHash {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Blockchain_BlockContents: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".BlockContents"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "key_images"),
|
||||
2: .same(proto: "outputs"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.keyImages) }()
|
||||
case 2: try { try decoder.decodeRepeatedMessageField(value: &self.outputs) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.keyImages.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.keyImages, fieldNumber: 1)
|
||||
}
|
||||
if !self.outputs.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.outputs, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Blockchain_BlockContents, rhs: Blockchain_BlockContents) -> Bool {
|
||||
if lhs.keyImages != rhs.keyImages {return false}
|
||||
if lhs.outputs != rhs.outputs {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Blockchain_BlockSignature: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".BlockSignature"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "signature"),
|
||||
2: .same(proto: "signer"),
|
||||
3: .standard(proto: "signed_at"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularMessageField(value: &self._signature) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._signer) }()
|
||||
case 3: try { try decoder.decodeSingularUInt64Field(value: &self.signedAt) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if let v = self._signature {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if let v = self._signer {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}
|
||||
if self.signedAt != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.signedAt, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Blockchain_BlockSignature, rhs: Blockchain_BlockSignature) -> Bool {
|
||||
if lhs._signature != rhs._signature {return false}
|
||||
if lhs._signer != rhs._signer {return false}
|
||||
if lhs.signedAt != rhs.signedAt {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Blockchain_ArchiveBlockV1: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".ArchiveBlockV1"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "block"),
|
||||
2: .standard(proto: "block_contents"),
|
||||
3: .same(proto: "signature"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularMessageField(value: &self._block) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._blockContents) }()
|
||||
case 3: try { try decoder.decodeSingularMessageField(value: &self._signature) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if let v = self._block {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if let v = self._blockContents {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}
|
||||
if let v = self._signature {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Blockchain_ArchiveBlockV1, rhs: Blockchain_ArchiveBlockV1) -> Bool {
|
||||
if lhs._block != rhs._block {return false}
|
||||
if lhs._blockContents != rhs._blockContents {return false}
|
||||
if lhs._signature != rhs._signature {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Blockchain_ArchiveBlock: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".ArchiveBlock"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "v1"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try {
|
||||
var v: Blockchain_ArchiveBlockV1?
|
||||
if let current = self.block {
|
||||
try decoder.handleConflictingOneOf()
|
||||
if case .v1(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {self.block = .v1(v)}
|
||||
}()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if case .v1(let v)? = self.block {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Blockchain_ArchiveBlock, rhs: Blockchain_ArchiveBlock) -> Bool {
|
||||
if lhs.block != rhs.block {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Blockchain_ArchiveBlocks: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".ArchiveBlocks"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "blocks"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.blocks) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.blocks.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.blocks, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Blockchain_ArchiveBlocks, rhs: Blockchain_ArchiveBlocks) -> Bool {
|
||||
if lhs.blocks != rhs.blocks {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
91
Sources/Generated/Proto/consensus_client.grpc.swift
Normal file
91
Sources/Generated/Proto/consensus_client.grpc.swift
Normal file
@ -0,0 +1,91 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// Source: consensus_client.proto
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright 2018, gRPC Authors All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
import GRPC
|
||||
import NIO
|
||||
import SwiftProtobuf
|
||||
|
||||
|
||||
/// Usage: instantiate `ConsensusClient_ConsensusClientAPIClient`, then call methods of this protocol to make API calls.
|
||||
public protocol ConsensusClient_ConsensusClientAPIClientProtocol: GRPCClient {
|
||||
var serviceName: String { get }
|
||||
var interceptors: ConsensusClient_ConsensusClientAPIClientInterceptorFactoryProtocol? { get }
|
||||
|
||||
func clientTxPropose(
|
||||
_ request: Attest_Message,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<Attest_Message, ConsensusCommon_ProposeTxResponse>
|
||||
}
|
||||
|
||||
extension ConsensusClient_ConsensusClientAPIClientProtocol {
|
||||
public var serviceName: String {
|
||||
return "consensus_client.ConsensusClientAPI"
|
||||
}
|
||||
|
||||
//// This API call is made with an encrypted payload for the enclave,
|
||||
//// indicating a new value to be acted upon.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to ClientTxPropose.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func clientTxPropose(
|
||||
_ request: Attest_Message,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<Attest_Message, ConsensusCommon_ProposeTxResponse> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/consensus_client.ConsensusClientAPI/ClientTxPropose",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeClientTxProposeInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public protocol ConsensusClient_ConsensusClientAPIClientInterceptorFactoryProtocol {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'clientTxPropose'.
|
||||
func makeClientTxProposeInterceptors() -> [ClientInterceptor<Attest_Message, ConsensusCommon_ProposeTxResponse>]
|
||||
}
|
||||
|
||||
public final class ConsensusClient_ConsensusClientAPIClient: ConsensusClient_ConsensusClientAPIClientProtocol {
|
||||
public let channel: GRPCChannel
|
||||
public var defaultCallOptions: CallOptions
|
||||
public var interceptors: ConsensusClient_ConsensusClientAPIClientInterceptorFactoryProtocol?
|
||||
|
||||
/// Creates a client for the consensus_client.ConsensusClientAPI service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - channel: `GRPCChannel` to the service host.
|
||||
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
||||
/// - interceptors: A factory providing interceptors for each RPC.
|
||||
public init(
|
||||
channel: GRPCChannel,
|
||||
defaultCallOptions: CallOptions = CallOptions(),
|
||||
interceptors: ConsensusClient_ConsensusClientAPIClientInterceptorFactoryProtocol? = nil
|
||||
) {
|
||||
self.channel = channel
|
||||
self.defaultCallOptions = defaultCallOptions
|
||||
self.interceptors = interceptors
|
||||
}
|
||||
}
|
||||
|
||||
25
Sources/Generated/Proto/consensus_client.pb.swift
Normal file
25
Sources/Generated/Proto/consensus_client.pb.swift
Normal file
@ -0,0 +1,25 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: consensus_client.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
// Consensus service client-facing data types and service descriptors.
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
118
Sources/Generated/Proto/consensus_common.grpc.swift
Normal file
118
Sources/Generated/Proto/consensus_common.grpc.swift
Normal file
@ -0,0 +1,118 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// Source: consensus_common.proto
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright 2018, gRPC Authors All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
import GRPC
|
||||
import NIO
|
||||
import SwiftProtobuf
|
||||
|
||||
|
||||
//// Blockchain API shared between clients and peers.
|
||||
///
|
||||
/// Usage: instantiate `ConsensusCommon_BlockchainAPIClient`, then call methods of this protocol to make API calls.
|
||||
public protocol ConsensusCommon_BlockchainAPIClientProtocol: GRPCClient {
|
||||
var serviceName: String { get }
|
||||
var interceptors: ConsensusCommon_BlockchainAPIClientInterceptorFactoryProtocol? { get }
|
||||
|
||||
func getLastBlockInfo(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, ConsensusCommon_LastBlockInfoResponse>
|
||||
|
||||
func getBlocks(
|
||||
_ request: ConsensusCommon_BlocksRequest,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<ConsensusCommon_BlocksRequest, ConsensusCommon_BlocksResponse>
|
||||
}
|
||||
|
||||
extension ConsensusCommon_BlockchainAPIClientProtocol {
|
||||
public var serviceName: String {
|
||||
return "consensus_common.BlockchainAPI"
|
||||
}
|
||||
|
||||
/// Unary call to GetLastBlockInfo
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to GetLastBlockInfo.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func getLastBlockInfo(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, ConsensusCommon_LastBlockInfoResponse> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/consensus_common.BlockchainAPI/GetLastBlockInfo",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeGetLastBlockInfoInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
/// Unary call to GetBlocks
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to GetBlocks.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func getBlocks(
|
||||
_ request: ConsensusCommon_BlocksRequest,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<ConsensusCommon_BlocksRequest, ConsensusCommon_BlocksResponse> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/consensus_common.BlockchainAPI/GetBlocks",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeGetBlocksInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public protocol ConsensusCommon_BlockchainAPIClientInterceptorFactoryProtocol {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'getLastBlockInfo'.
|
||||
func makeGetLastBlockInfoInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, ConsensusCommon_LastBlockInfoResponse>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'getBlocks'.
|
||||
func makeGetBlocksInterceptors() -> [ClientInterceptor<ConsensusCommon_BlocksRequest, ConsensusCommon_BlocksResponse>]
|
||||
}
|
||||
|
||||
public final class ConsensusCommon_BlockchainAPIClient: ConsensusCommon_BlockchainAPIClientProtocol {
|
||||
public let channel: GRPCChannel
|
||||
public var defaultCallOptions: CallOptions
|
||||
public var interceptors: ConsensusCommon_BlockchainAPIClientInterceptorFactoryProtocol?
|
||||
|
||||
/// Creates a client for the consensus_common.BlockchainAPI service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - channel: `GRPCChannel` to the service host.
|
||||
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
||||
/// - interceptors: A factory providing interceptors for each RPC.
|
||||
public init(
|
||||
channel: GRPCChannel,
|
||||
defaultCallOptions: CallOptions = CallOptions(),
|
||||
interceptors: ConsensusCommon_BlockchainAPIClientInterceptorFactoryProtocol? = nil
|
||||
) {
|
||||
self.channel = channel
|
||||
self.defaultCallOptions = defaultCallOptions
|
||||
self.interceptors = interceptors
|
||||
}
|
||||
}
|
||||
|
||||
423
Sources/Generated/Proto/consensus_common.pb.swift
Normal file
423
Sources/Generated/Proto/consensus_common.pb.swift
Normal file
@ -0,0 +1,423 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: consensus_common.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
// Consensus service data types used by both client-facing and peer-facing APIs.
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
//// Result of ProposeTx call that cannot be represented by a built-in GRPC error code.
|
||||
public enum ConsensusCommon_ProposeTxResult: SwiftProtobuf.Enum {
|
||||
public typealias RawValue = Int
|
||||
case ok // = 0
|
||||
case inputsProofsLengthMismatch // = 10
|
||||
case noInputs // = 11
|
||||
case tooManyInputs // = 12
|
||||
case insufficientInputSignatures // = 13
|
||||
case invalidInputSignature // = 14
|
||||
case invalidTransactionSignature // = 15
|
||||
case invalidRangeProof // = 16
|
||||
case insufficientRingSize // = 17
|
||||
case tombstoneBlockExceeded // = 18
|
||||
case tombstoneBlockTooFar // = 19
|
||||
case noOutputs // = 20
|
||||
case tooManyOutputs // = 21
|
||||
case excessiveRingSize // = 22
|
||||
case duplicateRingElements // = 23
|
||||
case unsortedRingElements // = 24
|
||||
case unequalRingSizes // = 25
|
||||
case unsortedKeyImages // = 26
|
||||
case containsSpentKeyImage // = 27
|
||||
case duplicateKeyImages // = 28
|
||||
case duplicateOutputPublicKey // = 29
|
||||
case containsExistingOutputPublicKey // = 30
|
||||
case missingTxOutMembershipProof // = 31
|
||||
case invalidTxOutMembershipProof // = 32
|
||||
case invalidRistrettoPublicKey // = 33
|
||||
case invalidLedgerContext // = 34
|
||||
case ledger // = 35
|
||||
case membershipProofValidationError // = 36
|
||||
case txFeeError // = 37
|
||||
case keyError // = 38
|
||||
case unsortedInputs // = 39
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
public init() {
|
||||
self = .ok
|
||||
}
|
||||
|
||||
public init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .ok
|
||||
case 10: self = .inputsProofsLengthMismatch
|
||||
case 11: self = .noInputs
|
||||
case 12: self = .tooManyInputs
|
||||
case 13: self = .insufficientInputSignatures
|
||||
case 14: self = .invalidInputSignature
|
||||
case 15: self = .invalidTransactionSignature
|
||||
case 16: self = .invalidRangeProof
|
||||
case 17: self = .insufficientRingSize
|
||||
case 18: self = .tombstoneBlockExceeded
|
||||
case 19: self = .tombstoneBlockTooFar
|
||||
case 20: self = .noOutputs
|
||||
case 21: self = .tooManyOutputs
|
||||
case 22: self = .excessiveRingSize
|
||||
case 23: self = .duplicateRingElements
|
||||
case 24: self = .unsortedRingElements
|
||||
case 25: self = .unequalRingSizes
|
||||
case 26: self = .unsortedKeyImages
|
||||
case 27: self = .containsSpentKeyImage
|
||||
case 28: self = .duplicateKeyImages
|
||||
case 29: self = .duplicateOutputPublicKey
|
||||
case 30: self = .containsExistingOutputPublicKey
|
||||
case 31: self = .missingTxOutMembershipProof
|
||||
case 32: self = .invalidTxOutMembershipProof
|
||||
case 33: self = .invalidRistrettoPublicKey
|
||||
case 34: self = .invalidLedgerContext
|
||||
case 35: self = .ledger
|
||||
case 36: self = .membershipProofValidationError
|
||||
case 37: self = .txFeeError
|
||||
case 38: self = .keyError
|
||||
case 39: self = .unsortedInputs
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
public var rawValue: Int {
|
||||
switch self {
|
||||
case .ok: return 0
|
||||
case .inputsProofsLengthMismatch: return 10
|
||||
case .noInputs: return 11
|
||||
case .tooManyInputs: return 12
|
||||
case .insufficientInputSignatures: return 13
|
||||
case .invalidInputSignature: return 14
|
||||
case .invalidTransactionSignature: return 15
|
||||
case .invalidRangeProof: return 16
|
||||
case .insufficientRingSize: return 17
|
||||
case .tombstoneBlockExceeded: return 18
|
||||
case .tombstoneBlockTooFar: return 19
|
||||
case .noOutputs: return 20
|
||||
case .tooManyOutputs: return 21
|
||||
case .excessiveRingSize: return 22
|
||||
case .duplicateRingElements: return 23
|
||||
case .unsortedRingElements: return 24
|
||||
case .unequalRingSizes: return 25
|
||||
case .unsortedKeyImages: return 26
|
||||
case .containsSpentKeyImage: return 27
|
||||
case .duplicateKeyImages: return 28
|
||||
case .duplicateOutputPublicKey: return 29
|
||||
case .containsExistingOutputPublicKey: return 30
|
||||
case .missingTxOutMembershipProof: return 31
|
||||
case .invalidTxOutMembershipProof: return 32
|
||||
case .invalidRistrettoPublicKey: return 33
|
||||
case .invalidLedgerContext: return 34
|
||||
case .ledger: return 35
|
||||
case .membershipProofValidationError: return 36
|
||||
case .txFeeError: return 37
|
||||
case .keyError: return 38
|
||||
case .unsortedInputs: return 39
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension ConsensusCommon_ProposeTxResult: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
public static var allCases: [ConsensusCommon_ProposeTxResult] = [
|
||||
.ok,
|
||||
.inputsProofsLengthMismatch,
|
||||
.noInputs,
|
||||
.tooManyInputs,
|
||||
.insufficientInputSignatures,
|
||||
.invalidInputSignature,
|
||||
.invalidTransactionSignature,
|
||||
.invalidRangeProof,
|
||||
.insufficientRingSize,
|
||||
.tombstoneBlockExceeded,
|
||||
.tombstoneBlockTooFar,
|
||||
.noOutputs,
|
||||
.tooManyOutputs,
|
||||
.excessiveRingSize,
|
||||
.duplicateRingElements,
|
||||
.unsortedRingElements,
|
||||
.unequalRingSizes,
|
||||
.unsortedKeyImages,
|
||||
.containsSpentKeyImage,
|
||||
.duplicateKeyImages,
|
||||
.duplicateOutputPublicKey,
|
||||
.containsExistingOutputPublicKey,
|
||||
.missingTxOutMembershipProof,
|
||||
.invalidTxOutMembershipProof,
|
||||
.invalidRistrettoPublicKey,
|
||||
.invalidLedgerContext,
|
||||
.ledger,
|
||||
.membershipProofValidationError,
|
||||
.txFeeError,
|
||||
.keyError,
|
||||
.unsortedInputs,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
/// Response to a `GetLastBlockInfo` call.
|
||||
public struct ConsensusCommon_LastBlockInfoResponse {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
/// Block index
|
||||
public var index: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/// Requests a range [offset, offset+limit) of Blocks.
|
||||
public struct ConsensusCommon_BlocksRequest {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
/// Index of first block.
|
||||
public var offset: UInt64 = 0
|
||||
|
||||
/// Maximum number of blocks.
|
||||
public var limit: UInt32 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
/// Response to a `BlocksRequest`.
|
||||
public struct ConsensusCommon_BlocksResponse {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var blocks: [Blockchain_Block] = []
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
//// Response from TxPropose RPC call.
|
||||
public struct ConsensusCommon_ProposeTxResponse {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// Result.
|
||||
public var result: ConsensusCommon_ProposeTxResult = .ok
|
||||
|
||||
//// The number of blocks in the ledger at the time the request was received.
|
||||
public var blockCount: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "consensus_common"
|
||||
|
||||
extension ConsensusCommon_ProposeTxResult: SwiftProtobuf._ProtoNameProviding {
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "Ok"),
|
||||
10: .same(proto: "InputsProofsLengthMismatch"),
|
||||
11: .same(proto: "NoInputs"),
|
||||
12: .same(proto: "TooManyInputs"),
|
||||
13: .same(proto: "InsufficientInputSignatures"),
|
||||
14: .same(proto: "InvalidInputSignature"),
|
||||
15: .same(proto: "InvalidTransactionSignature"),
|
||||
16: .same(proto: "InvalidRangeProof"),
|
||||
17: .same(proto: "InsufficientRingSize"),
|
||||
18: .same(proto: "TombstoneBlockExceeded"),
|
||||
19: .same(proto: "TombstoneBlockTooFar"),
|
||||
20: .same(proto: "NoOutputs"),
|
||||
21: .same(proto: "TooManyOutputs"),
|
||||
22: .same(proto: "ExcessiveRingSize"),
|
||||
23: .same(proto: "DuplicateRingElements"),
|
||||
24: .same(proto: "UnsortedRingElements"),
|
||||
25: .same(proto: "UnequalRingSizes"),
|
||||
26: .same(proto: "UnsortedKeyImages"),
|
||||
27: .same(proto: "ContainsSpentKeyImage"),
|
||||
28: .same(proto: "DuplicateKeyImages"),
|
||||
29: .same(proto: "DuplicateOutputPublicKey"),
|
||||
30: .same(proto: "ContainsExistingOutputPublicKey"),
|
||||
31: .same(proto: "MissingTxOutMembershipProof"),
|
||||
32: .same(proto: "InvalidTxOutMembershipProof"),
|
||||
33: .same(proto: "InvalidRistrettoPublicKey"),
|
||||
34: .same(proto: "InvalidLedgerContext"),
|
||||
35: .same(proto: "Ledger"),
|
||||
36: .same(proto: "MembershipProofValidationError"),
|
||||
37: .same(proto: "TxFeeError"),
|
||||
38: .same(proto: "KeyError"),
|
||||
39: .same(proto: "UnsortedInputs"),
|
||||
]
|
||||
}
|
||||
|
||||
extension ConsensusCommon_LastBlockInfoResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".LastBlockInfoResponse"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "index"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.index) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.index != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.index, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: ConsensusCommon_LastBlockInfoResponse, rhs: ConsensusCommon_LastBlockInfoResponse) -> Bool {
|
||||
if lhs.index != rhs.index {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension ConsensusCommon_BlocksRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".BlocksRequest"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "offset"),
|
||||
2: .same(proto: "limit"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.offset) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.limit) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.offset != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.offset, fieldNumber: 1)
|
||||
}
|
||||
if self.limit != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.limit, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: ConsensusCommon_BlocksRequest, rhs: ConsensusCommon_BlocksRequest) -> Bool {
|
||||
if lhs.offset != rhs.offset {return false}
|
||||
if lhs.limit != rhs.limit {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension ConsensusCommon_BlocksResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".BlocksResponse"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "blocks"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.blocks) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.blocks.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.blocks, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: ConsensusCommon_BlocksResponse, rhs: ConsensusCommon_BlocksResponse) -> Bool {
|
||||
if lhs.blocks != rhs.blocks {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension ConsensusCommon_ProposeTxResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".ProposeTxResponse"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "result"),
|
||||
2: .standard(proto: "block_count"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularEnumField(value: &self.result) }()
|
||||
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.blockCount) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.result != .ok {
|
||||
try visitor.visitSingularEnumField(value: self.result, fieldNumber: 1)
|
||||
}
|
||||
if self.blockCount != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.blockCount, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: ConsensusCommon_ProposeTxResponse, rhs: ConsensusCommon_ProposeTxResponse) -> Bool {
|
||||
if lhs.result != rhs.result {return false}
|
||||
if lhs.blockCount != rhs.blockCount {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
1817
Sources/Generated/Proto/external.pb.swift
Normal file
1817
Sources/Generated/Proto/external.pb.swift
Normal file
File diff suppressed because it is too large
Load Diff
82
Sources/Generated/Proto/fog_common.pb.swift
Normal file
82
Sources/Generated/Proto/fog_common.pb.swift
Normal file
@ -0,0 +1,82 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: fog_common.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
//// Represents a half-open range [start_block, end_block) of blocks
|
||||
public struct FogCommon_BlockRange {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The first block in the range
|
||||
public var startBlock: UInt64 = 0
|
||||
|
||||
//// One-past-the-end of the range
|
||||
public var endBlock: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "fog_common"
|
||||
|
||||
extension FogCommon_BlockRange: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".BlockRange"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "start_block"),
|
||||
2: .standard(proto: "end_block"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.startBlock) }()
|
||||
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.endBlock) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.startBlock != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.startBlock, fieldNumber: 1)
|
||||
}
|
||||
if self.endBlock != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.endBlock, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: FogCommon_BlockRange, rhs: FogCommon_BlockRange) -> Bool {
|
||||
if lhs.startBlock != rhs.startBlock {return false}
|
||||
if lhs.endBlock != rhs.endBlock {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
324
Sources/Generated/Proto/ingest.grpc.swift
Normal file
324
Sources/Generated/Proto/ingest.grpc.swift
Normal file
@ -0,0 +1,324 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// Source: ingest.proto
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright 2018, gRPC Authors All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
import GRPC
|
||||
import NIO
|
||||
import SwiftProtobuf
|
||||
|
||||
|
||||
/// Usage: instantiate `AccountIngest_AccountIngestAPIClient`, then call methods of this protocol to make API calls.
|
||||
public protocol AccountIngest_AccountIngestAPIClientProtocol: GRPCClient {
|
||||
var serviceName: String { get }
|
||||
var interceptors: AccountIngest_AccountIngestAPIClientInterceptorFactoryProtocol? { get }
|
||||
|
||||
func getStatus(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary>
|
||||
|
||||
func newKeys(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary>
|
||||
|
||||
func setPubkeyExpiryWindow(
|
||||
_ request: AccountIngest_SetPubkeyExpiryWindowRequest,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<AccountIngest_SetPubkeyExpiryWindowRequest, IngestCommon_IngestSummary>
|
||||
|
||||
func setPeers(
|
||||
_ request: IngestCommon_SetPeersRequest,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<IngestCommon_SetPeersRequest, IngestCommon_IngestSummary>
|
||||
|
||||
func activate(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary>
|
||||
|
||||
func retire(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary>
|
||||
|
||||
func unretire(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary>
|
||||
|
||||
func reportMissedBlockRange(
|
||||
_ request: AccountIngest_ReportMissedBlockRangeRequest,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<AccountIngest_ReportMissedBlockRangeRequest, SwiftProtobuf.Google_Protobuf_Empty>
|
||||
|
||||
func getMissedBlockRanges(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, AccountIngest_GetMissedBlockRangesResponse>
|
||||
}
|
||||
|
||||
extension AccountIngest_AccountIngestAPIClientProtocol {
|
||||
public var serviceName: String {
|
||||
return "account_ingest.AccountIngestAPI"
|
||||
}
|
||||
|
||||
//// Get a summary of the state of this ingest server
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to GetStatus.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func getStatus(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/account_ingest.AccountIngestAPI/GetStatus",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeGetStatusInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Wipe out all keys and oram state in the enclave, replacing them with new random keys.
|
||||
//// This places the enclave in a similar state to if it was just initialized.
|
||||
//// This also decommissions any existing ingest invocation id.
|
||||
//// It is an error to do this if the server is not idle.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to NewKeys.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func newKeys(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/account_ingest.AccountIngestAPI/NewKeys",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeNewKeysInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Set the pubkey_expiry_window of this ingest server.
|
||||
//// It is an error to reduce this value if the server is not idle.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to SetPubkeyExpiryWindow.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func setPubkeyExpiryWindow(
|
||||
_ request: AccountIngest_SetPubkeyExpiryWindowRequest,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<AccountIngest_SetPubkeyExpiryWindowRequest, IngestCommon_IngestSummary> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/account_ingest.AccountIngestAPI/SetPubkeyExpiryWindow",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeSetPubkeyExpiryWindowInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Set the list of peers of this ingest server
|
||||
//// Returns the status after the operation, or, an error
|
||||
//// Duplicates in this list are removed, and if a Uri has the same responder id as
|
||||
//// the target server, that Uri is removed and it is not an error.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to SetPeers.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func setPeers(
|
||||
_ request: IngestCommon_SetPeersRequest,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<IngestCommon_SetPeersRequest, IngestCommon_IngestSummary> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/account_ingest.AccountIngestAPI/SetPeers",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeSetPeersInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Attempt to put an idle server in the active mode.
|
||||
//// This is a no-op if the server is already active, and cancels retiry if the server is retiring.
|
||||
////
|
||||
//// This will:
|
||||
//// - Check state of every peer. If any is active or retiring, fail this operation.
|
||||
//// Also, set their peer list to match ours, including this node.
|
||||
//// - Send our ingress private key to every peer, and confirm success.
|
||||
//// - Create a new ingest invocation id with the database and start consuming blocks and publishing fog reports.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to Activate.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func activate(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/account_ingest.AccountIngestAPI/Activate",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeActivateInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Attempt to put an active server in the retiring mode, after which it will eventually become idle.
|
||||
//// This is a no-op if the server is already idling or retiring.
|
||||
////
|
||||
//// This will:
|
||||
//// - Compute a block at which retiry is finished, which will be the last pubkey_expiry value plus one.
|
||||
//// - Cause the server to stop publishing fog reports with every block.
|
||||
//// - After the final block is processed, enter the idle state. (TODO: Also overwrite private keys? and decommission ingest invocation?)
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to Retire.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func retire(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/account_ingest.AccountIngestAPI/Retire",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeRetireInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Attempt to take the cluster (identified by the current ingress key on this ingest server) out of retirement.
|
||||
//// The use case for this is:
|
||||
//// 1. We are trying to do ingest enclave upgrade
|
||||
//// 2. We retire the old cluster and activate the new cluster
|
||||
//// 3. Something goes wrong and the new cluster goes up in flames
|
||||
//// 4. We want to unretire the old cluster key so that the old cluster starts publishing fog reports
|
||||
//// again and continues life as usual, and then continue debugging the new cluster and try again later.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to Unretire.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func unretire(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/account_ingest.AccountIngestAPI/Unretire",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeUnretireInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Report a range of missed blocks.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to ReportMissedBlockRange.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func reportMissedBlockRange(
|
||||
_ request: AccountIngest_ReportMissedBlockRangeRequest,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<AccountIngest_ReportMissedBlockRangeRequest, SwiftProtobuf.Google_Protobuf_Empty> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/account_ingest.AccountIngestAPI/ReportMissedBlockRange",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeReportMissedBlockRangeInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Get list of missed block ranges.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to GetMissedBlockRanges.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func getMissedBlockRanges(
|
||||
_ request: SwiftProtobuf.Google_Protobuf_Empty,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<SwiftProtobuf.Google_Protobuf_Empty, AccountIngest_GetMissedBlockRangesResponse> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/account_ingest.AccountIngestAPI/GetMissedBlockRanges",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeGetMissedBlockRangesInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public protocol AccountIngest_AccountIngestAPIClientInterceptorFactoryProtocol {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'getStatus'.
|
||||
func makeGetStatusInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'newKeys'.
|
||||
func makeNewKeysInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'setPubkeyExpiryWindow'.
|
||||
func makeSetPubkeyExpiryWindowInterceptors() -> [ClientInterceptor<AccountIngest_SetPubkeyExpiryWindowRequest, IngestCommon_IngestSummary>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'setPeers'.
|
||||
func makeSetPeersInterceptors() -> [ClientInterceptor<IngestCommon_SetPeersRequest, IngestCommon_IngestSummary>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'activate'.
|
||||
func makeActivateInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'retire'.
|
||||
func makeRetireInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'unretire'.
|
||||
func makeUnretireInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, IngestCommon_IngestSummary>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'reportMissedBlockRange'.
|
||||
func makeReportMissedBlockRangeInterceptors() -> [ClientInterceptor<AccountIngest_ReportMissedBlockRangeRequest, SwiftProtobuf.Google_Protobuf_Empty>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'getMissedBlockRanges'.
|
||||
func makeGetMissedBlockRangesInterceptors() -> [ClientInterceptor<SwiftProtobuf.Google_Protobuf_Empty, AccountIngest_GetMissedBlockRangesResponse>]
|
||||
}
|
||||
|
||||
public final class AccountIngest_AccountIngestAPIClient: AccountIngest_AccountIngestAPIClientProtocol {
|
||||
public let channel: GRPCChannel
|
||||
public var defaultCallOptions: CallOptions
|
||||
public var interceptors: AccountIngest_AccountIngestAPIClientInterceptorFactoryProtocol?
|
||||
|
||||
/// Creates a client for the account_ingest.AccountIngestAPI service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - channel: `GRPCChannel` to the service host.
|
||||
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
||||
/// - interceptors: A factory providing interceptors for each RPC.
|
||||
public init(
|
||||
channel: GRPCChannel,
|
||||
defaultCallOptions: CallOptions = CallOptions(),
|
||||
interceptors: AccountIngest_AccountIngestAPIClientInterceptorFactoryProtocol? = nil
|
||||
) {
|
||||
self.channel = channel
|
||||
self.defaultCallOptions = defaultCallOptions
|
||||
self.interceptors = interceptors
|
||||
}
|
||||
}
|
||||
|
||||
172
Sources/Generated/Proto/ingest.pb.swift
Normal file
172
Sources/Generated/Proto/ingest.pb.swift
Normal file
@ -0,0 +1,172 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: ingest.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
public struct AccountIngest_ReportMissedBlockRangeRequest {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var startIndex: UInt64 = 0
|
||||
|
||||
public var endIndex: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public struct AccountIngest_GetMissedBlockRangesResponse {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var missedBlockRanges: [FogCommon_BlockRange] = []
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public struct AccountIngest_SetPubkeyExpiryWindowRequest {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// This value is a number of blocks that is added to the current block index to compute the "pubkey_expiry" value of fog reports.
|
||||
////
|
||||
//// Setting it larger means that the fog reports live longer before expiring, but it also means that if missed blocks occur, because
|
||||
//// all fog ingest servers crash without retiring completely, and the ingress private key is lost,
|
||||
//// more data must be downloaded by the clients and scanned to recover their balances.
|
||||
public var pubkeyExpiryWindow: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "account_ingest"
|
||||
|
||||
extension AccountIngest_ReportMissedBlockRangeRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".ReportMissedBlockRangeRequest"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "start_index"),
|
||||
2: .standard(proto: "end_index"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.startIndex) }()
|
||||
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.endIndex) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.startIndex != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.startIndex, fieldNumber: 1)
|
||||
}
|
||||
if self.endIndex != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.endIndex, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: AccountIngest_ReportMissedBlockRangeRequest, rhs: AccountIngest_ReportMissedBlockRangeRequest) -> Bool {
|
||||
if lhs.startIndex != rhs.startIndex {return false}
|
||||
if lhs.endIndex != rhs.endIndex {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension AccountIngest_GetMissedBlockRangesResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".GetMissedBlockRangesResponse"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "missed_block_ranges"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.missedBlockRanges) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.missedBlockRanges.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.missedBlockRanges, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: AccountIngest_GetMissedBlockRangesResponse, rhs: AccountIngest_GetMissedBlockRangesResponse) -> Bool {
|
||||
if lhs.missedBlockRanges != rhs.missedBlockRanges {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension AccountIngest_SetPubkeyExpiryWindowRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".SetPubkeyExpiryWindowRequest"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "pubkey_expiry_window"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.pubkeyExpiryWindow) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.pubkeyExpiryWindow != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.pubkeyExpiryWindow, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: AccountIngest_SetPubkeyExpiryWindowRequest, rhs: AccountIngest_SetPubkeyExpiryWindowRequest) -> Bool {
|
||||
if lhs.pubkeyExpiryWindow != rhs.pubkeyExpiryWindow {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
311
Sources/Generated/Proto/ingest_common.pb.swift
Normal file
311
Sources/Generated/Proto/ingest_common.pb.swift
Normal file
@ -0,0 +1,311 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: ingest_common.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
//// Represents the possible modes of an ingest server controller
|
||||
public enum IngestCommon_IngestControllerMode: SwiftProtobuf.Enum {
|
||||
public typealias RawValue = Int
|
||||
|
||||
//// Server is not actively consuming and scanning the blockchain
|
||||
case idle // = 0
|
||||
|
||||
//// Server is actively consuming and scanning the blockchain,
|
||||
//// and attempting to publish fog reports, unless DB says the key is retired.
|
||||
case active // = 1
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
public init() {
|
||||
self = .idle
|
||||
}
|
||||
|
||||
public init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .idle
|
||||
case 1: self = .active
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
public var rawValue: Int {
|
||||
switch self {
|
||||
case .idle: return 0
|
||||
case .active: return 1
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension IngestCommon_IngestControllerMode: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
public static var allCases: [IngestCommon_IngestControllerMode] = [
|
||||
.idle,
|
||||
.active,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
//// A summary of the state of the ingest server
|
||||
public struct IngestCommon_IngestSummary {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The current mode of the server
|
||||
public var mode: IngestCommon_IngestControllerMode = .idle
|
||||
|
||||
//// The next block index that will scanned
|
||||
public var nextBlockIndex: UInt64 = 0
|
||||
|
||||
//// The pubkey expiry window value, used to compute pubkey_expiry values in reports.
|
||||
//// This is how many more blocks we commit to scanning with this key.
|
||||
//// (If we don't scan that many blocks, then the ones we didn't scan are "missed blocks".)
|
||||
public var pubkeyExpiryWindow: UInt64 = 0
|
||||
|
||||
//// The ingress public key of the server
|
||||
public var ingressPubkey: External_CompressedRistretto {
|
||||
get {return _ingressPubkey ?? External_CompressedRistretto()}
|
||||
set {_ingressPubkey = newValue}
|
||||
}
|
||||
/// Returns true if `ingressPubkey` has been explicitly set.
|
||||
public var hasIngressPubkey: Bool {return self._ingressPubkey != nil}
|
||||
/// Clears the value of `ingressPubkey`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearIngressPubkey() {self._ingressPubkey = nil}
|
||||
|
||||
//// The egress public key of the server (appearing in RngRecord objects)
|
||||
public var egressPubkey: Data = Data()
|
||||
|
||||
//// The kex rng version of the server (appearing in RngRecord objects)
|
||||
public var kexRngVersion: UInt32 = 0
|
||||
|
||||
//// The list of peers of this server. The list contains igp:// URIs
|
||||
public var peers: [String] = []
|
||||
|
||||
//// The current ingest invocation id of this server (only if Active)
|
||||
public var ingestInvocationID: Int64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _ingressPubkey: External_CompressedRistretto? = nil
|
||||
}
|
||||
|
||||
//// The schema of the ingest server's state file that it backs up on disk
|
||||
public struct IngestCommon_IngestStateFile {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The summary of the ingest server state
|
||||
public var summary: IngestCommon_IngestSummary {
|
||||
get {return _summary ?? IngestCommon_IngestSummary()}
|
||||
set {_summary = newValue}
|
||||
}
|
||||
/// Returns true if `summary` has been explicitly set.
|
||||
public var hasSummary: Bool {return self._summary != nil}
|
||||
/// Clears the value of `summary`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearSummary() {self._summary = nil}
|
||||
|
||||
//// Sealed ingress key blob.
|
||||
//// In a well-formed state file, the private key sealed here matches the ingress_pubkey in the summary.
|
||||
public var sealedIngressKey: Data = Data()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _summary: IngestCommon_IngestSummary? = nil
|
||||
}
|
||||
|
||||
//// A request to change the list of peers of an ingest server
|
||||
public struct IngestCommon_SetPeersRequest {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The new list of peer uris
|
||||
public var ingestPeerUris: [String] = []
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "ingest_common"
|
||||
|
||||
extension IngestCommon_IngestControllerMode: SwiftProtobuf._ProtoNameProviding {
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "Idle"),
|
||||
1: .same(proto: "Active"),
|
||||
]
|
||||
}
|
||||
|
||||
extension IngestCommon_IngestSummary: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".IngestSummary"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "mode"),
|
||||
2: .standard(proto: "next_block_index"),
|
||||
3: .standard(proto: "pubkey_expiry_window"),
|
||||
4: .standard(proto: "ingress_pubkey"),
|
||||
5: .standard(proto: "egress_pubkey"),
|
||||
6: .standard(proto: "kex_rng_version"),
|
||||
7: .same(proto: "peers"),
|
||||
8: .standard(proto: "ingest_invocation_id"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularEnumField(value: &self.mode) }()
|
||||
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.nextBlockIndex) }()
|
||||
case 3: try { try decoder.decodeSingularUInt64Field(value: &self.pubkeyExpiryWindow) }()
|
||||
case 4: try { try decoder.decodeSingularMessageField(value: &self._ingressPubkey) }()
|
||||
case 5: try { try decoder.decodeSingularBytesField(value: &self.egressPubkey) }()
|
||||
case 6: try { try decoder.decodeSingularUInt32Field(value: &self.kexRngVersion) }()
|
||||
case 7: try { try decoder.decodeRepeatedStringField(value: &self.peers) }()
|
||||
case 8: try { try decoder.decodeSingularInt64Field(value: &self.ingestInvocationID) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.mode != .idle {
|
||||
try visitor.visitSingularEnumField(value: self.mode, fieldNumber: 1)
|
||||
}
|
||||
if self.nextBlockIndex != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.nextBlockIndex, fieldNumber: 2)
|
||||
}
|
||||
if self.pubkeyExpiryWindow != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.pubkeyExpiryWindow, fieldNumber: 3)
|
||||
}
|
||||
if let v = self._ingressPubkey {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 4)
|
||||
}
|
||||
if !self.egressPubkey.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.egressPubkey, fieldNumber: 5)
|
||||
}
|
||||
if self.kexRngVersion != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.kexRngVersion, fieldNumber: 6)
|
||||
}
|
||||
if !self.peers.isEmpty {
|
||||
try visitor.visitRepeatedStringField(value: self.peers, fieldNumber: 7)
|
||||
}
|
||||
if self.ingestInvocationID != 0 {
|
||||
try visitor.visitSingularInt64Field(value: self.ingestInvocationID, fieldNumber: 8)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: IngestCommon_IngestSummary, rhs: IngestCommon_IngestSummary) -> Bool {
|
||||
if lhs.mode != rhs.mode {return false}
|
||||
if lhs.nextBlockIndex != rhs.nextBlockIndex {return false}
|
||||
if lhs.pubkeyExpiryWindow != rhs.pubkeyExpiryWindow {return false}
|
||||
if lhs._ingressPubkey != rhs._ingressPubkey {return false}
|
||||
if lhs.egressPubkey != rhs.egressPubkey {return false}
|
||||
if lhs.kexRngVersion != rhs.kexRngVersion {return false}
|
||||
if lhs.peers != rhs.peers {return false}
|
||||
if lhs.ingestInvocationID != rhs.ingestInvocationID {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension IngestCommon_IngestStateFile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".IngestStateFile"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "summary"),
|
||||
2: .standard(proto: "sealed_ingress_key"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularMessageField(value: &self._summary) }()
|
||||
case 2: try { try decoder.decodeSingularBytesField(value: &self.sealedIngressKey) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if let v = self._summary {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if !self.sealedIngressKey.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.sealedIngressKey, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: IngestCommon_IngestStateFile, rhs: IngestCommon_IngestStateFile) -> Bool {
|
||||
if lhs._summary != rhs._summary {return false}
|
||||
if lhs.sealedIngressKey != rhs.sealedIngressKey {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension IngestCommon_SetPeersRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".SetPeersRequest"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "ingest_peer_uris"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeRepeatedStringField(value: &self.ingestPeerUris) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.ingestPeerUris.isEmpty {
|
||||
try visitor.visitRepeatedStringField(value: self.ingestPeerUris, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: IngestCommon_SetPeersRequest, rhs: IngestCommon_SetPeersRequest) -> Bool {
|
||||
if lhs.ingestPeerUris != rhs.ingestPeerUris {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
156
Sources/Generated/Proto/kex_rng.pb.swift
Normal file
156
Sources/Generated/Proto/kex_rng.pb.swift
Normal file
@ -0,0 +1,156 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: kex_rng.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
//// The key exchange message associated to creating a kex rng
|
||||
public struct KexRng_KexRngPubkey {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// A canonical representation of KexAlgo public key
|
||||
public var pubkey: Data = Data()
|
||||
|
||||
//// A version number for the RNG algo.
|
||||
public var version: UInt32 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
//// A stored, wire-stable representation of a KexRng
|
||||
public struct KexRng_StoredRng {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// A canonical representation of KexRng secret state
|
||||
public var secret: Data = Data()
|
||||
|
||||
//// A canonical representation of KexRng output buffer
|
||||
public var buffer: Data = Data()
|
||||
|
||||
//// The internal counter of the KexRng
|
||||
public var counter: UInt64 = 0
|
||||
|
||||
//// A version number for the RNG algo.
|
||||
//// This is u32 for protobuf compatibility.
|
||||
public var version: UInt32 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "kex_rng"
|
||||
|
||||
extension KexRng_KexRngPubkey: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".KexRngPubkey"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "pubkey"),
|
||||
2: .same(proto: "version"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBytesField(value: &self.pubkey) }()
|
||||
case 2: try { try decoder.decodeSingularUInt32Field(value: &self.version) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.pubkey.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.pubkey, fieldNumber: 1)
|
||||
}
|
||||
if self.version != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.version, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: KexRng_KexRngPubkey, rhs: KexRng_KexRngPubkey) -> Bool {
|
||||
if lhs.pubkey != rhs.pubkey {return false}
|
||||
if lhs.version != rhs.version {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension KexRng_StoredRng: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".StoredRng"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "secret"),
|
||||
2: .same(proto: "buffer"),
|
||||
3: .same(proto: "counter"),
|
||||
4: .same(proto: "version"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBytesField(value: &self.secret) }()
|
||||
case 2: try { try decoder.decodeSingularBytesField(value: &self.buffer) }()
|
||||
case 3: try { try decoder.decodeSingularUInt64Field(value: &self.counter) }()
|
||||
case 4: try { try decoder.decodeSingularUInt32Field(value: &self.version) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.secret.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.secret, fieldNumber: 1)
|
||||
}
|
||||
if !self.buffer.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.buffer, fieldNumber: 2)
|
||||
}
|
||||
if self.counter != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.counter, fieldNumber: 3)
|
||||
}
|
||||
if self.version != 0 {
|
||||
try visitor.visitSingularUInt32Field(value: self.version, fieldNumber: 4)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: KexRng_StoredRng, rhs: KexRng_StoredRng) -> Bool {
|
||||
if lhs.secret != rhs.secret {return false}
|
||||
if lhs.buffer != rhs.buffer {return false}
|
||||
if lhs.counter != rhs.counter {return false}
|
||||
if lhs.version != rhs.version {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
349
Sources/Generated/Proto/ledger.grpc.swift
Normal file
349
Sources/Generated/Proto/ledger.grpc.swift
Normal file
@ -0,0 +1,349 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// Source: ledger.proto
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright 2018, gRPC Authors All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
import GRPC
|
||||
import NIO
|
||||
import SwiftProtobuf
|
||||
|
||||
|
||||
/// Usage: instantiate `FogLedger_FogMerkleProofAPIClient`, then call methods of this protocol to make API calls.
|
||||
public protocol FogLedger_FogMerkleProofAPIClientProtocol: GRPCClient {
|
||||
var serviceName: String { get }
|
||||
var interceptors: FogLedger_FogMerkleProofAPIClientInterceptorFactoryProtocol? { get }
|
||||
|
||||
func auth(
|
||||
_ request: Attest_AuthMessage,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<Attest_AuthMessage, Attest_AuthMessage>
|
||||
|
||||
func getOutputs(
|
||||
_ request: Attest_Message,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<Attest_Message, Attest_Message>
|
||||
}
|
||||
|
||||
extension FogLedger_FogMerkleProofAPIClientProtocol {
|
||||
public var serviceName: String {
|
||||
return "fog_ledger.FogMerkleProofAPI"
|
||||
}
|
||||
|
||||
//// This is called to perform mc-noise IX key exchange with the enclave,
|
||||
//// before calling GetOutputs.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to Auth.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func auth(
|
||||
_ request: Attest_AuthMessage,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<Attest_AuthMessage, Attest_AuthMessage> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/fog_ledger.FogMerkleProofAPI/Auth",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeAuthInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Get TxOut's and merkle proofs of membership for these outputs
|
||||
//// These requests can be the user's "real" outputs from fog view, in order
|
||||
//// to get the needed merkle proof, or their mixins for RingCT.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to GetOutputs.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func getOutputs(
|
||||
_ request: Attest_Message,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<Attest_Message, Attest_Message> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/fog_ledger.FogMerkleProofAPI/GetOutputs",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeGetOutputsInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public protocol FogLedger_FogMerkleProofAPIClientInterceptorFactoryProtocol {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'auth'.
|
||||
func makeAuthInterceptors() -> [ClientInterceptor<Attest_AuthMessage, Attest_AuthMessage>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'getOutputs'.
|
||||
func makeGetOutputsInterceptors() -> [ClientInterceptor<Attest_Message, Attest_Message>]
|
||||
}
|
||||
|
||||
public final class FogLedger_FogMerkleProofAPIClient: FogLedger_FogMerkleProofAPIClientProtocol {
|
||||
public let channel: GRPCChannel
|
||||
public var defaultCallOptions: CallOptions
|
||||
public var interceptors: FogLedger_FogMerkleProofAPIClientInterceptorFactoryProtocol?
|
||||
|
||||
/// Creates a client for the fog_ledger.FogMerkleProofAPI service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - channel: `GRPCChannel` to the service host.
|
||||
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
||||
/// - interceptors: A factory providing interceptors for each RPC.
|
||||
public init(
|
||||
channel: GRPCChannel,
|
||||
defaultCallOptions: CallOptions = CallOptions(),
|
||||
interceptors: FogLedger_FogMerkleProofAPIClientInterceptorFactoryProtocol? = nil
|
||||
) {
|
||||
self.channel = channel
|
||||
self.defaultCallOptions = defaultCallOptions
|
||||
self.interceptors = interceptors
|
||||
}
|
||||
}
|
||||
|
||||
/// Usage: instantiate `FogLedger_FogKeyImageAPIClient`, then call methods of this protocol to make API calls.
|
||||
public protocol FogLedger_FogKeyImageAPIClientProtocol: GRPCClient {
|
||||
var serviceName: String { get }
|
||||
var interceptors: FogLedger_FogKeyImageAPIClientInterceptorFactoryProtocol? { get }
|
||||
|
||||
func auth(
|
||||
_ request: Attest_AuthMessage,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<Attest_AuthMessage, Attest_AuthMessage>
|
||||
|
||||
func checkKeyImages(
|
||||
_ request: Attest_Message,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<Attest_Message, Attest_Message>
|
||||
}
|
||||
|
||||
extension FogLedger_FogKeyImageAPIClientProtocol {
|
||||
public var serviceName: String {
|
||||
return "fog_ledger.FogKeyImageAPI"
|
||||
}
|
||||
|
||||
//// This is called to perform IX key exchange with the enclave before calling GetOutputs.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to Auth.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func auth(
|
||||
_ request: Attest_AuthMessage,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<Attest_AuthMessage, Attest_AuthMessage> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/fog_ledger.FogKeyImageAPI/Auth",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeAuthInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Check if key images have appeared in the ledger, and if so, when
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to CheckKeyImages.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func checkKeyImages(
|
||||
_ request: Attest_Message,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<Attest_Message, Attest_Message> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/fog_ledger.FogKeyImageAPI/CheckKeyImages",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeCheckKeyImagesInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public protocol FogLedger_FogKeyImageAPIClientInterceptorFactoryProtocol {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'auth'.
|
||||
func makeAuthInterceptors() -> [ClientInterceptor<Attest_AuthMessage, Attest_AuthMessage>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'checkKeyImages'.
|
||||
func makeCheckKeyImagesInterceptors() -> [ClientInterceptor<Attest_Message, Attest_Message>]
|
||||
}
|
||||
|
||||
public final class FogLedger_FogKeyImageAPIClient: FogLedger_FogKeyImageAPIClientProtocol {
|
||||
public let channel: GRPCChannel
|
||||
public var defaultCallOptions: CallOptions
|
||||
public var interceptors: FogLedger_FogKeyImageAPIClientInterceptorFactoryProtocol?
|
||||
|
||||
/// Creates a client for the fog_ledger.FogKeyImageAPI service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - channel: `GRPCChannel` to the service host.
|
||||
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
||||
/// - interceptors: A factory providing interceptors for each RPC.
|
||||
public init(
|
||||
channel: GRPCChannel,
|
||||
defaultCallOptions: CallOptions = CallOptions(),
|
||||
interceptors: FogLedger_FogKeyImageAPIClientInterceptorFactoryProtocol? = nil
|
||||
) {
|
||||
self.channel = channel
|
||||
self.defaultCallOptions = defaultCallOptions
|
||||
self.interceptors = interceptors
|
||||
}
|
||||
}
|
||||
|
||||
/// Usage: instantiate `FogLedger_FogBlockAPIClient`, then call methods of this protocol to make API calls.
|
||||
public protocol FogLedger_FogBlockAPIClientProtocol: GRPCClient {
|
||||
var serviceName: String { get }
|
||||
var interceptors: FogLedger_FogBlockAPIClientInterceptorFactoryProtocol? { get }
|
||||
|
||||
func getBlocks(
|
||||
_ request: FogLedger_BlockRequest,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<FogLedger_BlockRequest, FogLedger_BlockResponse>
|
||||
}
|
||||
|
||||
extension FogLedger_FogBlockAPIClientProtocol {
|
||||
public var serviceName: String {
|
||||
return "fog_ledger.FogBlockAPI"
|
||||
}
|
||||
|
||||
//// Request for all of the TxOuts for a particular range of blocks.
|
||||
//// This is meant to help the users recover from "missed blocks" i.e.
|
||||
//// data loss in the fog service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to GetBlocks.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func getBlocks(
|
||||
_ request: FogLedger_BlockRequest,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<FogLedger_BlockRequest, FogLedger_BlockResponse> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/fog_ledger.FogBlockAPI/GetBlocks",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeGetBlocksInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public protocol FogLedger_FogBlockAPIClientInterceptorFactoryProtocol {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'getBlocks'.
|
||||
func makeGetBlocksInterceptors() -> [ClientInterceptor<FogLedger_BlockRequest, FogLedger_BlockResponse>]
|
||||
}
|
||||
|
||||
public final class FogLedger_FogBlockAPIClient: FogLedger_FogBlockAPIClientProtocol {
|
||||
public let channel: GRPCChannel
|
||||
public var defaultCallOptions: CallOptions
|
||||
public var interceptors: FogLedger_FogBlockAPIClientInterceptorFactoryProtocol?
|
||||
|
||||
/// Creates a client for the fog_ledger.FogBlockAPI service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - channel: `GRPCChannel` to the service host.
|
||||
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
||||
/// - interceptors: A factory providing interceptors for each RPC.
|
||||
public init(
|
||||
channel: GRPCChannel,
|
||||
defaultCallOptions: CallOptions = CallOptions(),
|
||||
interceptors: FogLedger_FogBlockAPIClientInterceptorFactoryProtocol? = nil
|
||||
) {
|
||||
self.channel = channel
|
||||
self.defaultCallOptions = defaultCallOptions
|
||||
self.interceptors = interceptors
|
||||
}
|
||||
}
|
||||
|
||||
/// Usage: instantiate `FogLedger_FogUntrustedTxOutApiClient`, then call methods of this protocol to make API calls.
|
||||
public protocol FogLedger_FogUntrustedTxOutApiClientProtocol: GRPCClient {
|
||||
var serviceName: String { get }
|
||||
var interceptors: FogLedger_FogUntrustedTxOutApiClientInterceptorFactoryProtocol? { get }
|
||||
|
||||
func getTxOuts(
|
||||
_ request: FogLedger_TxOutRequest,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<FogLedger_TxOutRequest, FogLedger_TxOutResponse>
|
||||
}
|
||||
|
||||
extension FogLedger_FogUntrustedTxOutApiClientProtocol {
|
||||
public var serviceName: String {
|
||||
return "fog_ledger.FogUntrustedTxOutApi"
|
||||
}
|
||||
|
||||
//// This can be used by a sender who may be sharing their private keys across
|
||||
//// multiple parties / devices, to confirm that a transaction that they sent
|
||||
//// landed in the blockchain, by confirming that one of the random keys from
|
||||
//// a TxOut that they produced appears in the ledger.
|
||||
////
|
||||
//// Given the TxOut.pubkey value, we return if it is found, and the num_blocks
|
||||
//// value, allowing Alice to determine that her transactions succeeded, or if
|
||||
//// num_blocks exceeded her tombstone value, conclude that it failed somehow.
|
||||
//// We also return the global tx out index. We don't currently return the block
|
||||
//// index or time stamp in which the TxOut appeared.
|
||||
////
|
||||
//// This API is NOT attested and Bob, the recipient, SHOULD NOT use it in connection
|
||||
//// to the same TxOut, as that will leak the transaction graph to fog operator,
|
||||
//// which breaks the privacy statement for fog as a whole.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to GetTxOuts.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func getTxOuts(
|
||||
_ request: FogLedger_TxOutRequest,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<FogLedger_TxOutRequest, FogLedger_TxOutResponse> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/fog_ledger.FogUntrustedTxOutApi/GetTxOuts",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeGetTxOutsInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public protocol FogLedger_FogUntrustedTxOutApiClientInterceptorFactoryProtocol {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'getTxOuts'.
|
||||
func makeGetTxOutsInterceptors() -> [ClientInterceptor<FogLedger_TxOutRequest, FogLedger_TxOutResponse>]
|
||||
}
|
||||
|
||||
public final class FogLedger_FogUntrustedTxOutApiClient: FogLedger_FogUntrustedTxOutApiClientProtocol {
|
||||
public let channel: GRPCChannel
|
||||
public var defaultCallOptions: CallOptions
|
||||
public var interceptors: FogLedger_FogUntrustedTxOutApiClientInterceptorFactoryProtocol?
|
||||
|
||||
/// Creates a client for the fog_ledger.FogUntrustedTxOutApi service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - channel: `GRPCChannel` to the service host.
|
||||
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
||||
/// - interceptors: A factory providing interceptors for each RPC.
|
||||
public init(
|
||||
channel: GRPCChannel,
|
||||
defaultCallOptions: CallOptions = CallOptions(),
|
||||
interceptors: FogLedger_FogUntrustedTxOutApiClientInterceptorFactoryProtocol? = nil
|
||||
) {
|
||||
self.channel = channel
|
||||
self.defaultCallOptions = defaultCallOptions
|
||||
self.interceptors = interceptors
|
||||
}
|
||||
}
|
||||
|
||||
1119
Sources/Generated/Proto/ledger.pb.swift
Normal file
1119
Sources/Generated/Proto/ledger.pb.swift
Normal file
File diff suppressed because it is too large
Load Diff
322
Sources/Generated/Proto/printable.pb.swift
Normal file
322
Sources/Generated/Proto/printable.pb.swift
Normal file
@ -0,0 +1,322 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: printable.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
/// Protos to be used for displaying encoded strings to users
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
//// Message for a payment request, which combines a public address
|
||||
//// with an a requested payment amount and memo field
|
||||
public struct Printable_PaymentRequest {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The public address of the user requesting a payment
|
||||
public var publicAddress: External_PublicAddress {
|
||||
get {return _publicAddress ?? External_PublicAddress()}
|
||||
set {_publicAddress = newValue}
|
||||
}
|
||||
/// Returns true if `publicAddress` has been explicitly set.
|
||||
public var hasPublicAddress: Bool {return self._publicAddress != nil}
|
||||
/// Clears the value of `publicAddress`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearPublicAddress() {self._publicAddress = nil}
|
||||
|
||||
//// The requested value of the payment
|
||||
public var value: UInt64 = 0
|
||||
|
||||
//// Any additional text explaining the request
|
||||
public var memo: String = String()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _publicAddress: External_PublicAddress? = nil
|
||||
}
|
||||
|
||||
//// Message encoding a private key and a UTXO, for the purpose of
|
||||
//// giving someone access to an output. This would most likely be
|
||||
//// used for gift cards.
|
||||
public struct Printable_TransferPayload {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The root entropy, allowing the recipient to spend the money
|
||||
public var entropy: Data = Data()
|
||||
|
||||
//// The public key of the UTXO to spend. This is an optimization, meaning
|
||||
//// the recipient does not need to scan the entire ledger.
|
||||
public var txOutPublicKey: External_CompressedRistretto {
|
||||
get {return _txOutPublicKey ?? External_CompressedRistretto()}
|
||||
set {_txOutPublicKey = newValue}
|
||||
}
|
||||
/// Returns true if `txOutPublicKey` has been explicitly set.
|
||||
public var hasTxOutPublicKey: Bool {return self._txOutPublicKey != nil}
|
||||
/// Clears the value of `txOutPublicKey`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearTxOutPublicKey() {self._txOutPublicKey = nil}
|
||||
|
||||
//// Any additional text explaining the gift
|
||||
public var memo: String = String()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _txOutPublicKey: External_CompressedRistretto? = nil
|
||||
}
|
||||
|
||||
//// This wraps all of the above messages using "oneof", allowing us to
|
||||
//// have a single encoding scheme and extend as necessary simply by adding
|
||||
//// new messages without breaking backwards compatibility
|
||||
public struct Printable_PrintableWrapper {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var wrapper: Printable_PrintableWrapper.OneOf_Wrapper? = nil
|
||||
|
||||
public var publicAddress: External_PublicAddress {
|
||||
get {
|
||||
if case .publicAddress(let v)? = wrapper {return v}
|
||||
return External_PublicAddress()
|
||||
}
|
||||
set {wrapper = .publicAddress(newValue)}
|
||||
}
|
||||
|
||||
public var paymentRequest: Printable_PaymentRequest {
|
||||
get {
|
||||
if case .paymentRequest(let v)? = wrapper {return v}
|
||||
return Printable_PaymentRequest()
|
||||
}
|
||||
set {wrapper = .paymentRequest(newValue)}
|
||||
}
|
||||
|
||||
public var transferPayload: Printable_TransferPayload {
|
||||
get {
|
||||
if case .transferPayload(let v)? = wrapper {return v}
|
||||
return Printable_TransferPayload()
|
||||
}
|
||||
set {wrapper = .transferPayload(newValue)}
|
||||
}
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public enum OneOf_Wrapper: Equatable {
|
||||
case publicAddress(External_PublicAddress)
|
||||
case paymentRequest(Printable_PaymentRequest)
|
||||
case transferPayload(Printable_TransferPayload)
|
||||
|
||||
#if !swift(>=4.1)
|
||||
public static func ==(lhs: Printable_PrintableWrapper.OneOf_Wrapper, rhs: Printable_PrintableWrapper.OneOf_Wrapper) -> Bool {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch (lhs, rhs) {
|
||||
case (.publicAddress, .publicAddress): return {
|
||||
guard case .publicAddress(let l) = lhs, case .publicAddress(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.paymentRequest, .paymentRequest): return {
|
||||
guard case .paymentRequest(let l) = lhs, case .paymentRequest(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
case (.transferPayload, .transferPayload): return {
|
||||
guard case .transferPayload(let l) = lhs, case .transferPayload(let r) = rhs else { preconditionFailure() }
|
||||
return l == r
|
||||
}()
|
||||
default: return false
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "printable"
|
||||
|
||||
extension Printable_PaymentRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".PaymentRequest"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "public_address"),
|
||||
2: .same(proto: "value"),
|
||||
3: .same(proto: "memo"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularMessageField(value: &self._publicAddress) }()
|
||||
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.value) }()
|
||||
case 3: try { try decoder.decodeSingularStringField(value: &self.memo) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if let v = self._publicAddress {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if self.value != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.value, fieldNumber: 2)
|
||||
}
|
||||
if !self.memo.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.memo, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Printable_PaymentRequest, rhs: Printable_PaymentRequest) -> Bool {
|
||||
if lhs._publicAddress != rhs._publicAddress {return false}
|
||||
if lhs.value != rhs.value {return false}
|
||||
if lhs.memo != rhs.memo {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Printable_TransferPayload: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".TransferPayload"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "entropy"),
|
||||
2: .standard(proto: "tx_out_public_key"),
|
||||
3: .same(proto: "memo"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBytesField(value: &self.entropy) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._txOutPublicKey) }()
|
||||
case 3: try { try decoder.decodeSingularStringField(value: &self.memo) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.entropy.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.entropy, fieldNumber: 1)
|
||||
}
|
||||
if let v = self._txOutPublicKey {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}
|
||||
if !self.memo.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.memo, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Printable_TransferPayload, rhs: Printable_TransferPayload) -> Bool {
|
||||
if lhs.entropy != rhs.entropy {return false}
|
||||
if lhs._txOutPublicKey != rhs._txOutPublicKey {return false}
|
||||
if lhs.memo != rhs.memo {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Printable_PrintableWrapper: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".PrintableWrapper"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "public_address"),
|
||||
2: .standard(proto: "payment_request"),
|
||||
3: .standard(proto: "transfer_payload"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try {
|
||||
var v: External_PublicAddress?
|
||||
if let current = self.wrapper {
|
||||
try decoder.handleConflictingOneOf()
|
||||
if case .publicAddress(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {self.wrapper = .publicAddress(v)}
|
||||
}()
|
||||
case 2: try {
|
||||
var v: Printable_PaymentRequest?
|
||||
if let current = self.wrapper {
|
||||
try decoder.handleConflictingOneOf()
|
||||
if case .paymentRequest(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {self.wrapper = .paymentRequest(v)}
|
||||
}()
|
||||
case 3: try {
|
||||
var v: Printable_TransferPayload?
|
||||
if let current = self.wrapper {
|
||||
try decoder.handleConflictingOneOf()
|
||||
if case .transferPayload(let m) = current {v = m}
|
||||
}
|
||||
try decoder.decodeSingularMessageField(value: &v)
|
||||
if let v = v {self.wrapper = .transferPayload(v)}
|
||||
}()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch self.wrapper {
|
||||
case .publicAddress?: try {
|
||||
guard case .publicAddress(let v)? = self.wrapper else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}()
|
||||
case .paymentRequest?: try {
|
||||
guard case .paymentRequest(let v)? = self.wrapper else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}()
|
||||
case .transferPayload?: try {
|
||||
guard case .transferPayload(let v)? = self.wrapper else { preconditionFailure() }
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}()
|
||||
case nil: break
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Printable_PrintableWrapper, rhs: Printable_PrintableWrapper) -> Bool {
|
||||
if lhs.wrapper != rhs.wrapper {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
92
Sources/Generated/Proto/report.grpc.swift
Normal file
92
Sources/Generated/Proto/report.grpc.swift
Normal file
@ -0,0 +1,92 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// Source: report.proto
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright 2018, gRPC Authors All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
import GRPC
|
||||
import NIO
|
||||
import SwiftProtobuf
|
||||
|
||||
|
||||
//// The public API for getting reports
|
||||
///
|
||||
/// Usage: instantiate `Report_ReportAPIClient`, then call methods of this protocol to make API calls.
|
||||
public protocol Report_ReportAPIClientProtocol: GRPCClient {
|
||||
var serviceName: String { get }
|
||||
var interceptors: Report_ReportAPIClientInterceptorFactoryProtocol? { get }
|
||||
|
||||
func getReports(
|
||||
_ request: Report_ReportRequest,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<Report_ReportRequest, Report_ReportResponse>
|
||||
}
|
||||
|
||||
extension Report_ReportAPIClientProtocol {
|
||||
public var serviceName: String {
|
||||
return "report.ReportAPI"
|
||||
}
|
||||
|
||||
//// Get all available pubkeys, with Intel SGX reports, fog urls, and expiry info
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to GetReports.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func getReports(
|
||||
_ request: Report_ReportRequest,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<Report_ReportRequest, Report_ReportResponse> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/report.ReportAPI/GetReports",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeGetReportsInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public protocol Report_ReportAPIClientInterceptorFactoryProtocol {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'getReports'.
|
||||
func makeGetReportsInterceptors() -> [ClientInterceptor<Report_ReportRequest, Report_ReportResponse>]
|
||||
}
|
||||
|
||||
public final class Report_ReportAPIClient: Report_ReportAPIClientProtocol {
|
||||
public let channel: GRPCChannel
|
||||
public var defaultCallOptions: CallOptions
|
||||
public var interceptors: Report_ReportAPIClientInterceptorFactoryProtocol?
|
||||
|
||||
/// Creates a client for the report.ReportAPI service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - channel: `GRPCChannel` to the service host.
|
||||
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
||||
/// - interceptors: A factory providing interceptors for each RPC.
|
||||
public init(
|
||||
channel: GRPCChannel,
|
||||
defaultCallOptions: CallOptions = CallOptions(),
|
||||
interceptors: Report_ReportAPIClientInterceptorFactoryProtocol? = nil
|
||||
) {
|
||||
self.channel = channel
|
||||
self.defaultCallOptions = defaultCallOptions
|
||||
self.interceptors = interceptors
|
||||
}
|
||||
}
|
||||
|
||||
199
Sources/Generated/Proto/report.pb.swift
Normal file
199
Sources/Generated/Proto/report.pb.swift
Normal file
@ -0,0 +1,199 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: report.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
/// MUST BE KEPT IN SYNC WITH RUST CODE!
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
public struct Report_ReportRequest {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public struct Report_ReportResponse {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// All available reports
|
||||
public var reports: [Report_Report] = []
|
||||
|
||||
//// The X509 chain from the fog authority to the signer
|
||||
public var chain: [Data] = []
|
||||
|
||||
//// The signature over the report list made by the last cert in the chain
|
||||
public var signature: Data = Data()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public struct Report_Report {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The fog_report_id of users with which this pubkey should be used
|
||||
//// This should match fog_report_id in Bob's public_address
|
||||
public var fogReportID: String = String()
|
||||
|
||||
//// The IAS report of the Fog Ingest node.
|
||||
////
|
||||
//// This report structure includes the ingest server's ingress public key.
|
||||
public var report: External_VerificationReport {
|
||||
get {return _report ?? External_VerificationReport()}
|
||||
set {_report = newValue}
|
||||
}
|
||||
/// Returns true if `report` has been explicitly set.
|
||||
public var hasReport: Bool {return self._report != nil}
|
||||
/// Clears the value of `report`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearReport() {self._report = nil}
|
||||
|
||||
//// The last block at which a well-formed client may use this pubkey.
|
||||
//// The tombstone block of a Tx formed using this pubkey should not exceed this.
|
||||
//// This number is likely to be e.g. current block height + 50,
|
||||
//// and may be updated (larger) if you come back to the server later.
|
||||
public var pubkeyExpiry: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _report: External_VerificationReport? = nil
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "report"
|
||||
|
||||
extension Report_ReportRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".ReportRequest"
|
||||
public static let _protobuf_nameMap = SwiftProtobuf._NameMap()
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let _ = try decoder.nextFieldNumber() {
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Report_ReportRequest, rhs: Report_ReportRequest) -> Bool {
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Report_ReportResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".ReportResponse"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "reports"),
|
||||
2: .same(proto: "chain"),
|
||||
3: .same(proto: "signature"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeRepeatedMessageField(value: &self.reports) }()
|
||||
case 2: try { try decoder.decodeRepeatedBytesField(value: &self.chain) }()
|
||||
case 3: try { try decoder.decodeSingularBytesField(value: &self.signature) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.reports.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.reports, fieldNumber: 1)
|
||||
}
|
||||
if !self.chain.isEmpty {
|
||||
try visitor.visitRepeatedBytesField(value: self.chain, fieldNumber: 2)
|
||||
}
|
||||
if !self.signature.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.signature, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Report_ReportResponse, rhs: Report_ReportResponse) -> Bool {
|
||||
if lhs.reports != rhs.reports {return false}
|
||||
if lhs.chain != rhs.chain {return false}
|
||||
if lhs.signature != rhs.signature {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension Report_Report: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".Report"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "fog_report_id"),
|
||||
2: .same(proto: "report"),
|
||||
3: .standard(proto: "pubkey_expiry"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularStringField(value: &self.fogReportID) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._report) }()
|
||||
case 3: try { try decoder.decodeSingularFixed64Field(value: &self.pubkeyExpiry) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.fogReportID.isEmpty {
|
||||
try visitor.visitSingularStringField(value: self.fogReportID, fieldNumber: 1)
|
||||
}
|
||||
if let v = self._report {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}
|
||||
if self.pubkeyExpiry != 0 {
|
||||
try visitor.visitSingularFixed64Field(value: self.pubkeyExpiry, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Report_Report, rhs: Report_Report) -> Bool {
|
||||
if lhs.fogReportID != rhs.fogReportID {return false}
|
||||
if lhs._report != rhs._report {return false}
|
||||
if lhs.pubkeyExpiry != rhs.pubkeyExpiry {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
116
Sources/Generated/Proto/view.grpc.swift
Normal file
116
Sources/Generated/Proto/view.grpc.swift
Normal file
@ -0,0 +1,116 @@
|
||||
//
|
||||
// DO NOT EDIT.
|
||||
//
|
||||
// Generated by the protocol buffer compiler.
|
||||
// Source: view.proto
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright 2018, gRPC Authors All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
import GRPC
|
||||
import NIO
|
||||
import SwiftProtobuf
|
||||
|
||||
|
||||
/// Usage: instantiate `FogView_FogViewAPIClient`, then call methods of this protocol to make API calls.
|
||||
public protocol FogView_FogViewAPIClientProtocol: GRPCClient {
|
||||
var serviceName: String { get }
|
||||
var interceptors: FogView_FogViewAPIClientInterceptorFactoryProtocol? { get }
|
||||
|
||||
func auth(
|
||||
_ request: Attest_AuthMessage,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<Attest_AuthMessage, Attest_AuthMessage>
|
||||
|
||||
func query(
|
||||
_ request: Attest_Message,
|
||||
callOptions: CallOptions?
|
||||
) -> UnaryCall<Attest_Message, Attest_Message>
|
||||
}
|
||||
|
||||
extension FogView_FogViewAPIClientProtocol {
|
||||
public var serviceName: String {
|
||||
return "fog_view.FogViewAPI"
|
||||
}
|
||||
|
||||
//// This is called to perform IX key exchange with the enclave before calling GetOutputs.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to Auth.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func auth(
|
||||
_ request: Attest_AuthMessage,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<Attest_AuthMessage, Attest_AuthMessage> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/fog_view.FogViewAPI/Auth",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeAuthInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
|
||||
//// Input should be an encrypted QueryRequest, result is an encrypted QueryResponse
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - request: Request to send to Query.
|
||||
/// - callOptions: Call options.
|
||||
/// - Returns: A `UnaryCall` with futures for the metadata, status and response.
|
||||
public func query(
|
||||
_ request: Attest_Message,
|
||||
callOptions: CallOptions? = nil
|
||||
) -> UnaryCall<Attest_Message, Attest_Message> {
|
||||
return self.makeUnaryCall(
|
||||
path: "/fog_view.FogViewAPI/Query",
|
||||
request: request,
|
||||
callOptions: callOptions ?? self.defaultCallOptions,
|
||||
interceptors: self.interceptors?.makeQueryInterceptors() ?? []
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
public protocol FogView_FogViewAPIClientInterceptorFactoryProtocol {
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'auth'.
|
||||
func makeAuthInterceptors() -> [ClientInterceptor<Attest_AuthMessage, Attest_AuthMessage>]
|
||||
|
||||
/// - Returns: Interceptors to use when invoking 'query'.
|
||||
func makeQueryInterceptors() -> [ClientInterceptor<Attest_Message, Attest_Message>]
|
||||
}
|
||||
|
||||
public final class FogView_FogViewAPIClient: FogView_FogViewAPIClientProtocol {
|
||||
public let channel: GRPCChannel
|
||||
public var defaultCallOptions: CallOptions
|
||||
public var interceptors: FogView_FogViewAPIClientInterceptorFactoryProtocol?
|
||||
|
||||
/// Creates a client for the fog_view.FogViewAPI service.
|
||||
///
|
||||
/// - Parameters:
|
||||
/// - channel: `GRPCChannel` to the service host.
|
||||
/// - defaultCallOptions: Options to use for each service call if the user doesn't provide them.
|
||||
/// - interceptors: A factory providing interceptors for each RPC.
|
||||
public init(
|
||||
channel: GRPCChannel,
|
||||
defaultCallOptions: CallOptions = CallOptions(),
|
||||
interceptors: FogView_FogViewAPIClientInterceptorFactoryProtocol? = nil
|
||||
) {
|
||||
self.channel = channel
|
||||
self.defaultCallOptions = defaultCallOptions
|
||||
self.interceptors = interceptors
|
||||
}
|
||||
}
|
||||
|
||||
835
Sources/Generated/Proto/view.pb.swift
Normal file
835
Sources/Generated/Proto/view.pb.swift
Normal file
@ -0,0 +1,835 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: view.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
//// Corresponds to and documents values of TxOutSearchResult.result_code
|
||||
//// If any values are added they must be synced with TxOutSearchResult used in recovery db
|
||||
public enum FogView_TxOutSearchResultCode: SwiftProtobuf.Enum {
|
||||
public typealias RawValue = Int
|
||||
case intentionallyUnused // = 0
|
||||
|
||||
//// A result was found
|
||||
case found // = 1
|
||||
|
||||
//// A result was not found
|
||||
case notFound // = 2
|
||||
|
||||
//// The search key is bad (e.g. wrong size) and the request could not be completed
|
||||
case badSearchKey // = 3
|
||||
|
||||
//// An internal occurred (e.g. a database failed)
|
||||
case internalError // = 4
|
||||
|
||||
//// The query was rate limited
|
||||
//// (the server decided not to service the query in order to satisfy a limit)
|
||||
case rateLimited // = 5
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
public init() {
|
||||
self = .intentionallyUnused
|
||||
}
|
||||
|
||||
public init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .intentionallyUnused
|
||||
case 1: self = .found
|
||||
case 2: self = .notFound
|
||||
case 3: self = .badSearchKey
|
||||
case 4: self = .internalError
|
||||
case 5: self = .rateLimited
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
public var rawValue: Int {
|
||||
switch self {
|
||||
case .intentionallyUnused: return 0
|
||||
case .found: return 1
|
||||
case .notFound: return 2
|
||||
case .badSearchKey: return 3
|
||||
case .internalError: return 4
|
||||
case .rateLimited: return 5
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension FogView_TxOutSearchResultCode: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
public static var allCases: [FogView_TxOutSearchResultCode] = [
|
||||
.intentionallyUnused,
|
||||
.found,
|
||||
.notFound,
|
||||
.badSearchKey,
|
||||
.internalError,
|
||||
.rateLimited,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
//// There are several kinds of records returned by the fog view API
|
||||
//// - RngRecords, which a user can use with their private key to construct KexRng's
|
||||
//// - TxOutSearchResults, which the user can decrypt with their private key to obtain TxOutRecords
|
||||
//// - Missed BlockRanges, which tell the user about blocks that fog didn't process,
|
||||
//// on which they have to fallback to view key scanning. They can download these blocks
|
||||
//// from the fog-ledger server.
|
||||
////
|
||||
//// The TxOut requests ultimately have to be served obliviously to the user in order to meet
|
||||
//// our definition of privacy. The other two do not.
|
||||
////
|
||||
//// A QueryRequest is one request which can represent many logical requests for the above
|
||||
//// kinds of records. The API is amalgamated in this way to reduce the number of round-trips
|
||||
//// needed by the client. Note that QueryRequest is actually split into two Protobuf messages:
|
||||
//// QueryRequest - which contains sensitive data exchanged over an attested and encrypted connection
|
||||
//// and QueryRequestAAD - which contains unsensitive data.
|
||||
//// We split sensitive and unsensitive data since part of the request is fulfilled by untrusted code and part
|
||||
//// is fulfilled by an enclave.
|
||||
////
|
||||
//// The API also supports an important optimization called "cursoring". This means that when
|
||||
//// you make a request, you tell us "where you were when you visited the API last" and we can
|
||||
//// avoid searching historical data to give you relevant updates.
|
||||
////
|
||||
//// There are two cursors to pay attention to:
|
||||
//// - start_from_user_event_id - This cursors the events table, allowing the caller to skip events they have already received.
|
||||
//// - start_from_block_index - This limits the set of blocks in which ETxOutRecords are searched, resulting in less load on the server.
|
||||
////
|
||||
//// Missed BlockRanges are reported to you based on whatever cursor value you supply.
|
||||
//// RngRecords can only be supplied if you supply the user's public view key. We will skip that
|
||||
//// if you don't.
|
||||
//// TxOutSearchResults are supplied if you supply fog search keys (outputs from a kex rng) in the get_txos
|
||||
//// field.
|
||||
////
|
||||
//// Example usage:
|
||||
//// Typically when hitting fog view, you will make a series of requests, not just one.
|
||||
//// The first one checks for new rng records, and later ones check for new txos in increasingly
|
||||
//// large numbers, depending on how many responses come back, how many Rng's you have, etc.
|
||||
////
|
||||
//// QueryRequest { address_public_key = 0x123..., start_from_block_index = 100, start_from_user_event_id = 100 }
|
||||
//// QueryRequest { get_txos = { 0x1..., 0x2... }, start_from... }
|
||||
//// QueryRequest { get_txos = { 0x3..., 0x4..., 0x5..., 0x6.... , start_from...} }
|
||||
//// QueryRequest { get_txos = { 0x7..., 0x8..., 0x9..., 0x10... , start_from...} }
|
||||
////
|
||||
//// It is possible to combine the first get_txos request with the address_public_key request
|
||||
//// if you already have some Rng's before you make that request.
|
||||
////
|
||||
//// The highest_processed_block_count value from the first request in a given session should become the
|
||||
//// start_from_block_index value the next time you make a request. Similarly, next_start_from_user_event_id should
|
||||
//// become start_from_user_event_id for the next request.
|
||||
////
|
||||
/// After the interaction, you can be sure that you got every Txo of yours up to those cursor values.
|
||||
////
|
||||
//// An additional optimizaiton is possible: if doing full wallet recovery and you have no Rngs
|
||||
//// at all, the request sequence might look like this:
|
||||
////
|
||||
//// QueryRequest { address_public_key = 0x123..., start_from_block_index = 0 }
|
||||
//// QueryRequest { start_from_block_index = 73, get_txos = { 0x1..., 0x2... } }
|
||||
//// QueryRequest { start_from_block_index = 73, get_txos = { 0x3..., 0x4..., 0x5..., 0x6.... } }
|
||||
//// QueryRequest { start_from_block_index = 73, get_txos = { 0x7..., 0x8..., 0x9..., 0x10... } }
|
||||
////
|
||||
//// The first request has start_from_block_index = 0, and gives back all the Rng records of the user.
|
||||
//// After inspecting those records, if there are no Rng's with start_block less than 73,
|
||||
//// then start_from_block_index can be 73 for the rest of the requests, which limits the amount of
|
||||
//// historical data that must be searched to support the requst.
|
||||
public struct FogView_QueryRequestAAD {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The last event id the client is aware of.
|
||||
public var startFromUserEventID: Int64 = 0
|
||||
|
||||
//// The first block index to search TXOs in.
|
||||
public var startFromBlockIndex: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
public struct FogView_QueryRequest {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// KexRng output bytes, "search keys", to request TxOutSearchResult's for
|
||||
public var getTxos: [Data] = []
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
//// When the result comes back, after decryption, the attest.Message plaintext
|
||||
//// follows this schema
|
||||
public struct FogView_QueryResponse {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The number of blocks processed at the time that the request was evaluated.
|
||||
////
|
||||
//// The semantics of the result as a whole are, we guarantee to get you all
|
||||
//// relevant event data from start_from_user_event_id to next_start_from_user_event_id
|
||||
//// and all TxOutSearchResults from start_from_block_index to highest_processed_block_count.
|
||||
////
|
||||
//// The highest_processed_block_count value you had last time should generally be the start_from_block_index
|
||||
//// value next time, but there are caveats.
|
||||
////
|
||||
//// If you have no data, start_from_block_index should be 0. Then you get your rng records,
|
||||
//// and start_from_block_index can be the minimum start block of any of your rng records.
|
||||
public var highestProcessedBlockCount: UInt64 = 0
|
||||
|
||||
//// The timestamp of the block corresponding to highest_processed_block_count
|
||||
public var highestProcessedBlockSignatureTimestamp: UInt64 = 0
|
||||
|
||||
//// The next value to use for start_from_user_event_id. For the first query, this should
|
||||
//// be 0.
|
||||
public var nextStartFromUserEventID: Int64 = 0
|
||||
|
||||
//// Any block ranges that are missed.
|
||||
//// These ranges are guaranteed to be non-overlapping.
|
||||
//// The client should take these ranges to fog ledger and download them and scan them
|
||||
//// in order to recover any TxOut's from these ranges.
|
||||
////
|
||||
//// FIXME: MC-1488 Don't tell users about missed blocks from before they had an RNG.
|
||||
//// Possibly, don't tell them about ANY missed blocks UNLESS they supply user_public
|
||||
//// It is expected to be omitted when they are making repeated follow-up
|
||||
//// "get_txos" queries.
|
||||
public var missedBlockRanges: [FogCommon_BlockRange] = []
|
||||
|
||||
//// Any new rng records produced by the request
|
||||
public var rngs: [FogView_RngRecord] = []
|
||||
|
||||
//// Any decommissioned ingest invocations
|
||||
public var decommissionedIngestInvocations: [FogView_DecommissionedIngestInvocation] = []
|
||||
|
||||
//// Any TxOutSearchResults from the get_txos in the request.
|
||||
public var txOutSearchResults: [FogView_TxOutSearchResult] = []
|
||||
|
||||
//// Extra data: The index of the last known block.
|
||||
//// This might be larger than highest_processed_block_count.
|
||||
//// This field doesn't have the same "cursor" semantics as the other fields.
|
||||
public var lastKnownBlockCount: UInt64 = 0
|
||||
|
||||
//// Extra data: The cumulative txo count of the last known block.
|
||||
//// This can be used by the client as a hint when choosing cryptonote mixin indices.
|
||||
//// This field doesn't have the same "cursor" semantics as the other fields.
|
||||
public var lastKnownBlockCumulativeTxoCount: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
//// A record of an Rng created by a fog ingest enclave.
|
||||
//// This can be used with the user's private view key to construct ClientKexRng,
|
||||
//// and get fog search keys.
|
||||
public struct FogView_RngRecord {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The ingest invocation id that produced this record.
|
||||
//// This is used to match against DecommissionedIngestInvocation objects when querying for new events.
|
||||
public var ingestInvocationID: Int64 = 0
|
||||
|
||||
//// A key-exchange message to be used by the client to create a VersionedKexRng
|
||||
public var pubkey: KexRng_KexRngPubkey {
|
||||
get {return _pubkey ?? KexRng_KexRngPubkey()}
|
||||
set {_pubkey = newValue}
|
||||
}
|
||||
/// Returns true if `pubkey` has been explicitly set.
|
||||
public var hasPubkey: Bool {return self._pubkey != nil}
|
||||
/// Clears the value of `pubkey`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearPubkey() {self._pubkey = nil}
|
||||
|
||||
//// The start block (when fog started using this rng)
|
||||
public var startBlock: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _pubkey: KexRng_KexRngPubkey? = nil
|
||||
}
|
||||
|
||||
//// Information about a decommissioned ingest invocation.
|
||||
public struct FogView_DecommissionedIngestInvocation {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The ingest invocation id that was decommissioned.
|
||||
public var ingestInvocationID: Int64 = 0
|
||||
|
||||
//// The last block index that was successfully ingested by this invocation.
|
||||
public var lastIngestedBlock: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
//// The result of a search result for a TxOutRecord
|
||||
public struct FogView_TxOutSearchResult {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The search key associated to this result
|
||||
public var searchKey: Data = Data()
|
||||
|
||||
//// The result code for the query.
|
||||
//// This is logically an enum, but should not be an enum because protobuf
|
||||
//// requires that enums are encoded using the "varint" encoding which is not fixed size.
|
||||
//// We want that e.g. "Found" and "NotFound" have the same length on the wire to avoid leaking that.
|
||||
//// So it is a fixed32 in protobuf, and the 0 (default) value is intentionally unused.
|
||||
public var resultCode: UInt32 = 0
|
||||
|
||||
//// A ciphertext, which is a view-key encrypted TxOutRecord in case result_code == 1.
|
||||
//// It is be zero-padding in the other cases.
|
||||
//// FIXME: MC-1491 ensure this happens either in enclave or db, or wait for ORAM
|
||||
public var ciphertext: Data = Data()
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
//// A Redacted Fog Transaction Output.
|
||||
//// This is the same as a normal TxOut, except that the fog hint is removed after processing, to save storage.
|
||||
public struct FogView_FogTxOut {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// Amount.
|
||||
public var amount: External_Amount {
|
||||
get {return _amount ?? External_Amount()}
|
||||
set {_amount = newValue}
|
||||
}
|
||||
/// Returns true if `amount` has been explicitly set.
|
||||
public var hasAmount: Bool {return self._amount != nil}
|
||||
/// Clears the value of `amount`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearAmount() {self._amount = nil}
|
||||
|
||||
//// Public key.
|
||||
public var targetKey: External_CompressedRistretto {
|
||||
get {return _targetKey ?? External_CompressedRistretto()}
|
||||
set {_targetKey = newValue}
|
||||
}
|
||||
/// Returns true if `targetKey` has been explicitly set.
|
||||
public var hasTargetKey: Bool {return self._targetKey != nil}
|
||||
/// Clears the value of `targetKey`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearTargetKey() {self._targetKey = nil}
|
||||
|
||||
//// Public key.
|
||||
public var publicKey: External_CompressedRistretto {
|
||||
get {return _publicKey ?? External_CompressedRistretto()}
|
||||
set {_publicKey = newValue}
|
||||
}
|
||||
/// Returns true if `publicKey` has been explicitly set.
|
||||
public var hasPublicKey: Bool {return self._publicKey != nil}
|
||||
/// Clears the value of `publicKey`. Subsequent reads from it will return its default value.
|
||||
public mutating func clearPublicKey() {self._publicKey = nil}
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
|
||||
fileprivate var _amount: External_Amount? = nil
|
||||
fileprivate var _targetKey: External_CompressedRistretto? = nil
|
||||
fileprivate var _publicKey: External_CompressedRistretto? = nil
|
||||
}
|
||||
|
||||
//// The schema for the decrypted TxOutSearchResult ciphertext
|
||||
//// This is the information that the Ingest enclave produces for the user about their TxOut
|
||||
////
|
||||
//// Note: The fields of FogTxOut are flattened here because it reduces the size of the protobuf
|
||||
//// enough to make a difference for the quality of ORAM implementation, like ~10% better memory utilization
|
||||
////
|
||||
//// Note: Fog TxOutRecord DOES NOT include the encrypted fog hint of the original TxOut, because it is big,
|
||||
//// and the client cannot read it anyways. However, when using the TxOut to build transactions, you must have that
|
||||
//// or the merkle proofs will fail validation, at least for now.
|
||||
//// The fog merkle proof server gives you a TxOut with fog hint, as it appears in blockchain,
|
||||
//// and that's the version of the TxOut that you should use when building a transaction.
|
||||
public struct FogView_TxOutRecord {
|
||||
// SwiftProtobuf.Message conformance is added in an extension below. See the
|
||||
// `Message` and `Message+*Additions` files in the SwiftProtobuf library for
|
||||
// methods supported on all messages.
|
||||
|
||||
//// The (compressed ristretto) bytes of commitment associated to amount field in the TxOut that was recovered
|
||||
public var txOutAmountCommitmentData: Data = Data()
|
||||
|
||||
//// The masked value associated to amount field in the TxOut that was recovered
|
||||
public var txOutAmountMaskedValue: UInt64 = 0
|
||||
|
||||
//// The (compressed ristretto) bytes of the target key associated to the TxOut that was recovered
|
||||
public var txOutTargetKeyData: Data = Data()
|
||||
|
||||
//// The (compressed ristretto) bytes of the public key associated to the TxOut that was recovered
|
||||
public var txOutPublicKeyData: Data = Data()
|
||||
|
||||
//// The global index of this TxOut in the set of all TxOuts in the entire block chain
|
||||
public var txOutGlobalIndex: UInt64 = 0
|
||||
|
||||
//// The index of the block index in which this TxOut appeared
|
||||
public var blockIndex: UInt64 = 0
|
||||
|
||||
//// The timestamp of the block containing this output.
|
||||
//// Some blocks, like the origin block, don't have a timestamp, and this value is u64::MAX
|
||||
//// Other blocks are expected to have timestamps.
|
||||
////
|
||||
//// Note: The timestamp is based on untrusted reporting of time from ONE of the consensus validators.
|
||||
//// Because it is a distributed system, it may not be the SAME consensus validator from block to block,
|
||||
//// and the timestamps may not make even a minimal amount of sense when the validator differs.
|
||||
////
|
||||
//// These timestamps are
|
||||
//// - NOISY, forward and backwards in time, depending on system time settings of many different servers.
|
||||
//// - NOT MONOTONIC: it's possible that you get a timestamp for block 101 that is before the timestamp for block 100.
|
||||
//// - Not even CONSISTENT across fog services: It's possible you get a different timestamp for a TxOut in block 100,
|
||||
//// than you do for a key image in block 100 from the key image endpoint.
|
||||
//// This is unavoidable right now because it is possible that fog-ingest has different levels of
|
||||
//// connectivity from the fog-key-image service to the blockchain data sources.
|
||||
////
|
||||
//// Timestamps are BEST-EFFORT and for a good user experience, the client software should attempt to reconcile these
|
||||
//// timestamps, so that events that have a happens-before relationship in the system, have timestamps that reflect that.
|
||||
//// Otherwise, we should expect users to be confused and disturbed about the occasional time-travelling transaction.
|
||||
////
|
||||
//// We hope to improve the quality guarantees of these timestamps over time, but for now this is the best we
|
||||
//// can do until some changes can be made to the consensus network and other services related to timestamps.
|
||||
////
|
||||
//// Represented as seconds of UTC time since Unix epoch 1970-01-01T00:00:00Z.
|
||||
public var timestamp: UInt64 = 0
|
||||
|
||||
public var unknownFields = SwiftProtobuf.UnknownStorage()
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
fileprivate let _protobuf_package = "fog_view"
|
||||
|
||||
extension FogView_TxOutSearchResultCode: SwiftProtobuf._ProtoNameProviding {
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "IntentionallyUnused"),
|
||||
1: .same(proto: "Found"),
|
||||
2: .same(proto: "NotFound"),
|
||||
3: .same(proto: "BadSearchKey"),
|
||||
4: .same(proto: "InternalError"),
|
||||
5: .same(proto: "RateLimited"),
|
||||
]
|
||||
}
|
||||
|
||||
extension FogView_QueryRequestAAD: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".QueryRequestAAD"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "start_from_user_event_id"),
|
||||
2: .standard(proto: "start_from_block_index"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularInt64Field(value: &self.startFromUserEventID) }()
|
||||
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.startFromBlockIndex) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.startFromUserEventID != 0 {
|
||||
try visitor.visitSingularInt64Field(value: self.startFromUserEventID, fieldNumber: 1)
|
||||
}
|
||||
if self.startFromBlockIndex != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.startFromBlockIndex, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: FogView_QueryRequestAAD, rhs: FogView_QueryRequestAAD) -> Bool {
|
||||
if lhs.startFromUserEventID != rhs.startFromUserEventID {return false}
|
||||
if lhs.startFromBlockIndex != rhs.startFromBlockIndex {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension FogView_QueryRequest: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".QueryRequest"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "get_txos"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeRepeatedBytesField(value: &self.getTxos) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.getTxos.isEmpty {
|
||||
try visitor.visitRepeatedBytesField(value: self.getTxos, fieldNumber: 1)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: FogView_QueryRequest, rhs: FogView_QueryRequest) -> Bool {
|
||||
if lhs.getTxos != rhs.getTxos {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension FogView_QueryResponse: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".QueryResponse"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "highest_processed_block_count"),
|
||||
2: .standard(proto: "highest_processed_block_signature_timestamp"),
|
||||
3: .standard(proto: "next_start_from_user_event_id"),
|
||||
4: .standard(proto: "missed_block_ranges"),
|
||||
5: .same(proto: "rngs"),
|
||||
6: .standard(proto: "decommissioned_ingest_invocations"),
|
||||
7: .standard(proto: "tx_out_search_results"),
|
||||
8: .standard(proto: "last_known_block_count"),
|
||||
9: .standard(proto: "last_known_block_cumulative_txo_count"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularUInt64Field(value: &self.highestProcessedBlockCount) }()
|
||||
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.highestProcessedBlockSignatureTimestamp) }()
|
||||
case 3: try { try decoder.decodeSingularInt64Field(value: &self.nextStartFromUserEventID) }()
|
||||
case 4: try { try decoder.decodeRepeatedMessageField(value: &self.missedBlockRanges) }()
|
||||
case 5: try { try decoder.decodeRepeatedMessageField(value: &self.rngs) }()
|
||||
case 6: try { try decoder.decodeRepeatedMessageField(value: &self.decommissionedIngestInvocations) }()
|
||||
case 7: try { try decoder.decodeRepeatedMessageField(value: &self.txOutSearchResults) }()
|
||||
case 8: try { try decoder.decodeSingularUInt64Field(value: &self.lastKnownBlockCount) }()
|
||||
case 9: try { try decoder.decodeSingularUInt64Field(value: &self.lastKnownBlockCumulativeTxoCount) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.highestProcessedBlockCount != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.highestProcessedBlockCount, fieldNumber: 1)
|
||||
}
|
||||
if self.highestProcessedBlockSignatureTimestamp != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.highestProcessedBlockSignatureTimestamp, fieldNumber: 2)
|
||||
}
|
||||
if self.nextStartFromUserEventID != 0 {
|
||||
try visitor.visitSingularInt64Field(value: self.nextStartFromUserEventID, fieldNumber: 3)
|
||||
}
|
||||
if !self.missedBlockRanges.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.missedBlockRanges, fieldNumber: 4)
|
||||
}
|
||||
if !self.rngs.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.rngs, fieldNumber: 5)
|
||||
}
|
||||
if !self.decommissionedIngestInvocations.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.decommissionedIngestInvocations, fieldNumber: 6)
|
||||
}
|
||||
if !self.txOutSearchResults.isEmpty {
|
||||
try visitor.visitRepeatedMessageField(value: self.txOutSearchResults, fieldNumber: 7)
|
||||
}
|
||||
if self.lastKnownBlockCount != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.lastKnownBlockCount, fieldNumber: 8)
|
||||
}
|
||||
if self.lastKnownBlockCumulativeTxoCount != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.lastKnownBlockCumulativeTxoCount, fieldNumber: 9)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: FogView_QueryResponse, rhs: FogView_QueryResponse) -> Bool {
|
||||
if lhs.highestProcessedBlockCount != rhs.highestProcessedBlockCount {return false}
|
||||
if lhs.highestProcessedBlockSignatureTimestamp != rhs.highestProcessedBlockSignatureTimestamp {return false}
|
||||
if lhs.nextStartFromUserEventID != rhs.nextStartFromUserEventID {return false}
|
||||
if lhs.missedBlockRanges != rhs.missedBlockRanges {return false}
|
||||
if lhs.rngs != rhs.rngs {return false}
|
||||
if lhs.decommissionedIngestInvocations != rhs.decommissionedIngestInvocations {return false}
|
||||
if lhs.txOutSearchResults != rhs.txOutSearchResults {return false}
|
||||
if lhs.lastKnownBlockCount != rhs.lastKnownBlockCount {return false}
|
||||
if lhs.lastKnownBlockCumulativeTxoCount != rhs.lastKnownBlockCumulativeTxoCount {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension FogView_RngRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".RngRecord"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "ingest_invocation_id"),
|
||||
2: .same(proto: "pubkey"),
|
||||
3: .standard(proto: "start_block"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularInt64Field(value: &self.ingestInvocationID) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._pubkey) }()
|
||||
case 3: try { try decoder.decodeSingularUInt64Field(value: &self.startBlock) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.ingestInvocationID != 0 {
|
||||
try visitor.visitSingularInt64Field(value: self.ingestInvocationID, fieldNumber: 1)
|
||||
}
|
||||
if let v = self._pubkey {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}
|
||||
if self.startBlock != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.startBlock, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: FogView_RngRecord, rhs: FogView_RngRecord) -> Bool {
|
||||
if lhs.ingestInvocationID != rhs.ingestInvocationID {return false}
|
||||
if lhs._pubkey != rhs._pubkey {return false}
|
||||
if lhs.startBlock != rhs.startBlock {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension FogView_DecommissionedIngestInvocation: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".DecommissionedIngestInvocation"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "ingest_invocation_id"),
|
||||
2: .standard(proto: "last_ingested_block"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularInt64Field(value: &self.ingestInvocationID) }()
|
||||
case 2: try { try decoder.decodeSingularUInt64Field(value: &self.lastIngestedBlock) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if self.ingestInvocationID != 0 {
|
||||
try visitor.visitSingularInt64Field(value: self.ingestInvocationID, fieldNumber: 1)
|
||||
}
|
||||
if self.lastIngestedBlock != 0 {
|
||||
try visitor.visitSingularUInt64Field(value: self.lastIngestedBlock, fieldNumber: 2)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: FogView_DecommissionedIngestInvocation, rhs: FogView_DecommissionedIngestInvocation) -> Bool {
|
||||
if lhs.ingestInvocationID != rhs.ingestInvocationID {return false}
|
||||
if lhs.lastIngestedBlock != rhs.lastIngestedBlock {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension FogView_TxOutSearchResult: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".TxOutSearchResult"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "search_key"),
|
||||
2: .standard(proto: "result_code"),
|
||||
3: .same(proto: "ciphertext"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBytesField(value: &self.searchKey) }()
|
||||
case 2: try { try decoder.decodeSingularFixed32Field(value: &self.resultCode) }()
|
||||
case 3: try { try decoder.decodeSingularBytesField(value: &self.ciphertext) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.searchKey.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.searchKey, fieldNumber: 1)
|
||||
}
|
||||
if self.resultCode != 0 {
|
||||
try visitor.visitSingularFixed32Field(value: self.resultCode, fieldNumber: 2)
|
||||
}
|
||||
if !self.ciphertext.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.ciphertext, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: FogView_TxOutSearchResult, rhs: FogView_TxOutSearchResult) -> Bool {
|
||||
if lhs.searchKey != rhs.searchKey {return false}
|
||||
if lhs.resultCode != rhs.resultCode {return false}
|
||||
if lhs.ciphertext != rhs.ciphertext {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension FogView_FogTxOut: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".FogTxOut"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .same(proto: "amount"),
|
||||
2: .standard(proto: "target_key"),
|
||||
3: .standard(proto: "public_key"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularMessageField(value: &self._amount) }()
|
||||
case 2: try { try decoder.decodeSingularMessageField(value: &self._targetKey) }()
|
||||
case 3: try { try decoder.decodeSingularMessageField(value: &self._publicKey) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if let v = self._amount {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 1)
|
||||
}
|
||||
if let v = self._targetKey {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 2)
|
||||
}
|
||||
if let v = self._publicKey {
|
||||
try visitor.visitSingularMessageField(value: v, fieldNumber: 3)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: FogView_FogTxOut, rhs: FogView_FogTxOut) -> Bool {
|
||||
if lhs._amount != rhs._amount {return false}
|
||||
if lhs._targetKey != rhs._targetKey {return false}
|
||||
if lhs._publicKey != rhs._publicKey {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
extension FogView_TxOutRecord: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
|
||||
public static let protoMessageName: String = _protobuf_package + ".TxOutRecord"
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
1: .standard(proto: "tx_out_amount_commitment_data"),
|
||||
2: .standard(proto: "tx_out_amount_masked_value"),
|
||||
3: .standard(proto: "tx_out_target_key_data"),
|
||||
4: .standard(proto: "tx_out_public_key_data"),
|
||||
5: .standard(proto: "tx_out_global_index"),
|
||||
6: .standard(proto: "block_index"),
|
||||
7: .same(proto: "timestamp"),
|
||||
]
|
||||
|
||||
public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
|
||||
while let fieldNumber = try decoder.nextFieldNumber() {
|
||||
// The use of inline closures is to circumvent an issue where the compiler
|
||||
// allocates stack space for every case branch when no optimizations are
|
||||
// enabled. https://github.com/apple/swift-protobuf/issues/1034
|
||||
switch fieldNumber {
|
||||
case 1: try { try decoder.decodeSingularBytesField(value: &self.txOutAmountCommitmentData) }()
|
||||
case 2: try { try decoder.decodeSingularFixed64Field(value: &self.txOutAmountMaskedValue) }()
|
||||
case 3: try { try decoder.decodeSingularBytesField(value: &self.txOutTargetKeyData) }()
|
||||
case 4: try { try decoder.decodeSingularBytesField(value: &self.txOutPublicKeyData) }()
|
||||
case 5: try { try decoder.decodeSingularFixed64Field(value: &self.txOutGlobalIndex) }()
|
||||
case 6: try { try decoder.decodeSingularFixed64Field(value: &self.blockIndex) }()
|
||||
case 7: try { try decoder.decodeSingularFixed64Field(value: &self.timestamp) }()
|
||||
default: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func traverse<V: SwiftProtobuf.Visitor>(visitor: inout V) throws {
|
||||
if !self.txOutAmountCommitmentData.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.txOutAmountCommitmentData, fieldNumber: 1)
|
||||
}
|
||||
if self.txOutAmountMaskedValue != 0 {
|
||||
try visitor.visitSingularFixed64Field(value: self.txOutAmountMaskedValue, fieldNumber: 2)
|
||||
}
|
||||
if !self.txOutTargetKeyData.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.txOutTargetKeyData, fieldNumber: 3)
|
||||
}
|
||||
if !self.txOutPublicKeyData.isEmpty {
|
||||
try visitor.visitSingularBytesField(value: self.txOutPublicKeyData, fieldNumber: 4)
|
||||
}
|
||||
if self.txOutGlobalIndex != 0 {
|
||||
try visitor.visitSingularFixed64Field(value: self.txOutGlobalIndex, fieldNumber: 5)
|
||||
}
|
||||
if self.blockIndex != 0 {
|
||||
try visitor.visitSingularFixed64Field(value: self.blockIndex, fieldNumber: 6)
|
||||
}
|
||||
if self.timestamp != 0 {
|
||||
try visitor.visitSingularFixed64Field(value: self.timestamp, fieldNumber: 7)
|
||||
}
|
||||
try unknownFields.traverse(visitor: &visitor)
|
||||
}
|
||||
|
||||
public static func ==(lhs: FogView_TxOutRecord, rhs: FogView_TxOutRecord) -> Bool {
|
||||
if lhs.txOutAmountCommitmentData != rhs.txOutAmountCommitmentData {return false}
|
||||
if lhs.txOutAmountMaskedValue != rhs.txOutAmountMaskedValue {return false}
|
||||
if lhs.txOutTargetKeyData != rhs.txOutTargetKeyData {return false}
|
||||
if lhs.txOutPublicKeyData != rhs.txOutPublicKeyData {return false}
|
||||
if lhs.txOutGlobalIndex != rhs.txOutGlobalIndex {return false}
|
||||
if lhs.blockIndex != rhs.blockIndex {return false}
|
||||
if lhs.timestamp != rhs.timestamp {return false}
|
||||
if lhs.unknownFields != rhs.unknownFields {return false}
|
||||
return true
|
||||
}
|
||||
}
|
||||
112
Sources/Generated/Proto/watcher.pb.swift
Normal file
112
Sources/Generated/Proto/watcher.pb.swift
Normal file
@ -0,0 +1,112 @@
|
||||
// DO NOT EDIT.
|
||||
// swift-format-ignore-file
|
||||
//
|
||||
// Generated by the Swift generator plugin for the protocol buffer compiler.
|
||||
// Source: watcher.proto
|
||||
//
|
||||
// For information on using the generated types, please see the documentation:
|
||||
// https://github.com/apple/swift-protobuf/
|
||||
|
||||
// Copyright (c) 2018-2021 The MobileCoin Foundation
|
||||
|
||||
// MUST BE KEPT IN SYNC WITH RUST CODE!
|
||||
|
||||
import Foundation
|
||||
import SwiftProtobuf
|
||||
|
||||
// If the compiler emits an error on this type, it is because this file
|
||||
// was generated by a version of the `protoc` Swift plug-in that is
|
||||
// incompatible with the version of SwiftProtobuf to which you are linking.
|
||||
// Please ensure that you are building against the same version of the API
|
||||
// that was used to generate this file.
|
||||
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
|
||||
struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
|
||||
typealias Version = _2
|
||||
}
|
||||
|
||||
//// The result code indicating whether the timestamp was found, can be tried again later, or will
|
||||
//// never be found with the current configuration of the service offering timestamps via the watcher.
|
||||
public enum Watcher_TimestampResultCode: SwiftProtobuf.Enum {
|
||||
public typealias RawValue = Int
|
||||
|
||||
//// The default value for fixed32 is intentionally unused to avoid omitting this field.
|
||||
case unusedField // = 0
|
||||
|
||||
//// The timestamp was found for at least one watched consensus validator.
|
||||
case timestampFound // = 1
|
||||
|
||||
//// The timestamp was not found, but the watcher sync is behind for at least one watched consensus
|
||||
//// validator. It is possible that the timestamp will be available once the watcher is fully synced.
|
||||
case watcherBehind // = 2
|
||||
|
||||
//// The timestamp cannot be known with the service's current watcher configuration.
|
||||
//// In this case, the watcher must be restarted to include in its watched URLs a sufficient
|
||||
//// set of consensus validators so that at least one of those validators participated in
|
||||
//// consensus for every block.
|
||||
case unavailable // = 3
|
||||
|
||||
//// A WatcherDBError occurred when getting signatures and timestamps.
|
||||
case watcherDatabaseError // = 4
|
||||
|
||||
//// A timestamp was requested for a block index out of bounds, e.g. 0.
|
||||
case blockIndexOutOfBounds // = 5
|
||||
case UNRECOGNIZED(Int)
|
||||
|
||||
public init() {
|
||||
self = .unusedField
|
||||
}
|
||||
|
||||
public init?(rawValue: Int) {
|
||||
switch rawValue {
|
||||
case 0: self = .unusedField
|
||||
case 1: self = .timestampFound
|
||||
case 2: self = .watcherBehind
|
||||
case 3: self = .unavailable
|
||||
case 4: self = .watcherDatabaseError
|
||||
case 5: self = .blockIndexOutOfBounds
|
||||
default: self = .UNRECOGNIZED(rawValue)
|
||||
}
|
||||
}
|
||||
|
||||
public var rawValue: Int {
|
||||
switch self {
|
||||
case .unusedField: return 0
|
||||
case .timestampFound: return 1
|
||||
case .watcherBehind: return 2
|
||||
case .unavailable: return 3
|
||||
case .watcherDatabaseError: return 4
|
||||
case .blockIndexOutOfBounds: return 5
|
||||
case .UNRECOGNIZED(let i): return i
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if swift(>=4.2)
|
||||
|
||||
extension Watcher_TimestampResultCode: CaseIterable {
|
||||
// The compiler won't synthesize support with the UNRECOGNIZED case.
|
||||
public static var allCases: [Watcher_TimestampResultCode] = [
|
||||
.unusedField,
|
||||
.timestampFound,
|
||||
.watcherBehind,
|
||||
.unavailable,
|
||||
.watcherDatabaseError,
|
||||
.blockIndexOutOfBounds,
|
||||
]
|
||||
}
|
||||
|
||||
#endif // swift(>=4.2)
|
||||
|
||||
// MARK: - Code below here is support for the SwiftProtobuf runtime.
|
||||
|
||||
extension Watcher_TimestampResultCode: SwiftProtobuf._ProtoNameProviding {
|
||||
public static let _protobuf_nameMap: SwiftProtobuf._NameMap = [
|
||||
0: .same(proto: "UnusedField"),
|
||||
1: .same(proto: "TimestampFound"),
|
||||
2: .same(proto: "WatcherBehind"),
|
||||
3: .same(proto: "Unavailable"),
|
||||
4: .same(proto: "WatcherDatabaseError"),
|
||||
5: .same(proto: "BlockIndexOutOfBounds"),
|
||||
]
|
||||
}
|
||||
190
TERMS-OF-USE.md
Normal file
190
TERMS-OF-USE.md
Normal file
@ -0,0 +1,190 @@
|
||||
**MobileCoins are not offered or sold to U.S. Persons or entities or other Prohibited Persons regardless of their location. Purchasers of MobileCoins may not transact, transfers, or trade MobileCoins in the United States or with U.S. Persons or entities, or persons or entities present in the United States.**
|
||||
|
||||
# TERMS OF USE FOR MOBILECOINS AND MOBILECOIN WALLETS
|
||||
|
||||
The MobileCoin Network operates utilizing an open source software protocol commonly known as the MobileCoin protocol. The MobileCoin protocol is designed to enable holders of digital tokens known as MobileCoins to send and receive peer-to-peer payments securely and privately through a digital wallet that is capable of sending and receiving MobileCoins (MobileCoin Wallets). MobileCoins enable a simple, secure, and private medium of exchange for consumers in countries of operation to manage and move their money using personal mobile devices and a currency of equivalent value across countries.
|
||||
|
||||
These Terms of Use for MobileCoins and MobileCoin Wallets (Terms) govern:
|
||||
- MobileCoins and their use and transfer; and
|
||||
- MobileCoin Wallets and their access and use.
|
||||
|
||||
Please read these Terms carefully before you start to use any MobileCoins and any MobileCoin Wallet. By acquiring or otherwise obtaining MobileCoins, using or transferring MobileCoins or obtaining, accessing or using a MobileCoin Wallet, you acknowledge that you have read, understand, and completely agree to be bound by these Terms. You also agree to require any transferee of your MobileCoins and any holder of a MobileCoin Wallet facilitated by you to be subject to these Terms. These Terms may be enforced against you by MobileCoin TS Ltd. or other authorized entities (which are collectively referred to in these Terms as the Compliance Entities). These Terms may be amended, changed, or updated by the Compliance Entities at any time and without prior notice to you by posting at the MobileCoin TS Ltd. Website at http://www.buymobilecoin.com/. Your continued use of any MobileCoins and any MobileCoin Wallets following the posting of any amendment, change, or update means that you accept and agree to the amended, changed, or updated Terms. These Terms are first effective as of November 23, 2020.
|
||||
|
||||
Access or use of any MobileCoin Wallets or use or transfer of any MobileCoins is void where such access, use or transfer is prohibited by, would constitute a violation of, or would be subject to penalties under applicable laws, and will not be the basis for the assertion or recognition of any interest, right, remedy, power, or privilege. Please also consult the Terms of Sale and Access and Use of the Site, available at the MobileCoin TS Ltd. website at http://www.buymobilecoin.com/. Information on the way personal information is handled is included in the Privacy Policy, available at http://www.buymobilecoin.com/.
|
||||
|
||||
## Limitations on Access or Use of MobileCoin Wallets and Use and Transfer of MobileCoins
|
||||
|
||||
The right to access or use MobileCoin Wallets and use or transfer MobileCoins is a personal, restricted, non-exclusive, non-transferable, non-sublicensable, revocable, limited license, and it is subject to the limitations and obligations in these Terms. Every **Prohibited Person** and **U.S. Person** is strictly prohibited from directly or indirectly transacting, transferring, holding, owning, accessing or using any MobileCoins and any MobileCoin Wallets in any way.
|
||||
|
||||
You are a **Prohibited Person** if you are:
|
||||
1. an individual or entity present in or subject to the jurisdiction of any jurisdiction in which the distribution or offer of or transaction in MobileCoins is unlawful or who is restricted or prohibited by applicable law, including without limitation, anti-money laundering laws, counter-terrorist financing laws, anti-corruption laws, and economic sanctions laws, from purchasing or otherwise obtaining MobileCoins or transacting in MobileCoins;
|
||||
|
||||
2. an individual or entity present in or subject to the jurisdiction of Cuba, Democratic People’s Republic of Korea (North Korea), Iran, Syria or Crimea (a region of Ukraine annexed by the Russian Federation) (a Prohibited Jurisdiction);
|
||||
|
||||
3. a government or government official of any Prohibited Jurisdiction or of Venezuela or any subdivision thereof;
|
||||
|
||||
4. an individual or entity subject to asset freezing or blocking sanctions imposed by the United Nations, British Virgin Islands, United Kingdom, European Union, or United States or any entity owned 50 percent or more by one or more such persons (a Sanctioned Person);
|
||||
|
||||
5. a person under 18 years of age; or
|
||||
|
||||
6. any other individual or entity whose dealings in MobileCoins or use of a MobileCoin Wallet could expose the Compliance Entities to civil or criminal liability or cause the Compliance Entities to engage in sanctionable conduct.
|
||||
|
||||
You are a **“U.S. Person”** if you are:
|
||||
1. (i) a U.S. citizen, (ii) a U.S. lawful permanent resident, protected individual or asylee under the U.S. Immigration and Nationality Act, (iii) an individual present in the U.S. in a non-immigrant status which carries an allowable admission period exceeding 6 months, (iv) an individual or entity present in the U.S., or (v) an individual or entity acting for the financial or other benefit of or on behalf of any U.S. Person;
|
||||
|
||||
2. a corporation, partnership, or other entity established or organized in or under the laws of the United States;
|
||||
|
||||
3. a corporation, partnership, or other entity formed by a U.S. Person principally for the purpose of investing in securities, unless it is organized or incorporated, and owned, by accredited investors who are not natural persons, estates or trusts;
|
||||
|
||||
4. an estate of which any executor or administrator is a U.S. Person (unless this executor or administrator is a professional fiduciary and shares with a non-U.S. Person investment discretion with respect to the assets of an estate that is governed by foreign law);
|
||||
|
||||
5. a trust if the trustee is a U.S. Person (unless this trustee is a professional fiduciary and shares with a non-U.S. Person investment discretion with respect to the trust assets and no beneficiary of the trust (and no settlor if the trust is revocable) is a U.S. Person);
|
||||
|
||||
6. an agency or branch of a non-U.S. entity located in the U.S.;
|
||||
|
||||
7. a non-discretionary account or similar account held by a dealer or other fiduciary for the benefit or account of a U.S. Person;
|
||||
|
||||
8. any discretionary account or similar account held by a dealer or other fiduciary organized, incorporated, or resident in the U.S. (held for the exclusive benefit or account of non-U.S. Persons); or
|
||||
|
||||
9. any government or government official of the United States.
|
||||
|
||||
In these Terms, United States or U.S. means the several states of the United States of America, the District of Columbia, Puerto Rico, the Virgin Islands, and the insular possessions of the United States of America.
|
||||
|
||||
## MobileCoin Wallets
|
||||
|
||||
No MobileCoin Wallet may be operated for and no order or transaction in a MobileCoin Wallet may be for the financial or other benefit of or on behalf of a Prohibited Person or U.S. Person. Persons, whether or not Prohibited Persons, are prohibited from operating a MobileCoin Wallet in any way or otherwise transacting on or using any MobileCoins and any MobileCoin Wallets while they or any individual (including any fiduciary, dealer, trustee, executor or administrator), agency or branch operating their MobileCoin Wallet on their behalf is present in the United States or any jurisdiction in which MobileCoins are unlawful.
|
||||
|
||||
Certain software comprising MobileCoin Wallets is available to the public without charge on an open source basis. This software is provided “as is” and “as available,” without warranty of any kind. However, MobileCoin Wallets linked to a Signal mobile messaging application or any other mobile messaging applications may integrate software from a third party. MobileCoin Wallets must be accessed through a telephone, computer or other equipment as well as a network connection through telecommunication lines or other utility. None of these components of the MobileCoin Wallet is provided or controlled by the Compliance Entities. The Compliance Entities and their Associates are not responsible for the accuracy or reliability of any open-source software or of any software, hardware, information, or advice provided by third parties or for their privacy and security policies and procedures.
|
||||
|
||||
Access to and use of your MobileCoin Wallet may from time to time be unavailable, delayed, limited or slowed due to failures of hardware, software, utility services or other causes outside the control of the Compliance Entities. You may suffer losses as a result of these delays and limitations. You assume all risks associated with the operation, performance and security of a MobileCoin Wallet. You are responsible for maintaining the security of your MobileCoin Wallet and any password or other security designed to limit access.
|
||||
|
||||
In addition to these Terms, you may be bound by any additional terms required by your third-party providers. These third parties’ terms may apply to your use of the MobileCoin Wallets. Please be aware that these Terms do not govern third parties’ relationships with you. These third parties, and not any Compliance Entity, are responsible for any product or service warranties, whether express or implied by law, provided to you.
|
||||
|
||||
## Nature of MobileCoins and Transactions in MobileCoins
|
||||
|
||||
MobileCoins are digital tokens. Digital tokens such as MobileCoins are not legal tender, are not backed by any government, and are not insured. MobileCoins do not provide you with any ownership of any physical asset or ownership or other interest or rights of any form with respect to the Compliance Entities or any affiliate or its revenue or assets, including any voting, distribution, redemption, liquidation, proprietary (including all forms of intellectual property), or other financial or legal rights. MobileCoins are distributed and offered on an as-is, where-is basis and, without limiting the generality of the foregoing, are offered without any representation as to merchantability or fitness for any particular purpose.
|
||||
|
||||
You accept that the Compliance Entities may be required to share your user information with other contractual third parties, including financial institutions, or as required under applicable laws or demanded upon a lawful request by any government. When information includes personal data under European Union law, the terms of the Privacy Policy will apply. Please consult the Privacy Policy available at the MobileCoin TS Ltd. website at http://www.buymobilecoin.com/.
|
||||
|
||||
You accept all consequences of sending MobileCoins. MobileCoin transactions are not reversible. Once you send MobileCoins to an address, whether intentionally or by a fraudulent or accidental transaction, you accept the risk that you may lose access to, and any claim on, those MobileCoins indefinitely or permanently.
|
||||
|
||||
## Prohibited Uses and Transfers of MobileCoins and Uses of MobileCoin Wallets
|
||||
|
||||
You may not:
|
||||
- use or transfer MobileCoins or access or use a MobileCoin Wallet in order to disguise the origin or nature of illicit proceeds of, or to further, any breach of applicable laws, or to transact or deal in any contraband funds, property, or proceeds;
|
||||
|
||||
- use or transfer MobileCoins or access or use a MobileCoin Wallet if such conduct is prohibited, penalized, or otherwise sanctionable under any applicable laws, including without limitation anti-money laundering laws, counter-terrorist financing laws, anti-corruption laws, and economic sanctions laws or would expose the Compliance Entities or their affiliates to liability under any applicable laws;
|
||||
|
||||
- use, transact, transfer, or trade MobileCoins (i) in the U.S.; (ii) with U.S. Persons; (iii) with persons or entities present in the U.S.; or (iv) if you are a U.S. Person, which includes but is not limited to while you are present in the U.S.;
|
||||
|
||||
- transfer MobileCoins to a Prohibited Person, a U.S. Person, or any individual or entity prohibited from using, transacting, transferring, trading, or receiving MobileCoins by these Terms or applicable laws;
|
||||
|
||||
- use or transfer MobileCoins or access or use a MobileCoin Wallet or any third party services to facilitate, approve, evade, avoid, or circumvent any applicable laws, including anti-money laundering laws, counter-terrorist financing laws, anti-corruption laws, and economic sanctions laws;
|
||||
|
||||
- use a U.S. financial institution in connection with any dealings involving MobileCoins or MobileCoin Wallets or the Compliance Entities;
|
||||
|
||||
- use or transfer MobileCoins or access or use a MobileCoin Wallet to evade taxes under applicable laws;
|
||||
|
||||
- use or transfer MobileCoins or access or use a MobileCoin Wallet to interfere with or subvert the rights or obligations of the Compliance Entities or the rights or obligations of any other individual or entity;
|
||||
|
||||
- use or transfer MobileCoins or access or use a MobileCoin Wallet by using misleading or inaccurate information or to take advantage of any technical glitch, malfunction, failure, delay, default, or security breach;
|
||||
|
||||
- use or transfer MobileCoins or access or use a MobileCoin Wallet to engage in conduct that is detrimental to the Compliance Entities or to any other individual or entity;
|
||||
|
||||
- falsify any information provided to the Compliance Entities or impersonate another individual or entity or misrepresent your affiliation with an individual or entity;
|
||||
|
||||
- falsify or materially omit any information or provide misleading or inaccurate information requested by the Compliance Entities;
|
||||
|
||||
- cause injury to, or attempt to harm, the Compliance Entities or any other individual or entity through your access to or use of any MobileCoins and any MobileCoin Wallets; or
|
||||
|
||||
- violate, promote, or cause a violation of, or conspire or attempt to violate these Terms or applicable laws.
|
||||
|
||||
Any of these uses may be described in these Terms as a Prohibited Use. Should your actions or inaction result in Loss being suffered by the Compliance Entities or any Associates, you will pay an amount to the Compliance Entities or the Associates so as to render the Compliance Entities or the Associates whole, including the amount of taxes or penalties that might be imposed on the Compliance Entities or the Associates.
|
||||
|
||||
In these Terms, Associates of the Compliance Entities means the successors, assignees and affiliates of MobileCoin TS Ltd. and their respective shareholders, directors, officers, affiliates, employees, contractors, agents, partners, insurers, attorneys, and any licensors of technology to the Compliance Entities.
|
||||
|
||||
In these Terms, Losses means any claim, application, loss, injury, delay, accident, cost, business interruption costs, or any other expenses (including attorneys’ fees or the costs of any claim or suit), including any incidental, direct, indirect, general, special, punitive, exemplary, or consequential damages, loss of goodwill or business profits, work stoppage, data loss, computer failure or malfunction, or any and all other commercial losses;
|
||||
|
||||
## Intellectual Property
|
||||
|
||||
The MobileCoin name and logo are protected trademarks. You agree not to appropriate, copy, reproduce, modify, display, or use these trademarks without express, prior, written permission from the Compliance Entities. All rights not expressly granted to you in these Terms are reserved.
|
||||
|
||||
## Your Representations and Warranties
|
||||
|
||||
You represent and warrant to the Compliance Entities on the date of your acceptance or deemed acceptance of these Terms and each day on which you use or transfer MobileCoins or each time you access or use a MobileCoin Wallet, in each case with reference to the facts and circumstances existing at such date, as follows:
|
||||
|
||||
- that, if you are an individual, you are 18 years of age or older and that you have the capacity to contract under applicable laws;
|
||||
|
||||
- that, if you are acting on behalf of a legal entity, (i) such legal entity is duly organized and validly existing under the applicable laws of the jurisdiction of its organization; and (ii) you are duly authorized by such legal entity to act on its behalf;
|
||||
|
||||
- that neither you nor any individual or entity acting on your behalf is a Prohibited Person or U.S. Person, or otherwise prohibited or restricted from purchasing or otherwise obtaining MobileCoins, using or transferring MobileCoins or accessing or using MobileCoin Wallets;
|
||||
|
||||
- that you will not engage in any Prohibited Uses or transfers, as described above;
|
||||
|
||||
- that you comply with the laws of your country of establishment, incorporation, residence, or location and, as applicable, the country from which you use any MobileCoins and any MobileCoin Wallets;
|
||||
|
||||
- that you understand and acknowledge that the Compliance Entities are not registered with or licensed by any financial regulatory authority in the British Virgin Islands or elsewhere; and that accordingly, no British Virgin Islands or other financial regulatory authority has passed upon the contents of these Terms or the merits of purchasing or using MobileCoins, nor have these Terms been filed with, or reviewed by any British Virgin Islands or other financial regulatory authority;
|
||||
|
||||
- that you have had the opportunity to seek legal, accounting, taxation and other professional advice regarding these Terms, any MobileCoins and any MobileCoin Wallets;
|
||||
|
||||
- that you are currently in compliance with, and must, at your own cost and expense, comply with all laws that relate to or affect these Terms, including anti-money laundering laws, counter-terrorist financing laws, anti-corruption laws, economic sanctions laws, Tax Information Exchange Laws or other tax laws;
|
||||
|
||||
- that you will not utilize any virtual private network, proxy service, or any other third-party service, or network for the purpose of disguising or misrepresenting your IP address or location in order to download or use the MobileCoin Wallet in a manner prohibited in these Terms;
|
||||
|
||||
- that you consent to any and all tax and information reporting under anti-money laundering laws, counter-terrorist financing laws, anti-corruption laws, economic sanctions laws, Tax Information Exchange Laws or other tax laws as the Compliance Entities may reasonably determine and to extent permitted by law;
|
||||
|
||||
- that neither you nor any of your affiliates are acting directly or indirectly (i) on behalf of or for the benefit of a Prohibited Person; (ii) in violation of or as prohibited, restricted, or penalized under applicable economic sanctions laws; or (iii) in any way that would violate, be inconsistent with, penalized under, or cause the omission of filing of any report required under applicable anti-money laundering laws, counter-terrorist financing laws, or economic sanctions laws;
|
||||
|
||||
- that neither you nor any of your affiliates is: (i) itself or owned (beneficially or of record) or controlled by a Prohibited Person; (ii) involved in any transaction, transfer, or conduct that is likely to result in you or your affiliates becoming a Prohibited Person; (iii) residing or domiciled in a Prohibited Jurisdiction or the United States; (iv) transferring any funds, where denominated in MobileCoin or another cryptocurrency or fiat currency, to, from, or through a Prohibited Jurisdiction or the United States in connection to any dealings or conduct with or involving the Compliance Entities; (v) a government or government official of a Prohibited Jurisdiction; or (vi) otherwise a Prohibited Person;
|
||||
|
||||
- that you will fairly and promptly report all income associated with your use, transaction, transfer, or trade of MobileCoins and access and use MobileCoin Wallets, as applicable, pursuant to applicable laws and pay any and all taxes thereon;
|
||||
|
||||
- that you will accurately and promptly inform the Compliance Entities if you know or have reason to know whether any of the foregoing representations or warranties no longer is correct or becomes incorrect; and
|
||||
|
||||
- you will use, transact, transfer, and trade MobileCoins and access and use your MobileCoin Wallet for consumptive, and not for investment, purposes.
|
||||
|
||||
In these Terms, Tax Information Exchange Laws means laws relating to the exchange of information relating to taxes between governments, including United States Foreign Account Tax Compliance Act, as enacted by Title V, Subtitle A of the Hiring Incentives to Restore Employment Act, P.L 111-147 (2010), as amended; and common reporting standard or the Standard for Automatic Exchange of Financial Account Information.
|
||||
|
||||
## No Representations or Advice by the Compliance Entities
|
||||
|
||||
The Compliance Entities make no representations, warranties, covenants or guarantees to you of any kind and, to the extent permitted by applicable laws, the Compliance Entities expressly disclaim all representations, warranties, covenants or guarantees, express, implied or statutory, with respect to MobileCoins and any MobileCoin Wallet. The MobileCoins and the MobileCoin Wallet are distributed and offered strictly on an as-is, where-is basis and, without limiting the generality of the foregoing, are distributed and offered without any representation as to merchantability or fitness for any particular purpose. The Compliance Entities do not provide any investment, legal, accounting, tax or other advice.
|
||||
|
||||
## Limitation of Liability, Release, and Indemnity
|
||||
|
||||
**Important: Except as may be provided for in these Terms, the Compliance Entities assume no liability or responsibility for and will have no liability or responsibility for any Losses directly or indirectly arising out of or related to:**
|
||||
|
||||
- **these Terms,**
|
||||
|
||||
- **MobileCoins and their use and transfer,**
|
||||
|
||||
- **your MobileCoin Wallet, and your access and use of it,**
|
||||
|
||||
- **to the extent permitted by law, any stolen, lost, or unauthorized use of your personal information, any breach of security or data breach related to your personal information, or any criminal or other third-party act affecting the Compliance Entities, or**
|
||||
|
||||
- **any representation, suggestion, statement, or claim made about MobileCoins or the MobileCoin Wallet.**
|
||||
|
||||
**You agree to release the Compliance Entities and its Associates from liability for any and all Losses, and you will indemnify and save and hold the Compliance Entities and its Associates harmless from and against all Losses. The foregoing limitations of liability will apply, to the extent permitted by law, whether the alleged liability or losses are based on contract, negligence, tort, unjust enrichment, strict liability, violation of law or regulation, or any other basis, even if the Compliance Entities and its Associates have been advised of or should have known of the possibility of such losses and damages, and without regard to the success or effectiveness of any other remedies.**
|
||||
|
||||
## Electronic Communications
|
||||
|
||||
You agree and consent to receive electronically all communications, agreements, documents, receipts, notices and disclosures that the Compliance Entities may provide in connection with these Terms. Information in relation to how we may communicate with you and your rights in that respect can be found in the Privacy Policy at http://www.buymobilecoin.com/.
|
||||
|
||||
## Miscellaneous
|
||||
|
||||
Any right or remedy of the Compliance Entities set forth in these Terms is in addition to, and not in lieu of, any other right or remedy whether described in these Terms, at law or in equity. The Compliance Entities’ failure or delay in exercising any right, power, or privilege under these Terms will not operate as a waiver thereof. The invalidity or unenforceability of any of these Terms will not affect the validity or enforceability of any other of these Terms, all of which will remain in full force and effect. The Compliance Entities will have no responsibility or liability for any failure or delay in performance, or any loss or damage that you may incur, due to any Force Majeure or circumstance or event beyond its control. You may not assign or transfer any of your rights or obligations under these Terms, without the Compliance Entities’ prior written consent, including by operation of law or in connection with any change of control. The Compliance Entities may assign or transfer any or all of it rights or obligations under these Terms, without notice or your consent. If there is a conflict between these Terms and any other agreement you may have with the Compliance Entities, these Terms will control unless the other agreement specifically identifies these Terms and declares that the other agreement supersedes these Terms. If one or more provisions of these Terms is invalidated or declared ineffective, all other provisions of these Terms shall remain in full force and effect. These Terms do not create any third-party beneficiary rights in any person, save that any Compliance Entity or any of its respective Associates may rely on these Terms in any action, suit, proceeding or other dispute brought against it by you, to exercise any right or to benefit from any limitation expressly provided to it hereunder and to enforce such provisions of these Terms as if party hereto.
|
||||
|
||||
## Governing Law and Resolution of Disputes
|
||||
|
||||
Any dispute, claim, controversy or action arising out of or related to (a) these Terms or the existence, breach, termination, enforcement, interpretation or validity thereof or (b) your MobileCoins or MobileCoin Wallet, will be subject to the exclusive jurisdiction of the courts of the British Virgin Islands. For the avoidance of doubt, and without limiting the generality of the foregoing, this provision expressly applies to any claim, whether in tort, contract or otherwise, against the Compliance Entities.
|
||||
|
||||
You irrevocably and unconditionally agree and consent to the jurisdiction and venue of the courts of the British Virgin Islands, and you waive any objections thereto, including under the doctrine of forum non conveniens or other similar doctrines. The foregoing shall be without prejudice to any applicable provisions of mandatory consumer protection law under the laws of your country of residence, to the extent that these offer you more protection.
|
||||
|
||||
Any complaint or dispute is personal to you and you agree that it will not be brought as a class action, class arbitration or any other type of representative proceeding. There will be no class action in which you attempt to resolve a complaint or dispute as a representative of another individual or group of individuals, save with the express agreement in writing of the relevant Compliance Entity.
|
||||
|
||||
JURY TRIAL WAIVER: TO THE FULLEST EXTENT PERMITTED BY APPLICABLE LAW, THE PARTIES HEREBY IRREVOCABLY AND UNCONDITIONALLY WAIVE ALL RIGHT TO TRIAL BY JURY IN ANY LEGAL ACTION OR PROCEEDING OF ANY KIND WHATSOVER ARISING OUT OF OR RELATING TO THESE TERMS OR ANY BREACH THEREOF, ANY USE OR ATTEMPTED USE OR TRANSFER OF MOBILECOINS OR USE OR ATTEMPED USE OF A MOBILECOIN WALLET BY YOU, AND/OR ANY OTHER MATTER INVOLVING THE PARTIES.
|
||||
|
||||
## Language and Contact
|
||||
|
||||
These Terms and any information or notifications that are provided under these Terms shall be in English.
|
||||
|
||||
If you have any questions relating to these Terms, your rights and obligations arising from these Terms and/or your use of any MobileCoins and any MobileCoin Wallets or any other matter, please utilize the question form on the MobileCoin TS Ltd. website at http://www.buymobilecoin.com/.
|
||||
1
Vendor/fog
vendored
Submodule
1
Vendor/fog
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 890b43206c0ea4e6097316cfdc36ffc92940aedd
|
||||
Loading…
Reference in New Issue
Block a user