# Valence crypto utils
This library is a collection of crypto utilities for the Valence ecosystem.
## Signer
The signer functions as a versatile signature provider, which can be constructed utilizing environmental variables.
One option is to use foundry:
```shell
PRIVATE_KEY=$(cast wallet private-key --account some-wallet) \
export VALENCE_SIGNER='{"SecretEccNistP256":"'$PRIVATE_KEY'"}'
```
Once the `VALENCE_SIGNER` is set, the ecosystem will authenticate messages originating from the generated secret.
#### Requests signature
The signer will utilize the [rfc-8785](https://www.rfc-editor.org/rfc/rfc8785.html) in order to sign JSON requests:
```rust,ignore
use valence_crypto_utils::{Signer, Ecdsa};
let signer = Signer::try_from_env().unwrap();
let request = r#"{"b": "foo", "a": 42 }"#;
let signature = signer.sign_json(request.as_bytes()).unwrap();
let public = Ecdsa::recover_from_json(&signature, request).unwrap();
```