projectKey = KeyczarUtils.unpack(projectKeyBytes.toByteArray());
} catch (KeyczarException e) {
throw new IllegalStateException("Error reading project key", e);
}
SecretToken token = new SecretToken(SecretTokenType.PROJECT_SECRET, projectKey, null);
return new AuthenticatedProject(project, token);
} else if (version == 0) {
// We had a project key in version 0, but we didn't use it!
return new AuthenticatedProject(project, null);
} else {
throw new IllegalStateException();
}
}