Offline Transaction Signing (OTS) 0.1.0
Loading...
Searching...
No Matches
ots.h File Reference

Header for the C ABI (Application Binary Interface) library. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "ots-errors.h"
Include dependency graph for ots.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ots_handle_t
 Handle structure for C objects. More...
 
struct  ots_error_t
 Error structure for exception handling. More...
 
struct  ots_result_t
 Result structure combining handle and error. More...
 
struct  ots_wipeable_string_t
 Wipeable string for sensitive data. More...
 
struct  ots_seed_indices_t
 Seed indices container. More...
 
struct  ots_tx_description_t
 Transaction description. More...
 
struct  ots_tx_warning_t
 Transaction warning. More...
 

Macros

#define OTS_MAX_ERROR_MESSAGE   256
 Maximum length for error messages.
 
#define OTS_MAX_ERROR_LOCATION   64
 Maximum length for error location strings.
 
#define OTS_MAX_VERSION_STRING   32
 Maximum length for version strings.
 
#define OTS_MONERO_SEED_WORDS   25
 Seed phrase lengths.
 
#define OTS_POLYSEED_WORDS   16
 
#define OTS_LEGACY_SEED_WORDS   13
 

Enumerations

enum  OTS_NETWORK { OTS_NETWORK_MAIN , OTS_NETWORK_TEST , OTS_NETWORK_STAGE }
 Network types matching ots::Network. More...
 
enum  OTS_ADDRESS_TYPE { OTS_ADDRESS_TYPE_STANDARD , OTS_ADDRESS_TYPE_SUBADDRESS , OTS_ADDRESS_TYPE_INTEGRATED }
 Address types matching ots::AddressType. More...
 
enum  OTS_SEED_TYPE { OTS_SEED_TYPE_MONERO , OTS_SEED_TYPE_POLYSEED }
 Seed types matching ots::SeedType. More...
 
enum  ots_handle_type { OTS_HANDLE_INVALID = 0 , OTS_HANDLE_SEED , OTS_HANDLE_WALLET , OTS_HANDLE_TX }
 Types of handles for type safety. More...
 

Functions

static bool ots_handle_valid (ots_handle_t h, ots_handle_type expected)
 Validate handle type.
 
void ots_error_init (ots_error_t *error)
 Initialize error structure.
 
bool ots_is_error (const ots_result_t *result)
 Check if result contains an error.
 
ots_result_t ots_get_last_error (void)
 Get error message for last error.
 
ots_result_t ots_get_error_message (int32_t error_code)
 Get error message for specific error code.
 
void ots_clear_error (void)
 Clear last error state.
 
bool ots_has_error (const ots_result_t *result)
 Check if result contains an error.
 
void ots_wipeable_string_free (ots_wipeable_string_t *str)
 Free a wipeable string, securely wiping memory.
 
void ots_seed_indices_free (ots_seed_indices_t *indices)
 Free seed indices, securely wiping memory.
 
void ots_free_string (char *str)
 Free a string allocated by the library.
 
void ots_free_array (void *arr)
 Free an array allocated by the library.
 
void ots_free_handle (ots_handle_t handle)
 Free a handle.
 
void ots_free_tx_description (ots_tx_description_t *desc)
 Free transaction description.
 
void ots_secure_free (void *buffer, size_t size)
 Securely wipe and free a buffer.
 
ots_result_t ots_wipeable_string_create (const char *str)
 Create a new wipeable string.
 
ots_result_t ots_wipeable_string_compare (const ots_wipeable_string_t *str1, const ots_wipeable_string_t *str2)
 Compare two wipeable strings.
 
void ots_wipeable_string_clear (ots_wipeable_string_t *str)
 Clear wipeable string content.
 
ots_result_t ots_seed_indices_create (size_t size)
 Create seed indices container.
 
void ots_seed_indices_clear (ots_seed_indices_t *indices)
 Clear seed indices content.
 
ots_result_t ots_version (void)
 Get library version string.
 
ots_result_t ots_version_components (void)
 Get version components [major, minor, patch].
 
ots_result_t ots_seed_phrase (ots_handle_t handle, const char *language_code, const char *password)
 Get seed phrase in specified language.
 
ots_result_t ots_seed_languages (OTS_SEED_TYPE type)
 Get supported languages for seed type.
 
ots_result_t ots_seed_indices (ots_handle_t handle, const char *password)
 Get seed indices.
 
ots_result_t ots_seed_fingerprint (ots_handle_t handle)
 Get seed fingerprint.
 
ots_result_t ots_seed_address (ots_handle_t handle)
 Get seed address.
 
ots_result_t ots_seed_timestamp (ots_handle_t handle)
 Get seed creation timestamp.
 
ots_result_t ots_seed_height (ots_handle_t handle)
 Get seed blockchain height.
 
ots_result_t ots_seed_network (ots_handle_t handle)
 Get seed network type.
 
ots_result_t ots_seed_wallet (ots_handle_t handle)
 Get wallet from seed.
 
ots_result_t ots_seed_merge_values (const ots_seed_indices_t *values1, const ots_seed_indices_t *values2)
 Merge two sets of seed values.
 
ots_result_t ots_seed_merge_with_password (const char *password, const ots_seed_indices_t *values)
 Merge seed values with password.
 
ots_result_t ots_seed_merge_multiple_values (const ots_seed_indices_t *values[], size_t count)
 Merge multiple sets of seed values.
 
ots_result_t ots_seed_merge_values_and_zero (ots_seed_indices_t *values1, ots_seed_indices_t *values2, bool delete_after)
 Merge and zero two sets of seed values.
 
ots_result_t ots_seed_merge_values_with_password_and_zero (char *password, ots_seed_indices_t *values, bool delete_after)
 Merge seed values with password and zero.
 
ots_result_t ots_seed_merge_multiple_values_and_zero (ots_seed_indices_t *values[], size_t count, bool delete_after)
 Merge multiple sets of seed values and zero.
 
ots_result_t ots_legacy_seed_decode (const char *phrase, uint64_t height, uint64_t time, OTS_NETWORK network)
 Decode a legacy (13 word) seed from phrase.
 
