mirror of
https://github.com/openpgpjs/openpgpjs.git
synced 2025-06-02 20:26:41 +00:00
Internal: move config
TS declaration to standalone file
To access the types in internally
This commit is contained in:
parent
87a72e0ab2
commit
4c4ebe4a76
47
openpgp.d.ts
vendored
47
openpgp.d.ts
vendored
@ -11,8 +11,9 @@
|
||||
|
||||
import type { WebStream as GenericWebStream, NodeWebStream as GenericNodeWebStream } from '@openpgp/web-stream-tools';
|
||||
import enums from './src/enums';
|
||||
import config, { type Config, type PartialConfig } from './src/config';
|
||||
|
||||
export { enums };
|
||||
export { enums, config, Config, PartialConfig };
|
||||
|
||||
/* ############## STREAM #################### */
|
||||
type Data = Uint8Array | string;
|
||||
@ -319,50 +320,6 @@ export class Message<T extends MaybeStream<Data>> {
|
||||
public appendSignature(detachedSignature: string | Uint8Array, config?: Config): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
/* ############## CONFIG #################### */
|
||||
|
||||
interface Config {
|
||||
preferredHashAlgorithm: enums.hash;
|
||||
preferredSymmetricAlgorithm: enums.symmetric;
|
||||
preferredCompressionAlgorithm: enums.compression;
|
||||
showVersion: boolean;
|
||||
showComment: boolean;
|
||||
aeadProtect: boolean;
|
||||
allowUnauthenticatedMessages: boolean;
|
||||
allowUnauthenticatedStream: boolean;
|
||||
minRSABits: number;
|
||||
passwordCollisionCheck: boolean;
|
||||
ignoreUnsupportedPackets: boolean;
|
||||
ignoreMalformedPackets: boolean;
|
||||
versionString: string;
|
||||
commentString: string;
|
||||
allowInsecureDecryptionWithSigningKeys: boolean;
|
||||
allowInsecureVerificationWithReformattedKeys: boolean;
|
||||
allowMissingKeyFlags: boolean;
|
||||
constantTimePKCS1Decryption: boolean;
|
||||
constantTimePKCS1DecryptionSupportedSymmetricAlgorithms: Set<enums.symmetric>;
|
||||
v6Keys: boolean;
|
||||
enableParsingV5Entities: boolean;
|
||||
preferredAEADAlgorithm: enums.aead;
|
||||
aeadChunkSizeByte: number;
|
||||
s2kType: enums.s2k.iterated | enums.s2k.argon2;
|
||||
s2kIterationCountByte: number;
|
||||
s2kArgon2Params: { passes: number, parallelism: number; memoryExponent: number; };
|
||||
maxUserIDLength: number;
|
||||
knownNotations: string[];
|
||||
useEllipticFallback: boolean;
|
||||
rejectHashAlgorithms: Set<enums.hash>;
|
||||
rejectMessageHashAlgorithms: Set<enums.hash>;
|
||||
rejectPublicKeyAlgorithms: Set<enums.publicKey>;
|
||||
rejectCurves: Set<enums.curve>;
|
||||
}
|
||||
export const config: Config;
|
||||
|
||||
// PartialConfig has the same properties as Config, but declared as optional.
|
||||
// This interface is relevant for top-level functions, which accept a subset of configuration options
|
||||
export interface PartialConfig extends Partial<Config> {}
|
||||
|
||||
/* ############## PACKET #################### */
|
||||
|
||||
export declare abstract class BasePacket {
|
||||
|
44
src/config/config.d.ts
vendored
Normal file
44
src/config/config.d.ts
vendored
Normal file
@ -0,0 +1,44 @@
|
||||
/**
|
||||
* Global configuration values.
|
||||
*/
|
||||
|
||||
import enums from '../enums';
|
||||
|
||||
export interface Config {
|
||||
preferredHashAlgorithm: enums.hash;
|
||||
preferredSymmetricAlgorithm: enums.symmetric;
|
||||
preferredCompressionAlgorithm: enums.compression;
|
||||
showVersion: boolean;
|
||||
showComment: boolean;
|
||||
aeadProtect: boolean;
|
||||
allowUnauthenticatedMessages: boolean;
|
||||
allowUnauthenticatedStream: boolean;
|
||||
minRSABits: number;
|
||||
passwordCollisionCheck: boolean;
|
||||
ignoreUnsupportedPackets: boolean;
|
||||
ignoreMalformedPackets: boolean;
|
||||
versionString: string;
|
||||
commentString: string;
|
||||
allowInsecureDecryptionWithSigningKeys: boolean;
|
||||
allowInsecureVerificationWithReformattedKeys: boolean;
|
||||
allowMissingKeyFlags: boolean;
|
||||
constantTimePKCS1Decryption: boolean;
|
||||
constantTimePKCS1DecryptionSupportedSymmetricAlgorithms: Set<enums.symmetric>;
|
||||
v6Keys: boolean;
|
||||
enableParsingV5Entities: boolean;
|
||||
preferredAEADAlgorithm: enums.aead;
|
||||
aeadChunkSizeByte: number;
|
||||
s2kType: enums.s2k.iterated | enums.s2k.argon2;
|
||||
s2kIterationCountByte: number;
|
||||
s2kArgon2Params: { passes: number, parallelism: number; memoryExponent: number; };
|
||||
maxUserIDLength: number;
|
||||
knownNotations: string[];
|
||||
useEllipticFallback: boolean;
|
||||
rejectHashAlgorithms: Set<enums.hash>;
|
||||
rejectMessageHashAlgorithms: Set<enums.hash>;
|
||||
rejectPublicKeyAlgorithms: Set<enums.publicKey>;
|
||||
rejectCurves: Set<enums.curve>;
|
||||
}
|
||||
|
||||
declare const config: Config;
|
||||
export default config;
|
@ -87,6 +87,8 @@ export default {
|
||||
* by v6 keys and v6 signatures, respectively.
|
||||
* However, generation of v5 entities was supported behind config flag in OpenPGP.js v5, and some other libraries,
|
||||
* hence parsing them might be necessary in some cases.
|
||||
* @memberof module:config
|
||||
* @property {Boolean} enableParsingV5Entities
|
||||
*/
|
||||
enableParsingV5Entities: false,
|
||||
/**
|
||||
|
13
src/config/index.d.ts
vendored
Normal file
13
src/config/index.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
/**
|
||||
* The config module cannot be written in TS directly for now,
|
||||
* since our JSDoc compiler does not support TS.
|
||||
*/
|
||||
import config, { type Config } from './config';
|
||||
|
||||
|
||||
// PartialConfig has the same properties as Config, but declared as optional.
|
||||
// This interface is relevant for top-level functions, which accept a subset of configuration options
|
||||
interface PartialConfig extends Partial<Config> {}
|
||||
|
||||
export { Config, PartialConfig };
|
||||
export default config;
|
Loading…
x
Reference in New Issue
Block a user