virgil-sdk
Version:
Virgil Security Services SDK
46 lines (45 loc) • 1.35 kB
TypeScript
import { RawSignedModel } from './RawSignedModel';
import { IPrivateKey, ICardCrypto } from '../types';
import { IExtraData } from './ICard';
/**
* Parameters for the card signature generation.
*/
export interface IRawSignParams {
/**
* The card to generate the signature for in the form of
* {@link RawSignedModel} object.
*/
readonly model: RawSignedModel;
/**
* The private key to use to generate the signature.
*/
readonly signerPrivateKey: IPrivateKey;
/**
* Custom attributes to associate with the signature. If provided, these
* will also be signed.
*/
readonly extraFields?: IExtraData;
/**
* Identifier of the signature. Default is "self".
*/
readonly signer?: string;
}
/**
* Class responsible for generating signatures of the cards.
*/
export declare class ModelSigner {
private readonly crypto;
/**
* Initializes a new instance of `ModelSigner`.
* @param {ICardCrypto} crypto - Object implementing the
* {@link ICardCrypto} interface.
*/
constructor(crypto: ICardCrypto);
/**
* Generates a new signature based on `rawParams`.
* @param {IRawSignParams} rawParams
*/
sign(rawParams: IRawSignParams): void;
private prepareParams;
private validate;
}