ots_result_t ots_legacy_seed_decode_indices (const ots_seed_indices_t *indices, uint64_t height, uint64_t time, OTS_NETWORK network)
 Decode a legacy seed from indices.
 
ots_result_t ots_monero_seed_create (const uint8_t random[32], uint64_t height, uint64_t time, OTS_NETWORK network)
 Create a Monero seed from random data.
 
ots_result_t ots_monero_seed_generate (uint64_t height, uint64_t time, OTS_NETWORK network)
 Generate a new Monero seed.
 
ots_result_t ots_monero_seed_decode (const char *phrase, uint64_t height, uint64_t time, OTS_NETWORK network, const char *passphrase)
 Decode a Monero seed from phrase.
 
ots_result_t ots_monero_seed_decode_indices (const ots_seed_indices_t *indices, uint64_t height, uint64_t time, OTS_NETWORK network, const char *passphrase)
 Decode a Monero seed from indices.
 
ots_result_t ots_polyseed_create (const uint8_t random[19], OTS_NETWORK network, uint64_t time, const char *passphrase)
 Create a Polyseed from random data.
 
ots_result_t ots_polyseed_generate (OTS_NETWORK network, uint64_t time, const char *passphrase)
 Generate a new Polyseed.
 
ots_result_t ots_polyseed_decode (const char *phrase, OTS_NETWORK network, const char *password, const char *passphrase)
 Decode a Polyseed from phrase.
 
ots_result_t ots_polyseed_decode_indices (const ots_seed_indices_t *indices, OTS_NETWORK network, const char *password, const char *passphrase)
 Decode a Polyseed from indices.
 
ots_result_t ots_polyseed_decode_with_language (const char *phrase, const char *language_code, OTS_NETWORK network, const char *password, const char *passphrase)
 Decode a Polyseed from phrase with specific language.
 
ots_result_t ots_address_type (ots_handle_t address)
 Get address type.
 
ots_result_t ots_address_network (ots_handle_t address)
 Get network type for an address.
 
ots_result_t ots_address_fingerprint (ots_handle_t address)
 Generate fingerprint for an address.
 
ots_result_t ots_address_is_integrated (ots_handle_t address)
 Check if address is an integrated address.
 
ots_result_t ots_address_payment_id (ots_handle_t address)
 Extract payment ID from integrated address.
 
ots_result_t ots_address_from_integrated (ots_handle_t address)
 Get base address from integrated address.
 
ots_result_t ots_address_length (ots_handle_t address)
 Get address length.
 
ots_result_t ots_address_base58_string (ots_handle_t address_handle)
 Get base58 string representation of address.
 
ots_result_t ots_address_equal (ots_handle_t address1, ots_handle_t address2)
 Compare two addresses for equality.
 
ots_result_t ots_address_equal_string (ots_handle_t address_handle, const char *address_string)
 Compare address handle with string.
 
ots_result_t ots_address_create (const char *address)
 Create address object from string.
 
void ots_address_free (ots_handle_t handle)
 Free address handle.
 
ots_result_t ots_address_string_valid (const char *address, OTS_NETWORK network)
 Validate a Monero address.
 
ots_result_t ots_address_string_network (const char *address)
 Get network type for an address string.
 
ots_result_t ots_address_string_type (const char *address)
 Get type for an address string.
 
ots_result_t ots_address_string_fingerprint (const char *address)
 Generate fingerprint for an address string.
 
ots_result_t ots_address_string_is_integrated (const char *address)
 Check if address string is integrated.
 
ots_result_t ots_address_string_payment_id (const char *address)
 Extract payment ID from integrated address string.
 
ots_result_t ots_address_string_integrated (const char *address)
 Get base address from integrated address string.
 
ots_result_t ots_wallet_create (const uint8_t key[32], uint64_t height, OTS_NETWORK network)
 Create wallet from secret key.
 
ots_result_t ots_wallet_height (ots_handle_t wallet_handle)
 Get wallet restore height.
 
ots_result_t ots_wallet_address (ots_handle_t wallet_handle, uint32_t account, uint32_t index)
 Generate address for wallet.
 
ots_result_t ots_wallet_accounts (ots_handle_t wallet_handle, uint32_t max, uint32_t offset)
 Get list of accounts in wallet.
 
ots_result_t ots_wallet_subaddresses (ots_handle_t wallet_handle, uint32_t account, uint32_t max, uint32_t offset)
 Get list of subaddresses for an account.
 
ots_result_t ots_wallet_has_address (ots_handle_t wallet_handle, const char *address, uint32_t max_account_depth, uint32_t max_index_depth)
 Check if address belongs to wallet.
 
ots_result_t ots_wallet_has_address_handle (ots_handle_t wallet_handle, ots_handle_t address_handle, uint32_t max_account_depth, uint32_t max_index_depth)
 Check if address belongs to wallet using Address handle.
 
ots_result_t ots_wallet_address_index (ots_handle_t wallet_handle, const char *address, uint32_t max_account_depth, uint32_t max_index_depth)
 Get account and index for address in wallet.
 
ots_result_t ots_wallet_address_index_handle (ots_handle_t wallet_handle, ots_handle_t address_handle, uint32_t max_account_depth, uint32_t max_index_depth)
 Get account and index for address handle in wallet.
 
ots_result_t ots_wallet_secret_view_key (ots_handle_t wallet_handle)
 Get secret view key.
 
ots_result_t ots_wallet_public_view_key (ots_handle_t wallet_handle)
 Get public view key.
 
ots_result_t ots_wallet_secret_spend_key (ots_handle_t wallet_handle)
 Get secret spend key.
 
ots_result_t ots_wallet_public_spend_key (ots_handle_t wallet_handle)
 Get public spend key.
 
ots_result_t ots_wallet_import_outputs (ots_handle_t wallet_handle, const char *outputs)
 Import outputs from string.
 
ots_result_t ots_wallet_export_key_images (ots_handle_t wallet_handle)
 Export key images.
 
ots_result_t ots_wallet_describe_tx (ots_handle_t wallet_handle, const char *unsigned_tx)
 Describe unsigned transaction.
 
ots_result_t ots_wallet_check_tx (ots_handle_t wallet_handle, ots_handle_t unsigned_tx_handle)
 Check transaction for warnings.
 
