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

[libdream] Each universe should have it's own swam key #159

Closed
samyfodil opened this issue May 24, 2024 · 0 comments
Closed

[libdream] Each universe should have it's own swam key #159

samyfodil opened this issue May 24, 2024 · 0 comments
Labels
good first issue No deep understanding of tau needed high priority High Priority, should be implemented immediatley

Comments

@samyfodil
Copy link
Contributor

samyfodil commented May 24, 2024

We are using a static dev mode swam key in libdream. See:
https://github.com/taubyte/tau/blob/main/libdream/simple.go#L145
https://github.com/taubyte/tau/blob/main/libdream/universe.go#L222

While this was fine at the very start, it's causing issues when running multiple tests in parallel.

We need a function like:

func generateSwarmKey(id string) string {
	hash := sha256.Sum256([]byte(id))
	return "/key/swarm/psk/1.0.0//base16/" + hex.EncodeToString(hash[:])
}

Which will generate the same swarm key for the same universe id, and use that in lieu of protocols.SwarmKey()

Maybe have universe.SwarmKey() which calls generateSwarmKey and caches the result, or call generateSwarmKey when universe is created here https://github.com/taubyte/tau/blob/main/libdream/universe.go#L22. I prefer the second way better.

protocols.SwarmKey() function should then be deleted.

@samyfodil samyfodil added high priority High Priority, should be implemented immediatley good first issue No deep understanding of tau needed labels May 24, 2024
samyfodil added a commit that referenced this issue Jun 4, 2024
* now each dreamland universe will have it's own key
* making sure swarm key is persistent when universe is saved
* consolidating some of the swam key generation logic

---------

Co-authored-by: samyfodil <fodil.samy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue No deep understanding of tau needed high priority High Priority, should be implemented immediatley
Projects
None yet
Development

No branches or pull requests

1 participant