<commit_before>/// <reference path="../native.ts" />
/// <reference path="../object.ts" />

namespace trusted.cms {
    /**
     * Wrap CMS_SignerInfo
     *
     * @export
     * @class Signer
     * @extends {BaseObject<native.CMS.Signer>}
     */
    export class Signer extends BaseObject<native.CMS.Signer> {

        /**
         * Creates an instance of Signer.
         *
         * @param {native.CMS.Signer} handle
         *
         * @memberOf Signer
         */
        constructor(handle: native.CMS.Signer) {
            super();

            this.handle = handle;
        }

        /**
         * Return signer certificate
         *
         * @type {Certificate}
         * @memberOf Signer
         */
        get certificate(): pki.Certificate {
            return new pki.Certificate(this.handle.getCertificate());
        }

        /**
         * Set signer certificate
         * Error if cert no signer
         *
         * @param cert Certificate
         *
         * @memberOf Signer
         */
        set certificate(cert: pki.Certificate) {
            this.handle.setCertificate(cert.handle);
        }

        /**
         * Return digest algorithm
         *
         * @readonly
         * @type {Algorithm}
         * @memberOf Signer
         */
        get digestAlgorithm(): Algorithm {
            const alg: Algorithm = new pki.Algorithm(this.handle.getDigestAlgorithm());
            return alg;
        }

        /**
         * Return signer identifier information
         *
         * @readonly
         * @type {SignerId}
         * @memberOf Signer
         */
        get signerId(): SignerId {
            return new cms.SignerId(this.handle.getSignerId());
        }

        /**
         * Return signing time from signed attributes
         *
         * @readonly
         * @type {string}
         * @memberof Signer
         */
        get signingTime(): string {
            return this.handle.getSigningTime();
        }

        /**
         * Verify signer content
         *
         * @param {ISignedDataContent} v
         * @returns {boolean}
         *<commit_msg>return signing Date<commit_after>/// <reference path="../native.ts" />
/// <reference path="../object.ts" />

namespace trusted.cms {
    /**
     * Wrap CMS_SignerInfo
     *
     * @export
     * @class Signer
     * @extends {BaseObject<native.CMS.Signer>}
     */
    export class Signer extends BaseObject<native.CMS.Signer> {

        /**
         * Creates an instance of Signer.
         *
         * @param {native.CMS.Signer} handle
         *
         * @memberOf Signer
         */
        constructor(handle: native.CMS.Signer) {
            super();

            this.handle = handle;
        }

        /**
         * Return signer certificate
         *
         * @type {Certificate}
         * @memberOf Signer
         */
        get certificate(): pki.Certificate {
            return new pki.Certificate(this.handle.getCertificate());
        }

        /**
         * Set signer certificate
         * Error if cert no signer
         *
         * @param cert Certificate
         *
         * @memberOf Signer
         */
        set certificate(cert: pki.Certificate) {
            this.handle.setCertificate(cert.handle);
        }

        /**
         * Return digest algorithm
         *
         * @readonly
         * @type {Algorithm}
         * @memberOf Signer
         */
        get digestAlgorithm(): Algorithm {
            const alg: Algorithm = new pki.Algorithm(this.handle.getDigestAlgorithm());
            return alg;
        }

        /**
         * Return signer identifier information
         *
         * @readonly
         * @type {SignerId}
         * @memberOf Signer
         */
        get signerId(): SignerId {
            return new cms.SignerId(this.handle.getSignerId());
        }

        /**
         * Return signing time from signed attributes
         *
         * @readonly
         * @type {Date}
         * @memberof Signer
         */
        get signingTime(): Date {
            const strDate = this.handle.getSigningTime();

            if (!strDate.length) {
                return undefined;
            }

            return new Date(strDate);
        }

        /**
         * Verify signer content
         *
         * @param {ISignedDataContent} v
         * @returns {boolean}
         *
{'fraction_non_alphanumeric': 0.10931818181818181, 'fraction_numerical': 0.0, 'mean_word_length': 1.3150973172014728, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4964786', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1144, 'n_words': 252}