ots_result_t ots_wallet_check_tx_string (ots_handle_t wallet_handle, const char *unsigned_tx)
 Check transaction string for warnings.
 
ots_result_t ots_wallet_sign_transaction (ots_handle_t wallet_handle, const char *unsigned_tx)
 Sign unsigned transaction.
 
ots_result_t ots_wallet_sign_data (ots_handle_t wallet_handle, const char *data)
 Sign arbitrary data.
 
ots_result_t ots_wallet_sign_data_with_index (ots_handle_t wallet_handle, const char *data, uint32_t account, uint32_t subaddr)
 Sign data with specific subaddress.
 
ots_result_t ots_wallet_sign_data_with_address (ots_handle_t wallet_handle, const char *data, ots_handle_t address_handle)
 Sign data with specific address.
 
ots_result_t ots_wallet_verify_data (const char *data, const char *signature, bool legacy_fallback)
 Verify signed data for the wallet address with legacy support.
 
ots_result_t ots_wallet_verify_data_with_index (ots_handle_t wallet_handle, const char *data, uint32_t account, uint32_t subaddr, const char *signature, bool legacy_fallback)
 Verify signed data with specific subaddress.
 
ots_result_t ots_wallet_verify_data_with_address (ots_handle_t wallet_handle, const char *data, ots_handle_t address_handle, const char *signature, bool legacy_fallback)
 Verify signed data with specific address.
 
ots_result_t ots_height_from_timestamp (uint64_t timestamp, OTS_NETWORK network)
 Convert timestamp to estimated block height.
 
ots_result_t ots_timestamp_from_height (uint64_t height, OTS_NETWORK network)
 Convert block height to estimated timestamp.
 
ots_result_t ots_random_bytes (uint8_t *buffer, size_t size)
 Generate random bytes.
 
ots_result_t ots_random_32 (void)
 Generate 32 random bytes.
 
ots_result_t ots_check_entropy (const uint8_t *data, size_t size, double min_entropy)
 Check data entropy level.
 
void ots_set_enforce_entropy (bool enforce)
 Set entropy enforcement.
 
void ots_set_max_account_depth (uint32_t depth)
 Set maximum account depth for searching.
 
void ots_set_max_index_depth (uint32_t depth)
 Set maximum index depth for searching.
 
void ots_set_max_depth (uint32_t account_depth, uint32_t index_depth)
 Set maximum depths for searching.
 
void ots_reset_max_depth (void)
 Reset maximum depths to defaults.
 
uint32_t ots_max_account_depth (uint32_t depth)
 Get maximum account depth.
 
uint32_t ots_max_index_depth (uint32_t depth)
 Get maximum index depth.
 
ots_result_t ots_verify_data (const char *data, const char *address, const char *signature)
 Verify signed data.
 

Detailed Description

Header for the C ABI (Application Binary Interface) library.

This header provides a pure C-compatible interface to the C++ implementation. All functions that return pointers or handles require explicit memory management using the corresponding free functions to prevent memory leaks.

Note
All functions returning an ots_result_t must be checked for errors using ots_is_error() before accessing the result.

Macro Definition Documentation

◆ OTS_LEGACY_SEED_WORDS

#define OTS_LEGACY_SEED_WORDS   13

◆ OTS_MAX_ERROR_LOCATION

#define OTS_MAX_ERROR_LOCATION   64

Maximum length for error location strings.

◆ OTS_MAX_ERROR_MESSAGE

#define OTS_MAX_ERROR_MESSAGE   256

Maximum length for error messages.

◆ OTS_MAX_VERSION_STRING

#define OTS_MAX_VERSION_STRING   32

Maximum length for version strings.

◆ OTS_MONERO_SEED_WORDS

#define OTS_MONERO_SEED_WORDS   25

Seed phrase lengths.

◆ OTS_POLYSEED_WORDS

#define OTS_POLYSEED_WORDS   16

Enumeration Type Documentation

◆ OTS_ADDRESS_TYPE

Address types matching ots::AddressType.

Enumerator
OTS_ADDRESS_TYPE_STANDARD 

Standard Monero address

OTS_ADDRESS_TYPE_SUBADDRESS 

Sub-address

OTS_ADDRESS_TYPE_INTEGRATED 

Integrated address with payment ID

◆ ots_handle_type

Types of handles for type safety.

Enumerator
OTS_HANDLE_INVALID 
OTS_HANDLE_SEED 
OTS_HANDLE_WALLET 
OTS_HANDLE_TX 

◆ OTS_NETWORK

Network types matching ots::Network.

Enumerator
OTS_NETWORK_MAIN 

Main production network

OTS_NETWORK_TEST 

Test development network

OTS_NETWORK_STAGE 

Staging pre-production network

◆ OTS_SEED_TYPE

Seed types matching ots::SeedType.

Enumerator
OTS_SEED_TYPE_MONERO 

Monero 25-word seed

OTS_SEED_TYPE_POLYSEED 

Polyseed 16-word seed

Function Documentation

◆ ots_address_base58_string()

ots_result_t ots_address_base58_string ( ots_handle_t  address_handle)

Get base58 string representation of address.

Parameters
[in]address_handleAddress handle
Returns
Result containing address string

◆ ots_address_create()

ots_result_t ots_address_create ( const char *  address)

Create address object from string.

Parameters
[in]addressAddress string
Returns
Result containing address handle
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid
Note
This creates a managed address object that can be used with other functions

◆ ots_address_equal()

ots_result_t ots_address_equal ( ots_handle_t  address1,
ots_handle_t  address2 
)

Compare two addresses for equality.

Parameters
[in]address1First address
[in]address2Second address
Returns
Result containing boolean equality status
Exceptions
OTS_ERROR_INVALID_ADDRESSif either address is invalid

◆ ots_address_equal_string()

ots_result_t ots_address_equal_string ( ots_handle_t  address_handle,
const char *  address_string 
)

Compare address handle with string.

Parameters
[in]address_handleAddress handle
[in]address_stringAddress string to compare
Returns
Result containing boolean equality status

◆ ots_address_fingerprint()

