Skip to content
quarry Artifact [8f238b7769]
Login

Artifact [8f238b7769]

Artifact 8f238b7769e78d7134f408298ebaf472d5c0fd136d904b6d87696a09a1b0af9b:


package oltp

import (
	"testing"

	"craftdesign.group/quarry/internal/xfer"
)

// The storage layer spells the §6.3 derivation itself so it need not
// depend on transport. This pins the two spellings together: if either
// drifts, imported users silently stop being able to sign in.
func TestLegacySecretMatchesXfer(t *testing.T) {
	for _, c := range []struct{ code, login, pw string }{
		{"abc", "alice", "pw"},
		{"009a9066cb5f58ce224def584946d2177d7607e9", "root", "rootpw"},
		{"", "", ""},
	} {
		if got, want := legacySecret(c.code, c.login, c.pw),
			xfer.SharedSecret(c.code, c.login, c.pw); got != want {
			t.Fatalf("derivations diverged for %q/%q: %q vs %q", c.code, c.login, got, want)
		}
	}
}