/** * Generates a collection meta token representing this collection. * * @return String. */ public String buildCollectionMetaToken() { Map<String, Object> claims = data.asMap(); boolean isNetworkIssued = isNetworkIssued(); claims.put("iss", isNetworkIssued ? site.getNetwork().getUrn() : site.getUrn()); return LivefyreUtil.serializeAndSign( claims, isNetworkIssued ? site.getNetwork().getData().getKey() : site.getData().getKey()); }
/** * Generates a MD5-encrypted checksum based on this collection's attributes. * * @return String. */ public String buildChecksum() { try { Map<String, Object> attr = data.asMap(); byte[] digest = MessageDigest.getInstance("MD5").digest(LivefyreUtil.mapToJsonString(attr).getBytes()); return printHexBinary(digest); } catch (NoSuchAlgorithmException e) { throw new LivefyreException("MD5 message digest missing. This shouldn't ever happen." + e); } }