MetadataBlob(String b64WritingKey, String b64mapkey, String b64blobdata) { this( Base64.getDecoder().decode(b64WritingKey), b64WritingKey, Base64.getDecoder().decode(b64mapkey), b64mapkey, Base64.getDecoder().decode(b64blobdata), b64blobdata); }
MetadataBlob(byte[] writingKey, byte[] mapkey, byte[] blobdata) { this( writingKey, new String(Base64.getEncoder().encode(writingKey)), mapkey, new String(Base64.getEncoder().encode(mapkey)), blobdata, blobdata == null ? null : new String(Base64.getEncoder().encode(blobdata))); }
@Override public String getUsername(byte[] encodedKey) { String b64key = Base64.getEncoder().encodeToString(encodedKey); try { try (PreparedStatement preparedStatement = conn.prepareStatement("select name from users where publickey = ? limit 1")) { preparedStatement.setString(1, b64key); ResultSet resultSet = preparedStatement.executeQuery(); boolean next = resultSet.next(); if (!next) return ""; return resultSet.getString(1); } } catch (SQLException sqle) { throw new IllegalStateException(sqle); } }
RowData(String name, String d) { this(name, Base64.getDecoder().decode(d), d); }
RowData(String name, byte[] data) { this(name, data, (data == null ? null : new String(Base64.getEncoder().encode(data)))); }
StaticData(byte[] publicKey, byte[] staticdata) { super(new String(Base64.getEncoder().encode(publicKey)), staticdata); }