diff --git a/examples/rust/get_started/examples/06-credentials-exchange-client.rs b/examples/rust/get_started/examples/06-credentials-exchange-client.rs index 09f5aec85b2..79644d18b7a 100644 --- a/examples/rust/get_started/examples/06-credentials-exchange-client.rs +++ b/examples/rust/get_started/examples/06-credentials-exchange-client.rs @@ -20,14 +20,14 @@ async fn main(ctx: Context) -> Result<()> { // which is an identifier known to the credential issuer, with some preset attributes // We're hard coding this specific identity because its public identifier is known // to the credential issuer as a member of the production cluster. - let change_history = "81a201583ba20101025835a4028201815820530d1c2e9822433b679a66a60b9c2ed47c370cd0ce51cbe1a7ad847b5835a96303f4041a64dd4060051a77a94360028201815840042fff8f6c80603fb1cec4a3cf1ff169ee36889d3ed76184fe1dfbd4b692b02892df9525c61c2f1286b829586d13d5abf7d18973141f734d71c1840520d40a0e"; + let change_history = hex::decode("81a201583ba20101025835a4028201815820530d1c2e9822433b679a66a60b9c2ed47c370cd0ce51cbe1a7ad847b5835a96303f4041a64dd4060051a77a94360028201815840042fff8f6c80603fb1cec4a3cf1ff169ee36889d3ed76184fe1dfbd4b692b02892df9525c61c2f1286b829586d13d5abf7d18973141f734d71c1840520d40a0e").unwrap(); let secret = signing_vault .import_key( Secret::new(hex::decode("31FF4E1CD55F17735A633FBAB4B838CF88D1252D164735CB3185A6E315438C2C").unwrap()), SecretAttributes::Ed25519, ) .await?; - let client = node.import_private_identity(change_history, &secret).await?; + let client = node.import_private_identity(&change_history, &secret).await?; node.identities() .purpose_keys() .create_purpose_key(client.identifier(), Purpose::SecureChannel) diff --git a/examples/rust/get_started/examples/06-credentials-exchange-issuer.rs b/examples/rust/get_started/examples/06-credentials-exchange-issuer.rs index e288a192d98..8681e18f962 100644 --- a/examples/rust/get_started/examples/06-credentials-exchange-issuer.rs +++ b/examples/rust/get_started/examples/06-credentials-exchange-issuer.rs @@ -15,7 +15,7 @@ async fn main(ctx: Context) -> Result<()> { vault.signing_vault = signing_vault.clone(); let node = Node::builder().with_vault(vault).build(ctx).await?; - let issuer_identity = "81a201583ba20101025835a4028201815820afbca9cf5d440147450f9f0d0a038a337b3fe5c17086163f2c54509558b62ef403f4041a64dd404a051a77a9434a0282018158407754214545cda6e7ff49136f67c9c7973ec309ca4087360a9f844aac961f8afe3f579a72c0c9530f3ff210f02b7c5f56e96ce12ee256b01d7628519800723805"; + let issuer_identity = hex::decode("81a201583ba20101025835a4028201815820afbca9cf5d440147450f9f0d0a038a337b3fe5c17086163f2c54509558b62ef403f4041a64dd404a051a77a9434a0282018158407754214545cda6e7ff49136f67c9c7973ec309ca4087360a9f844aac961f8afe3f579a72c0c9530f3ff210f02b7c5f56e96ce12ee256b01d7628519800723805").unwrap(); let secret = signing_vault .import_key( Secret::new(hex::decode("0127359911708ef4de9adaaf27c357501473c4a10a5326a69c1f7f874a0cd82e").unwrap()), @@ -23,7 +23,7 @@ async fn main(ctx: Context) -> Result<()> { ) .await?; - let issuer = node.import_private_identity(issuer_identity, &secret).await?; + let issuer = node.import_private_identity(&issuer_identity, &secret).await?; node.identities() .purpose_keys() .create_purpose_key(issuer.identifier(), Purpose::SecureChannel) diff --git a/examples/rust/get_started/examples/06-credentials-exchange-server.rs b/examples/rust/get_started/examples/06-credentials-exchange-server.rs index 31f9add841b..984239d19ab 100644 --- a/examples/rust/get_started/examples/06-credentials-exchange-server.rs +++ b/examples/rust/get_started/examples/06-credentials-exchange-server.rs @@ -29,14 +29,14 @@ async fn main(ctx: Context) -> Result<()> { // // We're hard coding this specific identity because its public identifier is known // to the credential issuer as a member of the production cluster. - let change_history = "81a201583ba20101025835a40282018158201d387ce453816d91159740a55e9a62ad3b58be9ecf7ef08760c42c0d885b6c2e03f4041a64dd4074051a77a9437402820181584053de69d82c9c4b12476c889b437be1d9d33bd0041655c4836a3a57ac5a67703e7f500af5bacaed291cfd6783d255fe0f0606638577d087a5612bfb4671f2b70a"; + let change_history = hex::decode("81a201583ba20101025835a40282018158201d387ce453816d91159740a55e9a62ad3b58be9ecf7ef08760c42c0d885b6c2e03f4041a64dd4074051a77a9437402820181584053de69d82c9c4b12476c889b437be1d9d33bd0041655c4836a3a57ac5a67703e7f500af5bacaed291cfd6783d255fe0f0606638577d087a5612bfb4671f2b70a").unwrap(); let secret = signing_vault .import_key( Secret::new(hex::decode("5FB3663DF8405379981462BABED7507E3D53A8D061188105E3ADBD70E0A74B8A").unwrap()), SecretAttributes::Ed25519, ) .await?; - let server = node.import_private_identity(change_history, &secret).await?; + let server = node.import_private_identity(&change_history, &secret).await?; node.identities() .purpose_keys() .create_purpose_key(server.identifier(), Purpose::SecureChannel) diff --git a/implementations/rust/ockam/ockam/src/node.rs b/implementations/rust/ockam/ockam/src/node.rs index 42b28459430..e92147612a6 100644 --- a/implementations/rust/ockam/ockam/src/node.rs +++ b/implementations/rust/ockam/ockam/src/node.rs @@ -124,11 +124,11 @@ impl Node { /// Note: the data is not persisted! pub async fn import_private_identity( &self, - identity_history: &str, + identity_change_history: &[u8], key_id: &KeyId, ) -> Result { self.identities_creation() - .import_private_identity(identity_history, key_id) + .import_private_identity(identity_change_history, key_id) .await } diff --git a/implementations/rust/ockam/ockam_identity/src/identities/identities_creation.rs b/implementations/rust/ockam/ockam_identity/src/identities/identities_creation.rs index f380bfd178a..d4f1d214e12 100644 --- a/implementations/rust/ockam/ockam_identity/src/identities/identities_creation.rs +++ b/implementations/rust/ockam/ockam_identity/src/identities/identities_creation.rs @@ -1,5 +1,4 @@ use ockam_core::compat::sync::Arc; -use ockam_core::compat::vec::Vec; use ockam_core::Result; use ockam_vault::{KeyId, SigningVault, VerifyingVault}; @@ -69,12 +68,10 @@ impl IdentitiesCreation { /// Note: the data is not persisted! pub async fn import_private_identity( &self, - identity_history: &str, + identity_change_history: &[u8], key_id: &KeyId, ) -> Result { - let identity_history_data: Vec = - hex::decode(identity_history).map_err(|_| IdentityError::InvalidHex)?; - let identity = self.import(None, identity_history_data.as_slice()).await?; + let identity = self.import(None, identity_change_history).await?; if identity.get_public_key()? != self.signing_vault.get_public_key(key_id).await? { return Err(IdentityError::WrongSecretKey.into()); }