Example #1
0
// TODO: obvious things this is terrible
func get_auth_secret(ps *persist.PersistService, auth_token string) string {
	t, found := ps.Get(auth_token);
	if found {
		return t.Data["secret"];
	}
	else {
		return "BAD_TOKEN"; // TODO better handling
	}
	panic("unreachable");
	// for n := range tokens.Data() {
	// 	t := tokens.At(n);
	// 	token, _ := t.(AuthToken);
	// 	if token.Token == auth_token { return token.Secret };
	// }
	// return "BAD_TOKEN"; // TODO: better handling this is terrible
}