ots_result_t ots_address_fingerprint ( ots_handle_t  address)

Generate fingerprint for an address.

Parameters
[in]addressThe address to generate fingerprint for
Returns
Result containing fingerprint string
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid
Note
Fingerprint is the last 6 digits of sha256(address) as uppercase hex

◆ ots_address_free()

void ots_address_free ( ots_handle_t  handle)

Free address handle.

Parameters
[in]handleAddress handle to free

◆ ots_address_from_integrated()

ots_result_t ots_address_from_integrated ( ots_handle_t  address)

Get base address from integrated address.

Parameters
[in]addressThe integrated address
Returns
Result containing base address string
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid
OTS_ERROR_NOT_INTEGRATEDif address is not an integrated address

◆ ots_address_is_integrated()

ots_result_t ots_address_is_integrated ( ots_handle_t  address)

Check if address is an integrated address.

Parameters
[in]addressThe address to check
Returns
Result containing boolean status
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid

◆ ots_address_length()

ots_result_t ots_address_length ( ots_handle_t  address)

Get address length.

Parameters
[in]addressThe address to check
Returns
Result containing address length
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid

◆ ots_address_network()

ots_result_t ots_address_network ( ots_handle_t  address)

Get network type for an address.

Parameters
[in]addressThe address to check
Returns
Result containing network type
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid

◆ ots_address_payment_id()

ots_result_t ots_address_payment_id ( ots_handle_t  address)

Extract payment ID from integrated address.

Parameters
[in]addressThe integrated address
Returns
Result containing payment ID string
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid
OTS_ERROR_NOT_INTEGRATEDif address is not an integrated address

◆ ots_address_string_fingerprint()

ots_result_t ots_address_string_fingerprint ( const char *  address)

Generate fingerprint for an address string.

Parameters
[in]addressThe address string
Returns
Result containing fingerprint string
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid

◆ ots_address_string_integrated()

ots_result_t ots_address_string_integrated ( const char *  address)

Get base address from integrated address string.

Parameters
[in]addressThe integrated address string
Returns
Result containing base address string
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid
OTS_ERROR_NOT_INTEGRATEDif address is not integrated

◆ ots_address_string_is_integrated()

ots_result_t ots_address_string_is_integrated ( const char *  address)

Check if address string is integrated.

Parameters
[in]addressThe address string to check
Returns
Result containing boolean status
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid

◆ ots_address_string_network()

ots_result_t ots_address_string_network ( const char *  address)

Get network type for an address string.

Parameters
[in]addressThe address string to check
Returns
Result containing network type
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid

◆ ots_address_string_payment_id()

ots_result_t ots_address_string_payment_id ( const char *  address)

Extract payment ID from integrated address string.

Parameters
[in]addressThe integrated address string
Returns
Result containing payment ID string
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid
OTS_ERROR_NOT_INTEGRATEDif address is not integrated

◆ ots_address_string_type()

ots_result_t ots_address_string_type ( const char *  address)

Get type for an address string.

Parameters
[in]addressThe address string to check
Returns
Result containing address type
Exceptions
OTS_ERROR_INVALID_ADDRESSif address is invalid

◆ ots_address_string_valid()

ots_result_t ots_address_string_valid ( const char *  address,
OTS_NETWORK  network 
)

Validate a Monero address.

Parameters
[in]addressAddress to validate
[in]networkNetwork to validate against
Returns
Result containing validation status

◆ ots_address_type()

ots_result_t ots_address_type ( ots_handle_t  address)

Get address type.

Parameters
[in]addressAddress to check
Returns
Result containing address type

◆ ots_check_entropy()

ots_result_t ots_check_entropy ( const uint8_t *  data,
size_t  size,
double  min_entropy 
)

Check data entropy level.

Parameters
[in]dataData to check
[in]sizeSize of data
[in]min_entropyMinimum required entropy
Returns
Result containing boolean (true if entropy is sufficient)

◆ ots_clear_error()

void ots_clear_error ( void  )

Clear last error state.

◆ ots_error_init()

void ots_error_init ( ots_error_t error)

Initialize error structure.

Parameters
[out]errorError structure to initialize

◆ ots_free_array()

void ots_free_array ( void *  arr)

Free an array allocated by the library.

Parameters
[in]arrArray to free

◆ ots_free_handle()

void ots_free_handle ( ots_handle_t  handle)

Free a handle.

Parameters
[in]handleHandle to free

◆ ots_free_string()

void ots_free_string ( char *  str)

Free a string allocated by the library.

Parameters
[in]strString to free

◆ ots_free_tx_description()

void ots_free_tx_description ( ots_tx_description_t desc)

Free transaction description.

Parameters
[in]descTransaction description to free

◆ ots_get_error_message()

ots_result_t ots_get_error_message ( int32_t  error_code)

Get error message for specific error code.

Parameters
[in]error_codeError code to get message for
Returns
Result containing error message string

◆ ots_get_last_error()

ots_result_t ots_get_last_error ( void  )

Get error message for last error.

Returns
Result containing error message string

◆ ots_handle_valid()

static bool ots_handle_valid ( ots_handle_t  h,
ots_handle_type  expected 
)
inlinestatic

Validate handle type.

◆ ots_has_error()

bool ots_has_error ( const ots_result_t result)

Check if result contains an error.

Parameters
[in]resultResult to check
Returns
true if result contains an error

◆ ots_height_from_timestamp()

ots_result_t ots_height_from_timestamp ( uint64_t  timestamp,
OTS_NETWORK  network 
)

Convert timestamp to estimated block height.

Parameters
[in]timestampUnix timestamp
[in]networkNetwork type
Returns
Result containing estimated block height

◆ ots_is_error()

bool ots_is_error ( const ots_result_t result)

Check if result contains an error.

Parameters
[in]resultResult to check
Returns
true if result contains an error

◆ ots_legacy_seed_decode()

ots_result_t ots_legacy_seed_decode ( const char *  phrase,
uint64_t  height,
uint64_t  time,
OTS_NETWORK  network 
)

Decode a legacy (13 word) seed from phrase.

