#How does stronghold work?

10 messages · Page 1 of 1 (latest)

copper flume
copper flume
#

anybody...?

outer fiber
#

The plugin is a wrapper for IOTA Stronghold, a Rust-based secrets library. A Stronghold is an instance of a Snapshot. A Snapshot is the encrypted storage format of the data, hence the need for a path and password for the load function that the plugin provides. A Client is the interface and a form of identity which restricts access to the data in the Vault to that client. A Vault is the secure database where the secure secrets are. A Store is a quicker key-value storage which is only encrypted by the Snapshot, meaning it is available to anyone who has the password.

copper flume
#

because there are passwords everywhere and I'm not sure what methods I should and should not be using

outer fiber
#

By practical, do you mean example code or just a real-world scenario?

outer fiber
#
async function stronghold_example() {
  let stronghold_path = await join(BASE, "stronghold");

  // Hard-coding passwords is a terrible practice. Prompt the user for the password instead.
  let stronghold = await Stronghold.load(stronghold_path, "internal-use-only-never-share-it");

  let client = await stronghold.createClient("client_identifier");

  let vault = client.getVault("vault_identifier");

  await vault.insert("record_identifier", [97, 98, 99]);

  // Secrets can't be read from the vault, only removed by their key.
  vault.remove(Location.generic("vault_identifier", "record_identifier"));

  let store = client.getStore();
  const STORE_ITEM_ID = "store_item_identifier";

  let expire_after = { secs: 5, nanos: 0 };
  await store.insert(STORE_ITEM_ID, [97, 98, 99], expire_after);

  await stronghold.save();

  let store_value = await store.get(STORE_ITEM_ID);
  console.log("store value", store_value);

  // Wait 5 seconds for store entry to expire.
  await new Promise((res) => setTimeout(res, 5000));

  let store_value_expired = await store.get(STORE_ITEM_ID);
  console.log("store value expired", store_value_expired);

  await stronghold.unload();
}
#

The author of the Rust library has made an excellent video explaining the concepts it provides: https://www.youtube.com/watch?v=pd-XWaGLIck

#Rust #IOTA #TensorProgramming

In this video, I talk about one of my recent projects, stronghold. I go over the different crates and discuss how they work and what they do.

Source Code: https://github.com/iotaledger/stronghold.rs
Blog Post about Stronghold: https://blog.iota.org/iota-stronghold-6ce55d311d7c
Stronghold Retrospective: https:...

▶ Play video
warm bone
#

Hi @outer fiber, can you give me an exmaple for rust with stronghold. I want to move all important logic to rust to get the best performance.