@happyvertical/encryption 0.74.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENT.md +33 -0
- package/LICENSE +7 -0
- package/README.md +478 -0
- package/dist/adapters/nacl.d.ts +75 -0
- package/dist/adapters/nacl.d.ts.map +1 -0
- package/dist/adapters/node.d.ts +96 -0
- package/dist/adapters/node.d.ts.map +1 -0
- package/dist/adapters/pgp.d.ts +79 -0
- package/dist/adapters/pgp.d.ts.map +1 -0
- package/dist/chunks/nacl-CoiIhzki.js +454 -0
- package/dist/chunks/nacl-CoiIhzki.js.map +1 -0
- package/dist/chunks/node-nfBpcQQH.js +551 -0
- package/dist/chunks/node-nfBpcQQH.js.map +1 -0
- package/dist/chunks/pgp-BIhtvrNo.js +916 -0
- package/dist/chunks/pgp-BIhtvrNo.js.map +1 -0
- package/dist/cli/claude-context.d.ts +3 -0
- package/dist/cli/claude-context.d.ts.map +1 -0
- package/dist/cli/claude-context.js +21 -0
- package/dist/cli/claude-context.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +356 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/base.d.ts +61 -0
- package/dist/shared/base.d.ts.map +1 -0
- package/dist/shared/errors.d.ts +79 -0
- package/dist/shared/errors.d.ts.map +1 -0
- package/dist/shared/factory.d.ts +42 -0
- package/dist/shared/factory.d.ts.map +1 -0
- package/dist/shared/types.d.ts +310 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/metadata.json +34 -0
- package/package.json +67 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Transform } from 'node:stream';
|
|
2
|
+
import { AdapterType, DecryptEmailOptions, DecryptedEmail, DecryptOptions, EmailMessage, EncryptEmailOptions, Encryption, EncryptionCapabilities, EncryptOptions, ExportKeyOptions, ImportKeyOptions, Key, KeyPair, KeyPairOptions, SignEmailOptions, SignOptions, VerificationResult, VerifyEmailOptions, VerifyOptions } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Base adapter class that provides common functionality for all encryption adapters
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseEncryption implements Encryption {
|
|
7
|
+
protected readonly adapterType: AdapterType;
|
|
8
|
+
protected readonly debug: boolean;
|
|
9
|
+
constructor(adapterType: AdapterType, debug?: boolean);
|
|
10
|
+
/**
|
|
11
|
+
* Get the adapter type
|
|
12
|
+
*/
|
|
13
|
+
getAdapter(): AdapterType;
|
|
14
|
+
/**
|
|
15
|
+
* Log debug messages if debug mode is enabled
|
|
16
|
+
*/
|
|
17
|
+
protected log(message: string, ...args: unknown[]): void;
|
|
18
|
+
/**
|
|
19
|
+
* Validate that a key is provided
|
|
20
|
+
*/
|
|
21
|
+
protected validateKey(key: string | Buffer | Uint8Array | undefined, keyType: 'public' | 'private'): void;
|
|
22
|
+
/**
|
|
23
|
+
* Validate encryption options
|
|
24
|
+
*/
|
|
25
|
+
protected validateEncryptOptions(options?: EncryptOptions): void;
|
|
26
|
+
/**
|
|
27
|
+
* Validate decryption options
|
|
28
|
+
*/
|
|
29
|
+
protected validateDecryptOptions(options?: DecryptOptions): void;
|
|
30
|
+
/**
|
|
31
|
+
* Convert Buffer to string based on encoding
|
|
32
|
+
*/
|
|
33
|
+
protected bufferToString(buffer: Buffer, encoding?: 'base64' | 'hex' | 'utf8'): string;
|
|
34
|
+
/**
|
|
35
|
+
* Convert string to Buffer based on encoding
|
|
36
|
+
*/
|
|
37
|
+
protected stringToBuffer(str: string, encoding?: 'base64' | 'hex' | 'utf8'): Buffer;
|
|
38
|
+
/**
|
|
39
|
+
* Wrap errors with adapter context
|
|
40
|
+
*/
|
|
41
|
+
protected wrapError(error: unknown, operation: string): Error;
|
|
42
|
+
abstract encryptText(text: string, options?: EncryptOptions): Promise<string>;
|
|
43
|
+
abstract decryptText(encrypted: string, options?: DecryptOptions): Promise<string>;
|
|
44
|
+
encryptFile(inputPath: string, outputPath: string, options?: EncryptOptions): Promise<void>;
|
|
45
|
+
decryptFile(inputPath: string, outputPath: string, options?: DecryptOptions): Promise<void>;
|
|
46
|
+
abstract encryptBuffer(buffer: Buffer, options?: EncryptOptions): Promise<Buffer>;
|
|
47
|
+
abstract decryptBuffer(buffer: Buffer, options?: DecryptOptions): Promise<Buffer>;
|
|
48
|
+
encryptStream?(options?: EncryptOptions): Transform;
|
|
49
|
+
decryptStream?(options?: DecryptOptions): Transform;
|
|
50
|
+
encryptEmail?(message: EmailMessage, options?: EncryptEmailOptions): Promise<EmailMessage>;
|
|
51
|
+
decryptEmail?(message: EmailMessage, options?: DecryptEmailOptions): Promise<DecryptedEmail>;
|
|
52
|
+
signEmail?(message: EmailMessage, options?: SignEmailOptions): Promise<EmailMessage>;
|
|
53
|
+
verifyEmail?(message: EmailMessage, options?: VerifyEmailOptions): Promise<VerificationResult>;
|
|
54
|
+
sign?(data: string | Buffer, options?: SignOptions): Promise<string | Buffer>;
|
|
55
|
+
verify?(data: string | Buffer, signature: string | Buffer, options?: VerifyOptions): Promise<boolean>;
|
|
56
|
+
abstract generateKeyPair(options?: KeyPairOptions): Promise<KeyPair>;
|
|
57
|
+
abstract importKey(key: string | Buffer, options?: ImportKeyOptions): Promise<Key>;
|
|
58
|
+
abstract exportKey(key: Key, options?: ExportKeyOptions): Promise<string | Buffer>;
|
|
59
|
+
abstract getCapabilities(): Promise<EncryptionCapabilities>;
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/shared/base.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAO7C,OAAO,KAAK,EACV,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,YAAY,EACZ,mBAAmB,EACnB,UAAU,EACV,sBAAsB,EACtB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,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AAG,MAAM,CAAC;IAE7E,MAAM,CAAC,CACL,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,SAAS,EAAE,MAAM,GAAG,MAAM,EAC1B,OAAO,CAAC,EAAE,aAAa,GACtB,OAAO,CAAC,OAAO,CAAC;IAMnB,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IAEpE,QAAQ,CAAC,SAAS,CAChB,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,GAAG,CAAC;IAEf,QAAQ,CAAC,SAAS,CAChB,GAAG,EAAE,GAAG,EACR,OAAO,CAAC,EAAE,gBAAgB,GACzB,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IAM3B,QAAQ,CAAC,eAAe,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAC5D"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base error class for all encryption errors
|
|
3
|
+
*/
|
|
4
|
+
export declare class EncryptionError extends Error {
|
|
5
|
+
readonly code: string;
|
|
6
|
+
readonly adapter?: string;
|
|
7
|
+
readonly cause?: unknown;
|
|
8
|
+
readonly timestamp: Date;
|
|
9
|
+
constructor(message: string, code: string, adapter?: string, cause?: unknown);
|
|
10
|
+
/**
|
|
11
|
+
* Convert error to JSON for logging/serialization
|
|
12
|
+
*/
|
|
13
|
+
toJSON(): Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Key-related errors
|
|
17
|
+
*/
|
|
18
|
+
export declare class KeyError extends EncryptionError {
|
|
19
|
+
constructor(message: string, adapter?: string, cause?: unknown);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Invalid key format or content
|
|
23
|
+
*/
|
|
24
|
+
export declare class InvalidKeyError extends EncryptionError {
|
|
25
|
+
constructor(message: string, adapter?: string, cause?: unknown);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Key not found error
|
|
29
|
+
*/
|
|
30
|
+
export declare class KeyNotFoundError extends EncryptionError {
|
|
31
|
+
readonly keyId?: string;
|
|
32
|
+
constructor(message: string, keyId?: string, adapter?: string);
|
|
33
|
+
toJSON(): Record<string, unknown>;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Passphrase-related errors
|
|
37
|
+
*/
|
|
38
|
+
export declare class PassphraseError extends EncryptionError {
|
|
39
|
+
constructor(message: string, adapter?: string, cause?: unknown);
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Encryption operation errors
|
|
43
|
+
*/
|
|
44
|
+
export declare class EncryptError extends EncryptionError {
|
|
45
|
+
constructor(message: string, adapter?: string, cause?: unknown);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Decryption operation errors
|
|
49
|
+
*/
|
|
50
|
+
export declare class DecryptError extends EncryptionError {
|
|
51
|
+
constructor(message: string, adapter?: string, cause?: unknown);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Signature operation errors
|
|
55
|
+
*/
|
|
56
|
+
export declare class SignatureError extends EncryptionError {
|
|
57
|
+
constructor(message: string, adapter?: string, cause?: unknown);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Verification operation errors
|
|
61
|
+
*/
|
|
62
|
+
export declare class VerificationError extends EncryptionError {
|
|
63
|
+
constructor(message: string, adapter?: string, cause?: unknown);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Format-related errors
|
|
67
|
+
*/
|
|
68
|
+
export declare class FormatError extends EncryptionError {
|
|
69
|
+
constructor(message: string, adapter?: string, cause?: unknown);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Algorithm-related errors
|
|
73
|
+
*/
|
|
74
|
+
export declare class AlgorithmError extends EncryptionError {
|
|
75
|
+
readonly algorithm?: string;
|
|
76
|
+
constructor(message: string, algorithm?: string, adapter?: string);
|
|
77
|
+
toJSON(): Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/shared/errors.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAgB,IAAI,EAAE,MAAM,CAAC;IAC7B,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjC,SAAgB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChC,SAAgB,SAAS,EAAE,IAAI,CAAC;gBAG9B,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,OAAO;IAejB;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAWlC;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,eAAe;gBAC/B,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI/D;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,eAAe;gBACtC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI/D;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,eAAe;IACnD,SAAgB,KAAK,CAAC,EAAE,MAAM,CAAC;gBAEnB,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAMpD,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAM3C;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,eAAe;gBACtC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI/D;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,eAAe;gBACnC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI/D;AAED;;GAEG;AACH,qBAAa,YAAa,SAAQ,eAAe;gBACnC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI/D;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,eAAe;gBACrC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI/D;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,eAAe;gBACxC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI/D;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,eAAe;gBAClC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO;CAI/D;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,eAAe;IACjD,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;gBAEvB,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM;IAMxD,MAAM,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAM3C"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Encryption, GetEncryptionOptions, NaClOptions, NodeCryptoOptions, PGPOptions } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Type guard to check if options are PGP options
|
|
4
|
+
*/
|
|
5
|
+
export declare function isPGPOptions(opts: GetEncryptionOptions): opts is PGPOptions;
|
|
6
|
+
/**
|
|
7
|
+
* Type guard to check if options are NaCl options
|
|
8
|
+
*/
|
|
9
|
+
export declare function isNaClOptions(opts: GetEncryptionOptions): opts is NaClOptions;
|
|
10
|
+
/**
|
|
11
|
+
* Type guard to check if options are Node crypto options
|
|
12
|
+
*/
|
|
13
|
+
export declare function isNodeCryptoOptions(opts: GetEncryptionOptions): opts is NodeCryptoOptions;
|
|
14
|
+
/**
|
|
15
|
+
* Factory function to create encryption adapter instances
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* // PGP
|
|
20
|
+
* const pgp = await getEncryption({
|
|
21
|
+
* type: 'pgp',
|
|
22
|
+
* publicKey: recipientPublicKey,
|
|
23
|
+
* privateKey: myPrivateKey,
|
|
24
|
+
* passphrase: 'my-passphrase'
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // NaCl
|
|
28
|
+
* const nacl = await getEncryption({
|
|
29
|
+
* type: 'nacl',
|
|
30
|
+
* secretKey: mySecretKey
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Node crypto
|
|
34
|
+
* const crypto = await getEncryption({
|
|
35
|
+
* type: 'node',
|
|
36
|
+
* algorithm: 'aes-256-gcm',
|
|
37
|
+
* key: encryptionKey
|
|
38
|
+
* });
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
export declare function getEncryption(options: GetEncryptionOptions): Promise<Encryption>;
|
|
42
|
+
//# sourceMappingURL=factory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/shared/factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,oBAAoB,EACpB,WAAW,EACX,iBAAiB,EACjB,UAAU,EACX,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,IAAI,UAAU,CAE3E;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI,IAAI,WAAW,CAE7E;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,oBAAoB,GACzB,IAAI,IAAI,iBAAiB,CAE3B;AAkID;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAsB,aAAa,CACjC,OAAO,EAAE,oBAAoB,GAC5B,OAAO,CAAC,UAAU,CAAC,CAiCrB"}
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
import { Transform } from 'node:stream';
|
|
2
|
+
/**
|
|
3
|
+
* Adapter types supported by the encryption package
|
|
4
|
+
*/
|
|
5
|
+
export type AdapterType = 'pgp' | 'nacl' | 'node';
|
|
6
|
+
/**
|
|
7
|
+
* Core Encryption interface that all adapters must implement
|
|
8
|
+
*/
|
|
9
|
+
export interface Encryption {
|
|
10
|
+
encryptText(text: string, options?: EncryptOptions): Promise<string>;
|
|
11
|
+
decryptText(encrypted: string, options?: DecryptOptions): Promise<string>;
|
|
12
|
+
encryptFile(inputPath: string, outputPath: string, options?: EncryptOptions): Promise<void>;
|
|
13
|
+
decryptFile(inputPath: string, outputPath: string, options?: DecryptOptions): Promise<void>;
|
|
14
|
+
encryptBuffer(buffer: Buffer, options?: EncryptOptions): Promise<Buffer>;
|
|
15
|
+
decryptBuffer(buffer: Buffer, options?: DecryptOptions): Promise<Buffer>;
|
|
16
|
+
encryptStream?(options?: EncryptOptions): Transform;
|
|
17
|
+
decryptStream?(options?: DecryptOptions): Transform;
|
|
18
|
+
encryptEmail?(message: EmailMessage, options?: EncryptEmailOptions): Promise<EmailMessage>;
|
|
19
|
+
decryptEmail?(message: EmailMessage, options?: DecryptEmailOptions): Promise<DecryptedEmail>;
|
|
20
|
+
signEmail?(message: EmailMessage, options?: SignEmailOptions): Promise<EmailMessage>;
|
|
21
|
+
verifyEmail?(message: EmailMessage, options?: VerifyEmailOptions): Promise<VerificationResult>;
|
|
22
|
+
sign?(data: string | Buffer, options?: SignOptions): Promise<string | Buffer>;
|
|
23
|
+
verify?(data: string | Buffer, signature: string | Buffer, options?: VerifyOptions): Promise<boolean>;
|
|
24
|
+
generateKeyPair(options?: KeyPairOptions): Promise<KeyPair>;
|
|
25
|
+
importKey(key: string | Buffer, options?: ImportKeyOptions): Promise<Key>;
|
|
26
|
+
exportKey(key: Key, options?: ExportKeyOptions): Promise<string | Buffer>;
|
|
27
|
+
getCapabilities(): Promise<EncryptionCapabilities>;
|
|
28
|
+
getAdapter(): AdapterType;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Options for encryption operations
|
|
32
|
+
*/
|
|
33
|
+
export interface EncryptOptions {
|
|
34
|
+
armor?: boolean;
|
|
35
|
+
encoding?: 'base64' | 'hex' | 'utf8';
|
|
36
|
+
compression?: boolean;
|
|
37
|
+
publicKeys?: string[];
|
|
38
|
+
recipientPublicKey?: string | Uint8Array | Buffer;
|
|
39
|
+
sign?: boolean;
|
|
40
|
+
privateKey?: string | Buffer;
|
|
41
|
+
aad?: Buffer;
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Options for decryption operations
|
|
46
|
+
*/
|
|
47
|
+
export interface DecryptOptions {
|
|
48
|
+
encoding?: 'base64' | 'hex' | 'utf8';
|
|
49
|
+
verify?: boolean;
|
|
50
|
+
publicKey?: string | Uint8Array | Buffer;
|
|
51
|
+
privateKey?: string | Buffer;
|
|
52
|
+
passphrase?: string;
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Options for email encryption
|
|
57
|
+
*/
|
|
58
|
+
export interface EncryptEmailOptions {
|
|
59
|
+
sign?: boolean;
|
|
60
|
+
privateKey?: string;
|
|
61
|
+
passphrase?: string;
|
|
62
|
+
armor?: boolean;
|
|
63
|
+
compression?: boolean;
|
|
64
|
+
encryptSubject?: boolean;
|
|
65
|
+
publicKeys?: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Options for email decryption
|
|
69
|
+
*/
|
|
70
|
+
export interface DecryptEmailOptions {
|
|
71
|
+
verify?: boolean;
|
|
72
|
+
publicKey?: string;
|
|
73
|
+
privateKey?: string;
|
|
74
|
+
passphrase?: string;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Decrypted email with encryption metadata
|
|
78
|
+
*/
|
|
79
|
+
export interface DecryptedEmail extends EmailMessage {
|
|
80
|
+
encrypted: boolean;
|
|
81
|
+
signed: boolean;
|
|
82
|
+
verified?: boolean;
|
|
83
|
+
verificationError?: string;
|
|
84
|
+
signerKeyId?: string;
|
|
85
|
+
signerFingerprint?: string;
|
|
86
|
+
encryptionAlgorithm?: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Options for signing operations
|
|
90
|
+
*/
|
|
91
|
+
export interface SignOptions {
|
|
92
|
+
privateKey?: string | Buffer;
|
|
93
|
+
passphrase?: string;
|
|
94
|
+
detached?: boolean;
|
|
95
|
+
armor?: boolean;
|
|
96
|
+
algorithm?: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Options for signature verification
|
|
100
|
+
*/
|
|
101
|
+
export interface VerifyOptions {
|
|
102
|
+
publicKey: string | Uint8Array | Buffer;
|
|
103
|
+
detached?: boolean;
|
|
104
|
+
algorithm?: string;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Email signing options
|
|
108
|
+
*/
|
|
109
|
+
export interface SignEmailOptions extends SignOptions {
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Email verification options
|
|
113
|
+
*/
|
|
114
|
+
export interface VerifyEmailOptions extends VerifyOptions {
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Verification result
|
|
118
|
+
*/
|
|
119
|
+
export interface VerificationResult {
|
|
120
|
+
valid: boolean;
|
|
121
|
+
keyId?: string;
|
|
122
|
+
keyFingerprint?: string;
|
|
123
|
+
timestamp?: Date;
|
|
124
|
+
algorithm?: string;
|
|
125
|
+
message?: string;
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Key pair
|
|
129
|
+
*/
|
|
130
|
+
export interface KeyPair {
|
|
131
|
+
publicKey: string | Uint8Array | Buffer;
|
|
132
|
+
privateKey: string | Uint8Array | Buffer;
|
|
133
|
+
fingerprint?: string;
|
|
134
|
+
keyId?: string;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Options for key pair generation
|
|
138
|
+
*/
|
|
139
|
+
export interface KeyPairOptions {
|
|
140
|
+
name?: string;
|
|
141
|
+
email?: string;
|
|
142
|
+
passphrase?: string;
|
|
143
|
+
type?: 'rsa' | 'ecc' | 'ecdsa' | 'ecdh';
|
|
144
|
+
keySize?: number;
|
|
145
|
+
curve?: string;
|
|
146
|
+
modulusLength?: number;
|
|
147
|
+
publicExponent?: number;
|
|
148
|
+
publicKeyEncoding?: {
|
|
149
|
+
type: 'spki' | 'pkcs1';
|
|
150
|
+
format: 'pem' | 'der';
|
|
151
|
+
};
|
|
152
|
+
privateKeyEncoding?: {
|
|
153
|
+
type: 'pkcs8' | 'pkcs1';
|
|
154
|
+
format: 'pem' | 'der';
|
|
155
|
+
cipher?: string;
|
|
156
|
+
passphrase?: string;
|
|
157
|
+
};
|
|
158
|
+
expirationTime?: number;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Key object
|
|
162
|
+
*/
|
|
163
|
+
export interface Key {
|
|
164
|
+
type: 'public' | 'private';
|
|
165
|
+
format: 'armored' | 'binary' | 'pem' | 'der';
|
|
166
|
+
data: string | Buffer | Uint8Array;
|
|
167
|
+
fingerprint?: string;
|
|
168
|
+
keyId?: string;
|
|
169
|
+
algorithm?: string;
|
|
170
|
+
created?: Date;
|
|
171
|
+
expires?: Date;
|
|
172
|
+
userIds?: Array<{
|
|
173
|
+
name?: string;
|
|
174
|
+
email?: string;
|
|
175
|
+
}>;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Options for key import
|
|
179
|
+
*/
|
|
180
|
+
export interface ImportKeyOptions {
|
|
181
|
+
format?: 'armored' | 'binary' | 'pem' | 'der';
|
|
182
|
+
type?: 'public' | 'private';
|
|
183
|
+
passphrase?: string;
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Options for key export
|
|
187
|
+
*/
|
|
188
|
+
export interface ExportKeyOptions {
|
|
189
|
+
format?: 'armored' | 'binary' | 'pem' | 'der';
|
|
190
|
+
armor?: boolean;
|
|
191
|
+
encrypt?: boolean;
|
|
192
|
+
passphrase?: string;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Encryption capabilities
|
|
196
|
+
*/
|
|
197
|
+
export interface EncryptionCapabilities {
|
|
198
|
+
textEncryption: boolean;
|
|
199
|
+
fileEncryption: boolean;
|
|
200
|
+
bufferEncryption: boolean;
|
|
201
|
+
streamEncryption: boolean;
|
|
202
|
+
emailEncryption: boolean;
|
|
203
|
+
signing: boolean;
|
|
204
|
+
verification: boolean;
|
|
205
|
+
keyGeneration: boolean;
|
|
206
|
+
keyManagement: boolean;
|
|
207
|
+
multipleRecipients: boolean;
|
|
208
|
+
symmetricEncryption: boolean;
|
|
209
|
+
asymmetricEncryption: boolean;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Email message structure (from @happyvertical/email)
|
|
213
|
+
*/
|
|
214
|
+
export interface EmailMessage {
|
|
215
|
+
id?: string;
|
|
216
|
+
messageId?: string;
|
|
217
|
+
from: EmailAddress;
|
|
218
|
+
to: EmailAddress[];
|
|
219
|
+
cc?: EmailAddress[];
|
|
220
|
+
bcc?: EmailAddress[];
|
|
221
|
+
replyTo?: EmailAddress;
|
|
222
|
+
subject: string;
|
|
223
|
+
date?: Date;
|
|
224
|
+
text?: string;
|
|
225
|
+
html?: string;
|
|
226
|
+
attachments?: Attachment[];
|
|
227
|
+
folder?: string;
|
|
228
|
+
labels?: string[];
|
|
229
|
+
flags?: string[];
|
|
230
|
+
headers?: Record<string, string | string[]>;
|
|
231
|
+
raw?: string;
|
|
232
|
+
contentType?: string;
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Email address
|
|
236
|
+
*/
|
|
237
|
+
export interface EmailAddress {
|
|
238
|
+
name?: string;
|
|
239
|
+
address: string;
|
|
240
|
+
}
|
|
241
|
+
/**
|
|
242
|
+
* Email attachment
|
|
243
|
+
*/
|
|
244
|
+
export interface Attachment {
|
|
245
|
+
filename?: string;
|
|
246
|
+
contentType: string;
|
|
247
|
+
size: number;
|
|
248
|
+
content?: Buffer;
|
|
249
|
+
contentId?: string;
|
|
250
|
+
contentDisposition?: 'attachment' | 'inline';
|
|
251
|
+
path?: string;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* PGP adapter options
|
|
255
|
+
*/
|
|
256
|
+
export interface PGPOptions {
|
|
257
|
+
type: 'pgp';
|
|
258
|
+
publicKey?: string;
|
|
259
|
+
privateKey?: string;
|
|
260
|
+
passphrase?: string;
|
|
261
|
+
publicKeys?: string[];
|
|
262
|
+
privateKeys?: string[];
|
|
263
|
+
armor?: boolean;
|
|
264
|
+
compression?: boolean;
|
|
265
|
+
debug?: boolean;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* NaCl adapter options
|
|
269
|
+
*/
|
|
270
|
+
export interface NaClOptions {
|
|
271
|
+
type: 'nacl';
|
|
272
|
+
secretKey?: Uint8Array | Buffer | string;
|
|
273
|
+
publicKey?: Uint8Array | Buffer | string;
|
|
274
|
+
encoding?: 'base64' | 'hex' | 'utf8';
|
|
275
|
+
debug?: boolean;
|
|
276
|
+
}
|
|
277
|
+
/**
|
|
278
|
+
* Node.js crypto adapter options
|
|
279
|
+
*/
|
|
280
|
+
export interface NodeCryptoOptions {
|
|
281
|
+
type: 'node';
|
|
282
|
+
algorithm: 'aes-256-gcm' | 'aes-256-cbc' | 'aes-128-gcm' | 'rsa' | 'rsa-oaep' | 'rsa-pss' | 'ecdh' | 'ecdsa' | string;
|
|
283
|
+
key?: Buffer | string;
|
|
284
|
+
keyDerivation?: {
|
|
285
|
+
password: string;
|
|
286
|
+
salt?: Buffer | string;
|
|
287
|
+
iterations?: number;
|
|
288
|
+
keyLength?: number;
|
|
289
|
+
digest?: string;
|
|
290
|
+
};
|
|
291
|
+
publicKey?: string | Buffer;
|
|
292
|
+
privateKey?: string | Buffer;
|
|
293
|
+
passphrase?: string;
|
|
294
|
+
iv?: Buffer | string;
|
|
295
|
+
encoding?: 'hex' | 'base64' | 'utf8';
|
|
296
|
+
debug?: boolean;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Union type for all adapter options
|
|
300
|
+
*/
|
|
301
|
+
export type GetEncryptionOptions = PGPOptions | NaClOptions | NodeCryptoOptions;
|
|
302
|
+
/**
|
|
303
|
+
* Configuration after validation
|
|
304
|
+
*/
|
|
305
|
+
export interface EncryptionConfig {
|
|
306
|
+
type: AdapterType;
|
|
307
|
+
debug?: boolean;
|
|
308
|
+
[key: string]: unknown;
|
|
309
|
+
}
|
|
310
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/shared/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAElD;;GAEG;AACH,MAAM,WAAW,UAAU;IAEzB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACrE,WAAW,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAG1E,WAAW,CACT,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CA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AAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IAGpB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAGrB,QAAQ,CAAC,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;IAGrC,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,UAAU,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAEhF;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,WAAW,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB"}
|
package/metadata.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@happyvertical/encryption",
|
|
3
|
+
"path": "packages/encryption",
|
|
4
|
+
"position": {
|
|
5
|
+
"index": 10,
|
|
6
|
+
"count": 30
|
|
7
|
+
},
|
|
8
|
+
"description": "Unified encryption and cryptography operations with adapter-based architecture",
|
|
9
|
+
"provides": [
|
|
10
|
+
"Unified encryption and cryptography operations with adapter-based architecture"
|
|
11
|
+
],
|
|
12
|
+
"implements": [],
|
|
13
|
+
"requires": {
|
|
14
|
+
"workspace": [
|
|
15
|
+
"@happyvertical/logger",
|
|
16
|
+
"@happyvertical/utils"
|
|
17
|
+
],
|
|
18
|
+
"externalHappyVertical": [],
|
|
19
|
+
"external": [
|
|
20
|
+
"@openpgp/web-stream-tools",
|
|
21
|
+
"openpgp",
|
|
22
|
+
"tweetnacl",
|
|
23
|
+
"tweetnacl-util"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"dependents": [],
|
|
27
|
+
"stability": {
|
|
28
|
+
"level": "stable",
|
|
29
|
+
"reason": "Primary package surface is described as implemented and production-oriented."
|
|
30
|
+
},
|
|
31
|
+
"keywords": [
|
|
32
|
+
"encryption"
|
|
33
|
+
]
|
|
34
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@happyvertical/encryption",
|
|
3
|
+
"version": "0.74.8",
|
|
4
|
+
"description": "Unified encryption and cryptography operations with adapter-based architecture",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"import": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"have-encryption-context": "./dist/cli/claude-context.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"README.md",
|
|
21
|
+
"LICENSE",
|
|
22
|
+
"AGENT.md",
|
|
23
|
+
"metadata.json"
|
|
24
|
+
],
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"registry": "https://registry.npmjs.org",
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@openpgp/web-stream-tools": "^0.3.1",
|
|
31
|
+
"openpgp": "^6.3.0",
|
|
32
|
+
"tweetnacl": "^1.0.3",
|
|
33
|
+
"tweetnacl-util": "^0.15.1",
|
|
34
|
+
"@happyvertical/logger": "0.74.8",
|
|
35
|
+
"@happyvertical/utils": "0.74.8"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/node": "25.0.10",
|
|
39
|
+
"typescript": "^5.9.3",
|
|
40
|
+
"vite": "7.3.2",
|
|
41
|
+
"vite-plugin-dts": "4.5.4",
|
|
42
|
+
"vitest": "^4.1.5"
|
|
43
|
+
},
|
|
44
|
+
"keywords": [
|
|
45
|
+
"encryption",
|
|
46
|
+
"cryptography",
|
|
47
|
+
"pgp",
|
|
48
|
+
"openpgp",
|
|
49
|
+
"nacl",
|
|
50
|
+
"crypto",
|
|
51
|
+
"security"
|
|
52
|
+
],
|
|
53
|
+
"author": "HappyVertical",
|
|
54
|
+
"license": "MIT",
|
|
55
|
+
"repository": {
|
|
56
|
+
"type": "git",
|
|
57
|
+
"url": "https://github.com/happyvertical/sdk.git",
|
|
58
|
+
"directory": "packages/encryption"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"build": "vite build",
|
|
62
|
+
"dev": "vite build --watch",
|
|
63
|
+
"test": "vitest run",
|
|
64
|
+
"test:watch": "vitest",
|
|
65
|
+
"typecheck": "tsc --noEmit"
|
|
66
|
+
}
|
|
67
|
+
}
|