Parameters
[in]phraseThe seed phrase
[in]heightOptional blockchain height (0 for none)
[in]timeOptional timestamp (0 for none)
[in]networkNetwork type (default: MAIN)
Returns
Result containing seed handle
Exceptions
OTS_ERROR_INVALID_SEEDif decoding fails

◆ ots_legacy_seed_decode_indices()

ots_result_t ots_legacy_seed_decode_indices ( const ots_seed_indices_t indices,
uint64_t  height,
uint64_t  time,
OTS_NETWORK  network 
)

Decode a legacy seed from indices.

Parameters
[in]indicesArray of seed word indices
[in]heightOptional blockchain height (0 for none)
[in]timeOptional timestamp (0 for none)
[in]networkNetwork type (default: MAIN)
Returns
Result containing seed handle
Exceptions
OTS_ERROR_INVALID_SEEDif decoding fails

◆ ots_max_account_depth()

uint32_t ots_max_account_depth ( uint32_t  depth)

Get maximum account depth.

Parameters
[in]depthOptional new depth (0 to just query current)
Returns
Current/new maximum account depth

◆ ots_max_index_depth()

uint32_t ots_max_index_depth ( uint32_t  depth)

Get maximum index depth.

Parameters
[in]depthOptional new depth (0 to just query current)
Returns
Current/new maximum index depth

◆ ots_monero_seed_create()

ots_result_t ots_monero_seed_create ( const uint8_t  random[32],
uint64_t  height,
uint64_t  time,
OTS_NETWORK  network 
)

Create a Monero seed from random data.

Parameters
[in]random32-byte random input
[in]heightOptional blockchain height (0 for none)
[in]timeOptional timestamp (0 for none)
[in]networkNetwork type (default: MAIN)
Returns
Result containing seed handle
Exceptions
OTS_ERROR_INVALID_INPUTif random data is invalid

◆ ots_monero_seed_decode()

ots_result_t ots_monero_seed_decode ( const char *  phrase,
uint64_t  height,
uint64_t  time,
OTS_NETWORK  network,
const char *  passphrase 
)

Decode a Monero seed from phrase.

Parameters
[in]phraseThe seed phrase
[in]heightOptional blockchain height (0 for none)
[in]timeOptional timestamp (0 for none)
[in]networkNetwork type (default: MAIN)
[in]passphraseOptional passphrase (empty string for none)
Returns
Result containing seed handle
Exceptions
OTS_ERROR_INVALID_SEEDif decoding fails

◆ ots_monero_seed_decode_indices()

ots_result_t ots_monero_seed_decode_indices ( const ots_seed_indices_t indices,
uint64_t  height,
uint64_t  time,
OTS_NETWORK  network,
const char *  passphrase 
)

Decode a Monero seed from indices.

Parameters
[in]indicesArray of seed word indices
[in]heightOptional blockchain height (0 for none)
[in]timeOptional timestamp (0 for none)
[in]networkNetwork type (default: MAIN)
[in]passphraseOptional passphrase (empty string for none)
Returns
Result containing seed handle
Exceptions
OTS_ERROR_INVALID_SEEDif decoding fails

◆ ots_monero_seed_generate()

ots_result_t ots_monero_seed_generate ( uint64_t  height,
uint64_t  time,
OTS_NETWORK  network 
)

Generate a new Monero seed.

Parameters
[in]heightOptional blockchain height (0 for none)
[in]timeOptional timestamp (0 for none)
[in]networkNetwork type (default: MAIN)
Returns
Result containing seed handle

◆ ots_polyseed_create()

ots_result_t ots_polyseed_create ( const uint8_t  random[19],
OTS_NETWORK  network,
uint64_t  time,
const char *  passphrase 
)

Create a Polyseed from random data.

Parameters
[in]random19-byte random input
[in]networkNetwork type (default: MAIN)
[in]timeOptional timestamp (0 for current time)
[in]passphraseOptional passphrase for seed offset (empty string for none)
Returns
Result containing seed handle
Exceptions
OTS_ERROR_INVALID_INPUTif random data is invalid

◆ ots_polyseed_decode()

ots_result_t ots_polyseed_decode ( const char *  phrase,
OTS_NETWORK  network,
const char *  password,
const char *  passphrase 
)

Decode a Polyseed from phrase.

Parameters
[in]phraseThe seed phrase
[in]networkNetwork type (default: MAIN)
[in]passwordOptional decryption password (empty string for none)
[in]passphraseOptional passphrase for seed offset (empty string for none)
Returns
Result containing seed handle
Exceptions
OTS_ERROR_INVALID_SEEDif decoding fails

◆ ots_polyseed_decode_indices()

ots_result_t ots_polyseed_decode_indices ( const ots_seed_indices_t indices,
OTS_NETWORK  network,
const char *  password,
const char *  passphrase 
)

Decode a Polyseed from indices.

Parameters
[in]indicesArray of seed word indices
[in]networkNetwork type (default: MAIN)
[in]passwordOptional decryption password (empty string for none)
[in]passphraseOptional passphrase for seed offset (empty string for none)
Returns
Result containing seed handle
Exceptions
OTS_ERROR_INVALID_SEEDif decoding fails

◆ ots_polyseed_decode_with_language()

ots_result_t ots_polyseed_decode_with_language ( const char *  phrase,
const char *  language_code,
OTS_NETWORK  network,
const char *  password,
const char *  passphrase 
)

Decode a Polyseed from phrase with specific language.

Parameters
[in]phraseThe seed phrase
[in]language_codeLanguage code for the phrase
[in]networkNetwork type (default: MAIN)
[in]passwordOptional decryption password (empty string for none)
[in]passphraseOptional passphrase for seed offset (empty string for none)
Returns
Result containing seed handle
Exceptions
OTS_ERROR_INVALID_SEEDif decoding fails

◆ ots_polyseed_generate()

ots_result_t ots_polyseed_generate ( OTS_NETWORK  network,
uint64_t  time,
const char *  passphrase 
)

Generate a new Polyseed.

Parameters
[in]networkNetwork type (default: MAIN)
[in]timeOptional timestamp (0 for current time)
[in]passphraseOptional passphrase for seed offset (empty string for none)
Returns
Result containing seed handle

◆ ots_random_32()

ots_result_t ots_random_32 ( void  )

