Skip to content

Commit c4da68b

Browse files
committed
refactor: update test workflow to run library tests and enhance documentation examples for GcpSigner
1 parent d08f002 commit c4da68b

File tree

2 files changed

+31
-3
lines changed

2 files changed

+31
-3
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,4 @@ jobs:
2929
create_credentials_file: true
3030

3131
- name: Test
32-
run: cargo test --all-features
32+
run: cargo test --lib

src/signer.rs

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,36 @@ impl KeySpecifier {
6868
///
6969
/// # Example
7070
///
71-
/// ```no_run
72-
/// //use solana_signer_gcp::Signer;
71+
/// ```rust
72+
/// use solana_sdk::signer::Signer;
73+
/// use solana_signer_gcp::{GcpKeyRingRef, GcpSigner, KeySpecifier};
74+
/// use gcloud_sdk::{
75+
/// google::cloud::kms::v1::key_management_service_client::KeyManagementServiceClient, GoogleApi,
76+
/// };
77+
///
78+
/// # async fn test() {
79+
///
80+
/// let project_id = std::env::var("GOOGLE_PROJECT_ID").expect("GOOGLE_PROJECT_ID");
81+
/// let location = std::env::var("GOOGLE_LOCATION").expect("GOOGLE_LOCATION");
82+
/// let keyring_name = std::env::var("GOOGLE_KEYRING").expect("GOOGLE_KEYRING");
83+
///
84+
/// let keyring = GcpKeyRingRef::new(&project_id, &location, &keyring_name);
85+
/// let client = GoogleApi::from_function(
86+
/// KeyManagementServiceClient::new,
87+
/// "https://cloudkms.googleapis.com",
88+
/// None,
89+
/// )
90+
/// .await
91+
/// .expect("Failed to create GCP KMS Client");
92+
///
93+
/// let key_name = "...";
94+
/// let key_version = 1;
95+
/// let key_specifier = KeySpecifier::new(keyring, key_name, key_version);
96+
/// let signer = GcpSigner::new(client, key_specifier).await.unwrap();
97+
///
98+
/// println!("{:?}",signer.pubkey());
99+
///
100+
/// }
73101
/// ```
74102
#[derive(Clone)]
75103
pub struct GcpSigner {

0 commit comments

Comments
 (0)