pub struct Credentials { /* private fields */ }Expand description
Credentials for authenticating with the Coinbase API.
Implementations§
Source§impl Credentials
impl Credentials
Sourcepub fn new(
api_key: impl Into<String>,
private_key: impl Into<String>,
) -> Result<Self>
pub fn new( api_key: impl Into<String>, private_key: impl Into<String>, ) -> Result<Self>
Create new credentials from an API key and private key.
§Arguments
api_key- The CDP API key identifierprivate_key- The EC private key in PEM format
§Example
use coinbase_advanced::Credentials;
let creds = Credentials::new(
"organizations/xxx/apiKeys/yyy",
"-----BEGIN EC PRIVATE KEY-----\n...\n-----END EC PRIVATE KEY-----\n"
).unwrap();Sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
Create credentials from environment variables.
Reads from:
COINBASE_API_KEY- The CDP API keyCOINBASE_PRIVATE_KEY- The EC private key in PEM format
Note: The private key should have literal \n characters replaced with actual newlines,
or be stored in a file and read separately.
Trait Implementations§
Source§impl Clone for Credentials
impl Clone for Credentials
Source§fn clone(&self) -> Credentials
fn clone(&self) -> Credentials
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Credentials
impl RefUnwindSafe for Credentials
impl Send for Credentials
impl Sync for Credentials
impl Unpin for Credentials
impl UnwindSafe for Credentials
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more