Skip to content

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

Closed
@samyfodil

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    good first issueNo deep understanding of tau neededhigh priorityHigh Priority, should be implemented immediatley

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions