craterdog.tokens.Tokenization Maven / Gradle / Ivy
/************************************************************************
* Copyright (c) Crater Dog Technologies(TM). All Rights Reserved. *
************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. *
* *
* This code is free software; you can redistribute it and/or modify it *
* under the terms of The MIT License (MIT), as published by the Open *
* Source Initiative. (See http://opensource.org/licenses/MIT) *
************************************************************************/
package craterdog.tokens;
import craterdog.notary.NotaryCertificate;
import craterdog.notary.NotaryKey;
import java.net.URI;
import java.util.Map;
/**
* This interface defines the methods the must be implemented by all digital tokenization providers.
*
* @author Derk Norton
*/
public interface Tokenization {
/**
* This method mints a new digital token on behalf of a guarantor who will guarantee
* the value of the new token.
*
* @param tokenLocation The location of the new token.
* @param batchLocation The location to which batch that the new token should belong.
* @param accountantLocation The location of the accountant that will be certifying the token.
* @param type The type of token to be minted.
* @param secondsToLive How many seconds the token should be valid.
* @param guarantorKey The private notary key for the identity guaranteeing the value of
* the token.
*
* @return A newly minted token.
*/
DigitalToken mintToken(URI tokenLocation, URI batchLocation, URI accountantLocation, String type, int secondsToLive, NotaryKey guarantorKey);
/**
* This method mints a new digital token on behalf of a guarantor who will guarantee
* the value of the new token.
*
* @param tokenLocation The location of the new token.
* @param batchLocation The location to which batch that the new token should belong.
* @param accountantLocation The location of the accountant that will be certifying the token.
* @param type The type of token to be minted.
* @param secondsToLive How many seconds the token should be valid.
* @param additionalAttributes Any additional attributes about the token.
* @param guarantorKey The private notary key for the identity guaranteeing the value of
* the token.
*
* @return A newly minted token.
*/
DigitalToken mintToken(URI tokenLocation, URI batchLocation, URI accountantLocation, String type, int secondsToLive, Map additionalAttributes, NotaryKey guarantorKey);
/**
* This method allows a accountant to certify a digital token that has been guaranteed by
* a guarantor.
*
* @param token The digital token to be certified.
* @param batchLocation The location of the batch for this token.
* @param guarantorCertificate The public certificate of the guarantor account.
* @param accountantKey The private notary key of the accountant.
*/
void certifyToken(DigitalToken token, URI batchLocation, NotaryCertificate guarantorCertificate, NotaryKey accountantKey);
/**
* This method validates the attributes and seals for a digital token.
*
* @param token The digital token to be validated.
* @param batchLocation The location of the batch for this token.
* @param guarantorCertificate The public certificate of the guarantor.
* @param accountantCertificate The public certificate of the accountant.
* @param errors A map containing any errors that were found.
*/
void validateToken(DigitalToken token, URI batchLocation, NotaryCertificate guarantorCertificate, NotaryCertificate accountantCertificate, Map errors);
}