mimekit-ts - v1.0.0
    Preparing search index...

    Interface OpenPgpEngine

    The minimal set of OpenPGP primitives the PGP/MIME layer needs. Keys are opaque backend handles (OpenPgpPublicKey / OpenPgpPrivateKey).

    interface OpenPgpEngine {
        readPublicKeys(
            input: string | Uint8Array<ArrayBufferLike>,
        ): Promise<PublicKey[]>;
        readPrivateKeys(
            input: string | Uint8Array<ArrayBufferLike>,
        ): Promise<PrivateKey[]>;
        unlock(key: PrivateKey, passphrase: string): Promise<PrivateKey>;
        signDetached(
            data: Uint8Array,
            signingKeys: PrivateKey[],
            digestAlgo: DigestAlgorithm,
        ): Promise<Uint8Array<ArrayBufferLike>>;
        verifyDetached(
            data: Uint8Array,
            armoredSignature: Uint8Array,
            verificationKeys: PublicKey[],
        ): Promise<OpenPgpVerification[]>;
        encrypt(
            data: Uint8Array,
            encryptionKeys: PublicKey[],
            options?: {
                cipher?: EncryptionAlgorithm;
                signingKeys?: PrivateKey[];
                digestAlgo?: DigestAlgorithm;
            },
        ): Promise<Uint8Array<ArrayBufferLike>>;
        decrypt(
            armored: Uint8Array,
            decryptionKeys: PrivateKey[],
            verificationKeys?: PublicKey[],
        ): Promise<OpenPgpDecryptResult>;
    }

    Implemented by

    Index
    • Parse one or more public keys from armored text or binary key data.

      Parameters

      • input: string | Uint8Array<ArrayBufferLike>

      Returns Promise<PublicKey[]>

    • Parse one or more (possibly locked) private keys from armored text or binary key data.

      Parameters

      • input: string | Uint8Array<ArrayBufferLike>

      Returns Promise<PrivateKey[]>

    • Unlock a locked private key with the given passphrase.

      Parameters

      • key: PrivateKey
      • passphrase: string

      Returns Promise<PrivateKey>

    • Produce an ASCII-armored detached signature over data.

      Parameters

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Verify an ASCII-armored detached signature over data.

      Parameters

      • data: Uint8Array
      • armoredSignature: Uint8Array
      • verificationKeys: PublicKey[]

      Returns Promise<OpenPgpVerification[]>

    • Produce an ASCII-armored encrypted (optionally signed) message.

      Parameters

      • data: Uint8Array
      • encryptionKeys: PublicKey[]
      • Optionaloptions: {
            cipher?: EncryptionAlgorithm;
            signingKeys?: PrivateKey[];
            digestAlgo?: DigestAlgorithm;
        }

      Returns Promise<Uint8Array<ArrayBufferLike>>

    • Decrypt an ASCII-armored message and, if verification keys are supplied, verify its signatures.

      Parameters

      • armored: Uint8Array
      • decryptionKeys: PrivateKey[]
      • OptionalverificationKeys: PublicKey[]

      Returns Promise<OpenPgpDecryptResult>