@microsoft/useragent-sdk
Version:
SDK for building decentralized identity wallets and enterprise agents.
53 lines (52 loc) • 2.09 kB
TypeScript
import 'isomorphic-fetch';
import Identifier from '../Identifier';
import IdentifierDocument from '../IdentifierDocument';
import UserAgentOptions from '../UserAgentOptions';
import IRegistrar from './IRegistrar';
import RegistrarCryptoOptions from './RegistrarCryptoOptions';
/**
* Registrar implementation for the Sidetree (ION) network
*/
export default class SidetreeRegistrar implements IRegistrar {
url: string;
private timeoutInMilliseconds;
private options;
private cryptoFactory;
/**
* Crypto options for the Registrar
*/
registrarCryptoOptions: RegistrarCryptoOptions;
/**
* Constructs a new instance of the Sidetree registrar
* @param url to the registration endpoint at the registrar
* @param options to configure the registrar.
*/
constructor(url: string, options: UserAgentOptions);
/**
* Prepare the document for registration
* @param document Document to format
*/
prepareDocForRegistration(document: IdentifierDocument): IdentifierDocument;
/**
* Registers the identifier document on the ledger
* returning the identifier generated by the registrar.
* @param identifierDocument to register.
* @param keyReference Reference to the identifier for the signing key.
*/
register(identifierDocument: IdentifierDocument, keyReference: string): Promise<Identifier>;
/**
* Sign the registration payload
* @param keyReference Reference to signature key
* @param bodyString original payload to sign
*/
sign(keyReference: string, bodyString: string): Promise<string>;
/**
* Uses the specified input to create a basic Sidetree
* compliant identifier document and then hashes the document
* in accordance with the Sidetree protocol specification
* to generate and return the identifier.
*
* @param identifierDocument for which to generate the identifier.
*/
generateIdentifier(identifierDocument: IdentifierDocument): Promise<Identifier>;
}