@Override
    public List<PublicJsonWebKey> readJwk() {
//        // Delete old records.
//        deleteOldJwkRecords();

        // Add new records.
        addRecords();

        // Fetch back all records.
        return JooqUtil.contextResult(identityDbConnProvider, context ->
                        context
                                .selectFrom(JSON_WEB_KEY)
                                .fetch())
                .map(jsonWebKeyRecord -> jsonWebKeyFactory.fromJson(jsonWebKeyRecord.getJson()));
    }
This will always return a list of public keys creating them if needed.
stroom-security/stroom-security-identity-db/src/main/java/stroom/security/identity/db/JwkDaoImpl.java