@shockpkg/ria-packager
Version:
Package for creating Adobe AIR packages
182 lines (181 loc) • 4.43 kB
TypeScript
import { SecurityCertificate } from './security/certificate.ts';
import { SecurityKeyPrivate } from './security/key/private.ts';
import { SecurityTimestamper } from './security/timestamper.ts';
import { HasherSha1 } from './hasher/sha1.ts';
import { HasherSha256 } from './hasher/sha256.ts';
/**
* Signature object.
*/
export declare class Signature {
/**
* Certificate.
*/
certificate: SecurityCertificate | null;
/**
* Private key.
*/
privateKey: SecurityKeyPrivate | null;
/**
* Signature digest algorithm.
*/
signDigest: 'sha1' | 'sha256';
/**
* Timestamp digest algorithm.
*/
timestampDigest: 'sha1' | 'sha256';
/**
* 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 _manifestDigest: Uint8Array | null;
/**
* Signed data.
*/
protected _signedInfo: string | null;
/**
* Signature digest.
*/
protected _signature: Uint8Array | null;
/**
* Key info.
*/
protected _keyInfo: string | null;
/**
* Timestamp info.
*/
protected _timestamp: Uint8Array | null;
/**
* Signature constructor.
*/
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<Uint8Array>): void;
/**
* Digest contents.
*/
digest(): void;
/**
* Sign signature.
*/
sign(): void;
/**
* Add timestamp to signature.
*/
timestamp(): Promise<void>;
/**
* Encode signature.
*
* @returns Encoded signature.
*/
encode(): Uint8Array<ArrayBufferLike>;
/**
* 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<Uint8Array>): Uint8Array<ArrayBufferLike>;
/**
* Hash data using SHA256.
*
* @param data Data to be hashed.
* @returns Hash digest.
*/
protected _hashSha256(data: Readonly<Uint8Array>): Uint8Array<ArrayBufferLike>;
/**
* 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<Uint8Array>, 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: Uint8Array<ArrayBufferLike>[];
crlValidationCerts: Uint8Array<ArrayBufferLike>[];
crls: Uint8Array<ArrayBufferLike>[];
};
}