virgil-sdk
Version:
Virgil Security Services SDK
94 lines (93 loc) • 3.18 kB
TypeScript
/**
* JSON-serializable representation of Virgil Card as it is stored in the
* Virgil Cards Service.
*/
export interface IRawSignedModelJson {
/**
* The signatures of this card's `content_snapshot`.
*/
readonly signatures: IRawSignature[];
/**
* The snapshot of this card's contents as a string in base64 encoding.
*/
readonly content_snapshot: string;
}
/**
* JSON-serializable representation of the Virgil Card's signature as it is
* stored in the Virgil Cards Service..
*/
export interface IRawSignature {
/**
* The signer identifier.
*/
readonly signer: string;
/**
* The signature bytes as a string in base64 encoding.
*/
readonly signature: string;
/**
* The snapshot of additional attributes associated with the signature
* as a string in base64 encoding.
*/
readonly snapshot?: string;
}
/**
* Intermediate representation of the Virgil Card with `contentSnapshot`
* and `snapshot`s of the signatures in UTF-8.
*/
export declare class RawSignedModel {
readonly contentSnapshot: string;
readonly signatures: IRawSignature[];
/**
* Converts the `str` in base64 encoding into a `RawSignedModel` object.
*
* @param {string} str - Base64 string representation of the card as
* returned by {@RawSignedModel.toString} method.
*
* @returns {RawSignedModel}
*/
static fromString(str: string): RawSignedModel;
/**
* Converts the `json` serializable object into a `RawSignedModel` object.
* @param {IRawSignedModelJson} json - JSON-serializable object returned by
* {@link RawSignedModel.toJson} method.
* @returns {RawSignedModel}
*/
static fromJson(json: IRawSignedModelJson): RawSignedModel;
/**
* Initializes a new instance of `RawSignedModel`.
* @param {string} contentSnapshot - The content snapshot in UTF-8.
* @param {IRawSignature[]} signatures - The signatures. If signatures
* themselves have snapshots, those must also be in UTF-8.
*/
constructor(contentSnapshot: string, signatures: IRawSignature[]);
/**
* This is to make it work with `JSON.stringify`, calls
* {@link RawSignedModel.toJson} under the hood.
* @returns {IRawSignedModelJson}
*/
toJSON(): IRawSignedModelJson;
/**
* Returns a JSON-serializable representation of this model in the
* format it is stored in the Virgil Cards Service. (i.e. with
* `contentSnapshot` and `snapshot`s of the signatures as base64 encoded
* strings.
* @returns {IRawSignedModelJson}
*/
toJson(): IRawSignedModelJson;
/**
* Serializes this model to string in base64 encoding.
* @returns {string}
*/
toString(): string;
/**
* Same as {@link RawSignedModel.toJson}. Please use that instead.
* @returns {IRawSignedModelJson}
*/
exportAsJson(): IRawSignedModelJson;
/**
* Same as {@link RawSignedModel.toString}. Please use that instead.
* @returns {string}
*/
exportAsString(): string;
}