Generate 32 random bytes.

Returns
Result containing 32-byte array
Warning
Entropy quality depends on system random number generator

◆ ots_random_bytes()

ots_result_t ots_random_bytes ( uint8_t *  buffer,
size_t  size 
)

Generate random bytes.

Parameters
[out]bufferBuffer to receive random bytes
[in]sizeNumber of bytes to generate
Returns
Result containing status
Warning
Entropy quality depends on system random number generator

◆ ots_reset_max_depth()

void ots_reset_max_depth ( void  )

Reset maximum depths to defaults.

◆ ots_secure_free()

void ots_secure_free ( void *  buffer,
size_t  size 
)

Securely wipe and free a buffer.

Parameters
[in,out]bufferBuffer to wipe and free
[in]sizeSize of buffer

◆ ots_seed_address()

ots_result_t ots_seed_address ( ots_handle_t  handle)

Get seed address.

Parameters
[in]handleSeed handle
Returns
Result containing address handle

◆ ots_seed_fingerprint()

ots_result_t ots_seed_fingerprint ( ots_handle_t  handle)

Get seed fingerprint.

Parameters
[in]handleSeed handle
Returns
Result containing fingerprint string

◆ ots_seed_height()

ots_result_t ots_seed_height ( ots_handle_t  handle)

Get seed blockchain height.

Parameters
[in]handleSeed handle
Returns
Result containing height

◆ ots_seed_indices()

ots_result_t ots_seed_indices ( ots_handle_t  handle,
const char *  password 
)

Get seed indices.

Parameters
[in]handleSeed handle
[in]passwordOptional password for encrypted seeds
Returns
Result containing seed indices

◆ ots_seed_indices_clear()

void ots_seed_indices_clear ( ots_seed_indices_t indices)

Clear seed indices content.

Parameters
[in,out]indicesIndices to clear

◆ ots_seed_indices_create()

ots_result_t ots_seed_indices_create ( size_t  size)

Create seed indices container.

Parameters
[in]sizeNumber of indices
Returns
Result containing seed indices container

◆ ots_seed_indices_free()

void ots_seed_indices_free ( ots_seed_indices_t indices)

Free seed indices, securely wiping memory.

Parameters
[in,out]indicesIndices to free

◆ ots_seed_languages()

ots_result_t ots_seed_languages ( OTS_SEED_TYPE  type)

Get supported languages for seed type.

Parameters
[in]typeSeed type
Returns
Result containing array of language codes

◆ ots_seed_merge_multiple_values()

ots_result_t ots_seed_merge_multiple_values ( const ots_seed_indices_t values[],
size_t  count 
)

Merge multiple sets of seed values.

Parameters
[in]valuesArray of value sets to merge
[in]countNumber of value sets
Returns
Result containing merged indices
Exceptions
OTS_ERROR_LENGTH_MISMATCHif value sets have different sizes
OTS_ERROR_TOO_FEW_VALUESif less than two value sets provided

◆ ots_seed_merge_multiple_values_and_zero()

ots_result_t ots_seed_merge_multiple_values_and_zero ( ots_seed_indices_t values[],
size_t  count,
bool  delete_after 
)

Merge multiple sets of seed values and zero.

Parameters
[in,out]valuesArray of value sets to merge (will be zeroed)
[in]countNumber of value sets
[in]delete_afterDelete values after merging
Returns
Result containing merged indices
Exceptions
OTS_ERROR_LENGTH_MISMATCHif value sets have different sizes
OTS_ERROR_TOO_FEW_VALUESif less than two value sets provided

◆ ots_seed_merge_values()

ots_result_t ots_seed_merge_values ( const ots_seed_indices_t values1,
const ots_seed_indices_t values2 
)

Merge two sets of seed values.

Parameters
[in]values1First set of values
[in]values2Second set of values
Returns
Result containing merged indices
Exceptions
OTS_ERROR_LENGTH_MISMATCHif value sets have different sizes

◆ ots_seed_merge_values_and_zero()

ots_result_t ots_seed_merge_values_and_zero ( ots_seed_indices_t values1,
ots_seed_indices_t values2,
bool  delete_after 
)

Merge and zero two sets of seed values.

Parameters
[in,out]values1First set of values (will be zeroed)
[in,out]values2Second set of values (will be zeroed)
[in]delete_afterDelete values after merging
Returns
Result containing merged indices
Exceptions
OTS_ERROR_LENGTH_MISMATCHif value sets have different sizes

◆ ots_seed_merge_values_with_password_and_zero()

ots_result_t ots_seed_merge_values_with_password_and_zero ( char *  password,
ots_seed_indices_t values,
bool  delete_after 
)

Merge seed values with password and zero.

Parameters
[in,out]passwordPassword to merge with (will be zeroed)
[in,out]valuesSeed values to merge (will be zeroed)
[in]delete_afterDelete values after merging
Returns
Result containing merged indices
Exceptions
OTS_ERROR_MERGE_FAILEDif merge operation fails

◆ ots_seed_merge_with_password()

ots_result_t ots_seed_merge_with_password ( const char *  password,
const ots_seed_indices_t values 
)

Merge seed values with password.

Parameters
[in]passwordPassword to merge with
[in]valuesSeed values to merge
Returns
Result containing merged indices
Exceptions
OTS_ERROR_MERGE_FAILEDif merge operation fails

◆ ots_seed_network()

ots_result_t ots_seed_network ( ots_handle_t  handle)

Get seed network type.

Parameters
[in]handleSeed handle
Returns
Result containing network type

◆ ots_seed_phrase()

ots_result_t ots_seed_phrase ( ots_handle_t  handle,
const char *  language_code,
const char *  password 
)

Get seed phrase in specified language.

Parameters
[in]handleSeed handle
[in]language_codeLanguage code
[in]passwordOptional password for encrypted seeds (empty string for none)
Returns
Result containing wipeable string

◆ ots_seed_timestamp()

ots_result_t ots_seed_timestamp ( ots_handle_t  handle)

Get seed creation timestamp.

Parameters
[in]handleSeed handle
Returns
Result containing timestamp

◆ ots_seed_wallet()

ots_result_t ots_seed_wallet ( ots_handle_t  handle)

