log.info("Using stored secret");
return Secret.of(
DatastoreUtil.getExistingProperty(e, SECRET_PROPERTY, Blob.class).getBytes());
}
}
Secret newSecret = Secret.generate(random);
Entity e = new Entity(SECRET_KEY);
DatastoreUtil.setNonNullUnindexedProperty(e, SECRET_PROPERTY,
new Blob(newSecret.getBytes()));
tx.put(e);
tx.commit();
log.info("Generated new secret");
return newSecret;
} finally {