UNPKG

@shockpkg/ria-packager

Version:

Package for creating Adobe AIR packages

172 lines (171 loc) 4.09 kB
/// <reference types="node" /> import { SecurityCertificate } from './security/certificate'; import { SecurityKeyPrivate } from './security/key/private'; import { SecurityTimestamper } from './security/timestamper'; import { HasherSha1 } from './hasher/sha1'; import { HasherSha256 } from './hasher/sha256'; /** * Signature constructor. */ export declare class Signature extends Object { /** * Certificate. */ certificate: SecurityCertificate | null; /** * Private key. */ keyPrivate: SecurityKeyPrivate | null; /** * Timestamp URL. */ timestampUrl: string | null; /** * Timestamp URI for SignatureValue. */ timestampUriSignature: boolean; /** * Timestamp URI for #PackageSignatureValue. */ timestampUriPackage: boolean; /** * Template strings for signatures. */ protected _templates: Map<string, string>; /** * File references. */ protected _packageManifest: string[]; /** * Manifest digest. */ protected _manifestDiest: Buffer | null; /** * Signed data. */ protected _signedInfo: string | null; /** * Signature digest. */ protected _signature: Buffer | null; /** * Key info. */ protected _keyInfo: string | null; /** * Timestamp info. */ protected _timestamp: Buffer | null; constructor(); /** * Reset options to defaults. */ defaults(): void; /** * Reset the internal state. */ reset(): void; /** * Add file to signature. * * @param uri File URI. * @param data File data. */ addFile(uri: string, data: Readonly<Buffer>): void; /** * Digest contents. */ digest(): void; /** * Sign signature. */ sign(): void; /** * Add timestamp to signature. */ timestamp(): Promise<void>; /** * Encode signature. * * @returns Encoded signature. */ encode(): Buffer; /** * Get list of timestamp data references for URI attribute. * * @returns List of references. */ protected _getTimestampDataReferenceUris(): string[]; /** * Create string from a template string. * * @param name Template name. * @param values Indexed values. * @returns Complete string. */ protected _templated(name: string, values: Readonly<string[]>): string; /** * Create timestamper. * * @param url Server URL. * @returns Timestamper instance. */ protected _createSecurityTimestamper(url: string): SecurityTimestamper; /** * Create SHA1 hasher instance. * * @returns Hasher instance. */ protected _createHasherSha1(): HasherSha1; /** * Create SHA256 hasher instance. * * @returns Hasher instance. */ protected _createHasherSha256(): HasherSha256; /** * Hash data using SHA1. * * @param data Data to be hashed. * @returns Hash digest. */ protected _hashSha1(data: Readonly<Buffer>): Buffer; /** * Hash data using SHA256. * * @param data Data to be hashed. * @returns Hash digest. */ protected _hashSha256(data: Readonly<Buffer>): Buffer; /** * Base64 encode with some defaults to match official pacakger. * * @param data Data to be encoded. * @param chunk Chunk size. * @param delimit Chunk delimiter. * @returns Encoded data. */ protected _base64Encode(data: Readonly<Buffer>, chunk?: number, delimit?: string): string; /** * Create the timestamp XML. * * @returns Timestamp XML. */ protected _createTimestampXml(): string; /** * Build the key info. * * @returns Key info. */ protected _buildKeyInfo(): string; /** * Build the certchain data. * * @returns Certchain data. */ protected _buildAndVerifyCertChain(): { certchain: Buffer[]; crlValidationCerts: Buffer[]; crls: Buffer[]; }; }