Get wallet from seed.

Parameters
[in]handleSeed handle
Returns
Result containing wallet handle

◆ ots_set_enforce_entropy()

void ots_set_enforce_entropy ( bool  enforce)

Set entropy enforcement.

Parameters
[in]enforceWhether to enforce entropy checks

◆ ots_set_max_account_depth()

void ots_set_max_account_depth ( uint32_t  depth)

Set maximum account depth for searching.

Parameters
[in]depthMaximum account depth

◆ ots_set_max_depth()

void ots_set_max_depth ( uint32_t  account_depth,
uint32_t  index_depth 
)

Set maximum depths for searching.

Parameters
[in]account_depthMaximum account depth
[in]index_depthMaximum index depth

◆ ots_set_max_index_depth()

void ots_set_max_index_depth ( uint32_t  depth)

Set maximum index depth for searching.

Parameters
[in]depthMaximum index depth

◆ ots_timestamp_from_height()

ots_result_t ots_timestamp_from_height ( uint64_t  height,
OTS_NETWORK  network 
)

Convert block height to estimated timestamp.

Parameters
[in]heightBlock height
[in]networkNetwork type
Returns
Result containing estimated timestamp

◆ ots_verify_data()

ots_result_t ots_verify_data ( const char *  data,
const char *  address,
const char *  signature 
)

Verify signed data.

Parameters
[in]dataOriginal data
[in]addressSigner's address
[in]signatureSignature to verify
Returns
Result containing verification status

◆ ots_version()

ots_result_t ots_version ( void  )

Get library version string.

Returns
Version string, must be freed with ots_free_string()

◆ ots_version_components()

ots_result_t ots_version_components ( void  )

Get version components [major, minor, patch].

Returns
Result containing version components array

◆ ots_wallet_accounts()

ots_result_t ots_wallet_accounts ( ots_handle_t  wallet_handle,
uint32_t  max,
uint32_t  offset 
)

Get list of accounts in wallet.

Parameters
[in]wallet_handleWallet handle
[in]maxMaximum number of accounts to return
[in]offsetStarting account index
Returns
Result containing array of address strings

◆ ots_wallet_address()

ots_result_t ots_wallet_address ( ots_handle_t  wallet_handle,
uint32_t  account,
uint32_t  index 
)

Generate address for wallet.

Parameters
[in]wallet_handleWallet handle
[in]accountAccount index
[in]indexAddress index
Returns
Result containing address string

◆ ots_wallet_address_index()

ots_result_t ots_wallet_address_index ( ots_handle_t  wallet_handle,
const char *  address,
uint32_t  max_account_depth,
uint32_t  max_index_depth 
)

Get account and index for address in wallet.

Parameters
[in]wallet_handleWallet handle
[in]addressAddress to look up
[in]max_account_depthMaximum account depth to search
[in]max_index_depthMaximum index depth to search
Returns
Result containing account/index pair
Exceptions
OTS_ERROR_ADDRESS_NOT_FOUNDif address not found in wallet

◆ ots_wallet_address_index_handle()

ots_result_t ots_wallet_address_index_handle ( ots_handle_t  wallet_handle,
ots_handle_t  address_handle,
uint32_t  max_account_depth,
uint32_t  max_index_depth 
)

Get account and index for address handle in wallet.

Parameters
[in]wallet_handleWallet handle
[in]address_handleAddress handle to look up
[in]max_account_depthMaximum account depth to search
[in]max_index_depthMaximum index depth to search
Returns
Result containing account/index pair
Exceptions
OTS_ERROR_ADDRESS_NOT_FOUNDif address not found in wallet

◆ ots_wallet_check_tx()

ots_result_t ots_wallet_check_tx ( ots_handle_t  wallet_handle,
ots_handle_t  unsigned_tx_handle 
)

Check transaction for warnings.

Parameters
[in]wallet_handleWallet handle
[in]unsigned_tx_handleunsigned transaction handle
Returns
Result containing array of warnings

◆ ots_wallet_check_tx_string()

ots_result_t ots_wallet_check_tx_string ( ots_handle_t  wallet_handle,
const char *  unsigned_tx 
)

Check transaction string for warnings.

Parameters
[in]wallet_handleWallet handle
[in]unsigned_txUnsigned transaction string
Returns
Result containing array of warnings

◆ ots_wallet_create()

ots_result_t ots_wallet_create ( const uint8_t  key[32],
uint64_t  height,
OTS_NETWORK  network 
)

Create wallet from secret key.

Parameters
[in]key32-byte secret key
[in]heightRestore height
[in]networkNetwork type
Returns
Result containing wallet handle

◆ ots_wallet_describe_tx()

ots_result_t ots_wallet_describe_tx ( ots_handle_t  wallet_handle,
const char *  unsigned_tx 
)

Describe unsigned transaction.

Parameters
[in]wallet_handleWallet handle
[in]unsigned_txUnsigned transaction data
Returns
Result containing transaction description

◆ ots_wallet_export_key_images()

ots_result_t ots_wallet_export_key_images ( ots_handle_t  wallet_handle)

Export key images.

Parameters
[in]wallet_handleWallet handle
Returns
Result containing wipeable string with key images
Exceptions
OTS_ERROR_NO_KEY_IMAGESif no outputs were imported

◆ ots_wallet_has_address()

ots_result_t ots_wallet_has_address ( ots_handle_t  wallet_handle,
const char *  address,
uint32_t  max_account_depth,
uint32_t  max_index_depth 
)

Check if address belongs to wallet.

Parameters
[in]wallet_handleWallet handle
[in]addressAddress to check
[in]max_account_depthMaximum account depth to search
[in]max_index_depthMaximum index depth to search
Returns
Result containing boolean status

◆ ots_wallet_has_address_handle()

ots_result_t ots_wallet_has_address_handle ( ots_handle_t  wallet_handle,
ots_handle_t  address_handle,
uint32_t  max_account_depth,
uint32_t  max_index_depth 
)

Check if address belongs to wallet using Address handle.

Parameters
[in]wallet_handleWallet handle
[in]address_handleAddress handle to check
[in]max_account_depthMaximum account depth to search
[in]max_index_depthMaximum index depth to search
Returns
Result containing boolean status

