virgil-sdk
Version:
Virgil Security Services SDK
59 lines (58 loc) • 1.9 kB
TypeScript
import { ICardCrypto } from '../types';
import { RawSignedModel } from './RawSignedModel';
import { ICard, INewCardParams } from './ICard';
/**
* Converts an {@link ICard} to a {@link RawSignedModel}.
*
* @hidden
*
* @param {ICard} card - The {@link ICard} to convert.
* @returns {RawSignedModel}
*/
export declare function cardToRawSignedModel(card: ICard): RawSignedModel;
/**
* Generates a {@link RawSignedModel} from the given `params`.
*
* @hidden
*
* @param {ICardCrypto} crypto - Object implementing the {@link ICardCrypto}
* interface.
* @param {INewCardParams} params - New card parameters.
* @returns {RawSignedModel}
*/
export declare function generateRawSigned(crypto: ICardCrypto, params: INewCardParams): RawSignedModel;
/**
* Converts the {@link RawSignedModel} into the {@link ICard}.
*
* @hidden
*
* @param {ICardCrypto} crypto - Object implementing the {@link ICardCrypto}
* interface.
* @param {RawSignedModel} model - The model to convert.
* @param {boolean} isOutdated - Boolean indicating whether there is a newer
* Virgil Card replacing the one that `model` represents.
*
* @returns {ICard}
*/
export declare function parseRawSignedModel(crypto: ICardCrypto, model: RawSignedModel, isOutdated?: boolean): ICard;
/**
* Given the array of `cards`, returns another array with outdated cards
* filtered out and the `previousCard` properties of the cards that replace
* the outdated ones being populated with appropriate outdated cards.
* i.e. turns this (A is for Actual, O is for Outdated):
* ```
* A -> O -> A -> A -> O
* ```
* into this
* ```
* A -> A -> A
* | |
* O O
* ```
*
* @hidden
*
* @param {ICard[]} cards - The cards array to transform.
* @returns {ICard[]} - Transformed array.
*/
export declare function linkedCardList(cards: ICard[]): ICard[];