Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: automate credential offer working again #253

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/agent/src/modules/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use async_trait::async_trait;
use serde::{Deserialize, Serialize};

/// Schema response from the ledger
#[derive(Debug, Deserialize, Serialize)]
#[derive(Debug, Deserialize, Serialize, Default)]
pub struct Schema {
/// Version of the schema
pub ver: String,
Expand Down
1 change: 1 addition & 0 deletions crates/automations/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ siera-logger = { path = "../logger", version = "0.*" }
siera-agent = { path = "../agent", version = "0.*" }
colored = "2.0.0"
async-trait = "0.1.51"
rand = "0.8.5"
7 changes: 6 additions & 1 deletion crates/automations/src/automations/credential_offer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::{
automations::create_credential_definition::CreateCredentialDefinition,
error::{Error, Result},
};
use rand::RngCore;
use siera_agent::modules::{
connection::ConnectionModule,
credential::{CredentialModule, CredentialOfferOptions},
Expand Down Expand Up @@ -61,8 +62,12 @@ impl CredentialOfferAutomation {
return Err(Error::ConnectionNotReady.into());
}

let mut rng = rand::thread_rng();
let version_major = rng.next_u32();
let version_minor = rng.next_u32();
let version = format!("{version_major}.{version_minor}");
let create_credential_definition = CreateCredentialDefinition {
version: "1.0",
version: &version,
attributes: attribute_keys.clone(),
name: "full-credential-offer-automation",
};
Expand Down