◆ ots_wallet_height()

ots_result_t ots_wallet_height ( ots_handle_t  wallet_handle)

Get wallet restore height.

Parameters
[in]wallet_handleWallet handle
Returns
Result containing height

◆ ots_wallet_import_outputs()

ots_result_t ots_wallet_import_outputs ( ots_handle_t  wallet_handle,
const char *  outputs 
)

Import outputs from string.

Parameters
[in]wallet_handleWallet handle
[in]outputsOutputs string from view wallet
Returns
Result containing number of imported outputs
Exceptions
OTS_ERROR_INVALID_OUTPUTSif outputs data is invalid

◆ ots_wallet_public_spend_key()

ots_result_t ots_wallet_public_spend_key ( ots_handle_t  wallet_handle)

Get public spend key.

Parameters
[in]wallet_handleWallet handle
Returns
Result containing wipeable string with key

◆ ots_wallet_public_view_key()

ots_result_t ots_wallet_public_view_key ( ots_handle_t  wallet_handle)

Get public view key.

Parameters
[in]wallet_handleWallet handle
Returns
Result containing wipeable string with key

◆ ots_wallet_secret_spend_key()

ots_result_t ots_wallet_secret_spend_key ( ots_handle_t  wallet_handle)

Get secret spend key.

Parameters
[in]wallet_handleWallet handle
Returns
Result containing wipeable string with key

◆ ots_wallet_secret_view_key()

ots_result_t ots_wallet_secret_view_key ( ots_handle_t  wallet_handle)

Get secret view key.

Parameters
[in]wallet_handleWallet handle
Returns
Result containing wipeable string with key

◆ ots_wallet_sign_data()

ots_result_t ots_wallet_sign_data ( ots_handle_t  wallet_handle,
const char *  data 
)

Sign arbitrary data.

Parameters
[in]wallet_handleWallet handle
[in]dataData to sign
Returns
Result containing signature

◆ ots_wallet_sign_data_with_address()

ots_result_t ots_wallet_sign_data_with_address ( ots_handle_t  wallet_handle,
const char *  data,
ots_handle_t  address_handle 
)

Sign data with specific address.

Parameters
[in]wallet_handleWallet handle
[in]dataData to sign
[in]address_handleAddress to sign with
Returns
Result containing signature string
Exceptions
OTS_ERROR_ADDRESS_NOT_FOUNDif address not found in wallet

◆ ots_wallet_sign_data_with_index()

ots_result_t ots_wallet_sign_data_with_index ( ots_handle_t  wallet_handle,
const char *  data,
uint32_t  account,
uint32_t  subaddr 
)

Sign data with specific subaddress.

Parameters
[in]wallet_handleWallet handle
[in]dataData to sign
[in]accountAccount index
[in]subaddrSubaddress index
Returns
Result containing signature string

◆ ots_wallet_sign_transaction()

ots_result_t ots_wallet_sign_transaction ( ots_handle_t  wallet_handle,
const char *  unsigned_tx 
)

Sign unsigned transaction.

Parameters
[in]wallet_handleWallet handle
[in]unsigned_txUnsigned transaction string
Returns
Result containing signed transaction string
Exceptions
OTS_ERROR_INVALID_TRANSACTIONif transaction is invalid

◆ ots_wallet_subaddresses()

ots_result_t ots_wallet_subaddresses ( ots_handle_t  wallet_handle,
uint32_t  account,
uint32_t  max,
uint32_t  offset 
)

Get list of subaddresses for an account.

Parameters
[in]wallet_handleWallet handle
[in]accountAccount index
[in]maxMaximum number of addresses to return
[in]offsetStarting subaddress index
Returns
Result containing array of address strings

◆ ots_wallet_verify_data()

ots_result_t ots_wallet_verify_data ( const char *  data,
const char *  signature,
bool  legacy_fallback 
)

Verify signed data for the wallet address with legacy support.

Parameters
[in]dataOriginal data
[in]signatureSignature to verify
[in]legacy_fallbackTry legacy verification if modern fails
Returns
Result containing verification status

◆ ots_wallet_verify_data_with_address()

ots_result_t ots_wallet_verify_data_with_address ( ots_handle_t  wallet_handle,
const char *  data,
ots_handle_t  address_handle,
const char *  signature,
bool  legacy_fallback 
)

Verify signed data with specific address.

Parameters
[in]wallet_handleWallet handle
[in]dataOriginal data
[in]address_handleAddress to verify with
[in]signatureSignature to verify
[in]legacy_fallbackTry legacy verification if modern fails
Returns
Result containing verification status
Exceptions
OTS_ERROR_ADDRESS_NOT_FOUNDif address not found in wallet

◆ ots_wallet_verify_data_with_index()

ots_result_t ots_wallet_verify_data_with_index ( ots_handle_t  wallet_handle,
const char *  data,
uint32_t  account,
uint32_t  subaddr,
const char *  signature,
bool  legacy_fallback 
)

Verify signed data with specific subaddress.

Parameters
[in]wallet_handleWallet handle
[in]dataOriginal data
[in]accountAccount index
[in]subaddrSubaddress index
[in]signatureSignature to verify
[in]legacy_fallbackTry legacy verification if modern fails
Returns
Result containing verification status

◆ ots_wipeable_string_clear()

void ots_wipeable_string_clear ( ots_wipeable_string_t str)

Clear wipeable string content.

Parameters
[in,out]strString to clear

◆ ots_wipeable_string_compare()

ots_result_t ots_wipeable_string_compare ( const ots_wipeable_string_t str1,
const ots_wipeable_string_t str2 
)

Compare two wipeable strings.

Parameters
[in]str1First string
[in]str2Second string
Returns
Result containing comparison result

◆ ots_wipeable_string_create()

ots_result_t ots_wipeable_string_create ( const char *  str)

Create a new wipeable string.

Parameters
[in]strInitial string content
Returns
Result containing wipeable string

◆ ots_wipeable_string_free()

void ots_wipeable_string_free ( ots_wipeable_string_t str)

Free a wipeable string, securely wiping memory.

Parameters
[in,out]strString to free