Open in TheBrain

brain:// Links

Local links to a thought take the following format:

brain://server-domain/brain-id/thought-id/HumanReadableName

IDs are in “Short GUID” format. To convert these IDs to standard GUIDs such as those found in the JSON export, the following code can be used:

public static string ToShortGuid(this Guid newGuid) {
	string modifiedBase64 = Convert.ToBase64String(newGuid.ToByteArray())
		.Replace('+', '-').Replace('/', '_') // avoid invalid URL characters
		.Substring(0, 22);
	return modifiedBase64;
}

public static Guid ParseShortGuid(this string shortGuid) {
	string base64 = shortGuid.Replace('-', '+').Replace('_', '/') + "==";
	Byte[] bytes = Convert.FromBase64String(base64);
	return new Guid(bytes);
}