UNPKG

age-encryption

Version:

<p align="center"> <picture> <source media="(prefers-color-scheme: dark)" srcset="https://github.com/FiloSottile/age/blob/main/logo/logo_white.svg"> <source media="(prefers-color-scheme: light)" srcset="https://github.com/FiloSottile/a

48 lines (47 loc) 1.67 kB
import { Stanza } from "./format.js"; import { Identity, Recipient } from "./index.js"; /** * Generate a new native age identity. * * @returns A promise that resolves to the new identity, a string starting with * `AGE-SECRET-KEY-1...`. Use {@link identityToRecipient} to produce the * corresponding recipient. */ export declare function generateIdentity(): Promise<string>; /** * Convert an age identity to a recipient. * * @param identity - An age identity, a string starting with * `AGE-SECRET-KEY-1...` or an X25519 private * {@link https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey | CryptoKey} * object. * * @returns A promise that resolves to the corresponding recipient, a string * starting with `age1...`. * * @see {@link generateIdentity} * @see {@link Decrypter.addIdentity} */ export declare function identityToRecipient(identity: string | CryptoKey): Promise<string>; export declare class X25519Recipient implements Recipient { private recipient; constructor(s: string); wrapFileKey(fileKey: Uint8Array): Promise<Stanza[]>; } export declare class X25519Identity implements Identity { private identity; private recipient; constructor(s: string | CryptoKey); unwrapFileKey(stanzas: Stanza[]): Promise<Uint8Array | null>; } export declare class ScryptRecipient implements Recipient { private passphrase; private logN; constructor(passphrase: string, logN: number); wrapFileKey(fileKey: Uint8Array): Stanza[]; } export declare class ScryptIdentity implements Identity { private passphrase; constructor(passphrase: string); unwrapFileKey(stanzas: Stanza[]): Uint8Array | null; }