register_ccte {ccdR}R Documentation

Register a CCTE API

Description

This page contains documentation tools related to enabling CCTE API services in R.

Usage

showing_key()

ccdr_show_api_key()

ccdr_hide_api_key()

register_ccdr(key, write = FALSE)

## S3 method for class 'ccte_credentials'
print(...)

ccte_key()

has_ccte_key()

Arguments

key

an API key

write

if TRUE, stores the secrets provided in the .Renviron file

...

a dumped formal argument to the generic print method

Details

To obtain an API key and enable services, go to https://api-ccte.epa.gov/docs/. This documentation shows you how to obtain an API key to allow access to the CCTE APIs.

To tell ccdr about your API key, use register_ccte(), e.g. register_ccte(key = 'grbwigbwoginrowgbwibgdibdvinrginiwgo') (that's a fake key). This will set your API key for the current session, but if you restart R, you'll need to do it again. You can set it permanently by setting write = TRUEm see the examples. If you set it permanently it will be stored in your .Renviron file, and that will be accessed by ccdr persistently across sessions.

Users should be aware that the API key, a string of garbled characters/numbers/symbols, is a PRIVATE key - it uniquely identifies and authenticates you to CCTE's services. If anyone gets your API key, they can use it to masquerade as you to CCTE. To mitigate against users inadvertently sharing their keys, by default ccdr never displays a user's key in messages displayed to the console.

Users should be aware that ccdr has no mechanism with which to safeguard the private key once registered with R. That is to say, once you register your API key, any R function will have access to it. As a consequence, ccdr will not know if another function, potentially from a compromised package, accesses the key and uploads it to a third party. For this reason, when using ccdr we recommend a heightened sense of security and self-awareness: only use trusted packages, do not save the API keys in script files, etc.

Value

Examples


# Check if API key is showing
showing_key()


# Toggle API key to display
ccdr_show_api_key()


# Toggle API key to be hidden
ccdr_hide_api_key()


# Register key for this session
register_ccdr(key = 'YOUR API KEY')
# Register key over sessions
register_ccdr(key = 'YOUR API KEY', write = TRUE)


# Print function for ccte_credentials class
print.ccte_credentials()


# Display ccte API key
ccte_key()


# Check whether API key is registered
has_ccte_key()


[Package ccdR version 1.0.0 Index]