@protontech/openpgp 5.4.0 → 5.7.0

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.
Files changed (35) hide show
  1. package/README.md +10 -0
  2. package/dist/lightweight/bn.interface.min.mjs +1 -1
  3. package/dist/lightweight/bn.interface.mjs +1 -1
  4. package/dist/lightweight/bn.min.mjs +2 -2
  5. package/dist/lightweight/bn.min.mjs.map +1 -1
  6. package/dist/lightweight/bn.mjs +1 -1
  7. package/dist/lightweight/elliptic.min.mjs +2 -2
  8. package/dist/lightweight/elliptic.min.mjs.map +1 -1
  9. package/dist/lightweight/elliptic.mjs +1 -1
  10. package/dist/lightweight/index.min.mjs +3 -0
  11. package/dist/lightweight/index.min.mjs.map +1 -0
  12. package/dist/lightweight/index.mjs +706 -0
  13. package/dist/lightweight/openpgp.min.mjs +2 -2
  14. package/dist/lightweight/openpgp.min.mjs.map +1 -1
  15. package/dist/lightweight/openpgp.mjs +5709 -5756
  16. package/dist/lightweight/ponyfill.es6.min.mjs +2 -2
  17. package/dist/lightweight/ponyfill.es6.min.mjs.map +1 -1
  18. package/dist/lightweight/ponyfill.es6.mjs +1 -1
  19. package/dist/lightweight/web-streams-adapter.min.mjs +2 -2
  20. package/dist/lightweight/web-streams-adapter.min.mjs.map +1 -1
  21. package/dist/lightweight/web-streams-adapter.mjs +1 -1
  22. package/dist/node/openpgp.js +5649 -5690
  23. package/dist/node/openpgp.min.js +3 -3
  24. package/dist/node/openpgp.min.js.map +1 -1
  25. package/dist/node/openpgp.min.mjs +3 -3
  26. package/dist/node/openpgp.min.mjs.map +1 -1
  27. package/dist/node/openpgp.mjs +5649 -5690
  28. package/dist/openpgp.js +5657 -5698
  29. package/dist/openpgp.min.js +3 -3
  30. package/dist/openpgp.min.js.map +1 -1
  31. package/dist/openpgp.min.mjs +3 -3
  32. package/dist/openpgp.min.mjs.map +1 -1
  33. package/dist/openpgp.mjs +5657 -5698
  34. package/openpgp.d.ts +20 -5
  35. package/package.json +14 -10
package/openpgp.d.ts CHANGED
@@ -58,7 +58,7 @@ export abstract class Key {
58
58
  public signAllUsers(privateKeys: PrivateKey[], date?: Date, config?: Config): Promise<this>
59
59
  public verifyPrimaryKey(date?: Date, userID?: UserID, config?: Config): Promise<void>; // throws on error
60
60
  public verifyPrimaryUser(publicKeys: PublicKey[], date?: Date, userIDs?: UserID, config?: Config): Promise<{ keyID: KeyID, valid: boolean | null }[]>;
61
- public verifyAllUsers(publicKeys: PublicKey[], date?: Date, config?: Config): Promise<{ userID: string, keyID: KeyID, valid: boolean | null }[]>;
61
+ public verifyAllUsers(publicKeys?: PublicKey[], date?: Date, config?: Config): Promise<{ userID: string, keyID: KeyID, valid: boolean | null }[]>;
62
62
  public isRevoked(signature?: SignaturePacket, key?: AnyKeyPacket, date?: Date, config?: Config): Promise<boolean>;
63
63
  public getRevocationCertificate(date?: Date, config?: Config): Promise<MaybeStream<string> | undefined>;
64
64
  public getEncryptionKey(keyID?: KeyID, date?: Date | null, userID?: UserID, config?: Config): Promise<this | Subkey>;
@@ -98,6 +98,9 @@ export class Subkey {
98
98
  public getCreationTime(): Date;
99
99
  public getAlgorithmInfo(): AlgorithmInfo;
100
100
  public getKeyID(): KeyID;
101
+ public getExpirationTime(date?: Date, config?: Config): Promise<Date | typeof Infinity | null>
102
+ public isRevoked(signature: SignaturePacket, key: AnyKeyPacket, date?: Date, config?: Config): Promise<boolean>;
103
+ public update(subKey: Subkey, date?: Date, config?: Config): Promise<void>
101
104
  }
102
105
 
103
106
  export interface User {
@@ -111,6 +114,7 @@ export interface User {
111
114
  export interface PrimaryUser {
112
115
  index: number;
113
116
  user: User;
117
+ selfCertification: SignaturePacket;
114
118
  }
115
119
 
116
120
  type AlgorithmInfo = {
@@ -163,7 +167,7 @@ export class CleartextMessage {
163
167
  *
164
168
  * @param privateKeys private keys with decrypted secret key data for signing
165
169
  */
166
- sign(privateKeys: PrivateKey[], signature?: Signature, signingKeyIDs?: KeyID[], date?: Date, userIDs?: UserID[], config?: Config): void;
170
+ sign(privateKeys: PrivateKey[], signature?: Signature, signingKeyIDs?: KeyID[], date?: Date, userIDs?: UserID[], notations?: RawNotation[], config?: Config): void;
167
171
 
168
172
  /** Verify signatures of cleartext signed message
169
173
  * @param keys array of keys to verify signatures
@@ -282,7 +286,7 @@ export class Message<T extends MaybeStream<Data>> {
282
286
  /** Sign the message (the literal data packet of the message)
283
287
  @param signingKeys private keys with decrypted secret key data for signing
284
288
  */
285
- public sign(signingKeys: PrivateKey[], signature?: Signature, signingKeyIDs?: KeyID[], date?: Date, userIDs?: UserID[], config?: Config): Promise<Message<T>>;
289
+ public sign(signingKeys: PrivateKey[], signature?: Signature, signingKeyIDs?: KeyID[], date?: Date, userIDs?: UserID[], notations?: RawNotation[], config?: Config): Promise<Message<T>>;
286
290
 
287
291
  /** Unwrap compressed message
288
292
  */
@@ -427,7 +431,7 @@ export class PublicKeyEncryptedSessionKeyPacket extends BasePacket {
427
431
  private encrypt(keyPacket: PublicKeyPacket): void; // throws on error
428
432
  }
429
433
 
430
- export class SymEncryptedSessionKey extends BasePacket {
434
+ export class SymEncryptedSessionKeyPacket extends BasePacket {
431
435
  static readonly tag: enums.packet.symEncryptedSessionKey;
432
436
  private decrypt(passphrase: string): Promise<void>;
433
437
  private encrypt(passphrase: string, config?: Config): Promise<void>;
@@ -518,12 +522,20 @@ export class SignaturePacket extends BasePacket {
518
522
  public issuerFingerprint: null | Uint8Array;
519
523
  public preferredAEADAlgorithms: enums.aead[] | null;
520
524
  public revoked: null | boolean;
525
+ public rawNotations: RawNotation[];
521
526
  public sign(key: AnySecretKeyPacket, data: Uint8Array, date?: Date, detached?: boolean): Promise<void>;
522
527
  public verify(key: AnyKeyPacket, signatureType: enums.signature, data: Uint8Array | object, date?: Date, detached?: boolean, config?: Config): Promise<void>; // throws on error
523
528
  public isExpired(date?: Date): boolean;
524
529
  public getExpirationTime(): Date | typeof Infinity;
525
530
  }
526
531
 
532
+ export interface RawNotation {
533
+ name: string;
534
+ value: Uint8Array;
535
+ humanReadable: boolean;
536
+ critical: boolean;
537
+ }
538
+
527
539
  export class TrustPacket extends BasePacket {
528
540
  static readonly tag: enums.packet.trust;
529
541
  }
@@ -594,6 +606,8 @@ interface EncryptOptions {
594
606
  signingUserIDs?: MaybeArray<UserID>;
595
607
  /** (optional) array of user IDs to encrypt for, e.g. { name:'Robert Receiver', email:'robert@openpgp.org' } */
596
608
  encryptionUserIDs?: MaybeArray<UserID>;
609
+ /** (optional) array of notations to add to the signatures, e.g. { name: 'test@example.org', value: new TextEncoder().encode('test'), humanReadable: true, critical: false } */
610
+ signatureNotations?: MaybeArray<RawNotation>;
597
611
  config?: PartialConfig;
598
612
  }
599
613
 
@@ -627,6 +641,7 @@ interface SignOptions {
627
641
  signingKeyIDs?: MaybeArray<KeyID>;
628
642
  date?: Date;
629
643
  signingUserIDs?: MaybeArray<UserID>;
644
+ signatureNotations?: MaybeArray<RawNotation>;
630
645
  config?: PartialConfig;
631
646
  }
632
647
 
@@ -714,7 +729,7 @@ interface VerifyMessageResult {
714
729
  /**
715
730
  * Armor an OpenPGP binary packet block
716
731
  */
717
- export function armor(messagetype: enums.armor, body: object, partindex: number, parttotal: number, config?: Config): string;
732
+ export function armor(messagetype: enums.armor, body: object, partindex?: number, parttotal?: number, customComment?: string, config?: Config): string;
718
733
 
719
734
  /**
720
735
  * DeArmor an OpenPGP armored message; verify the checksum and return the encoded bytes
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@protontech/openpgp",
3
3
  "description": "OpenPGP.js is a Javascript implementation of the OpenPGP protocol. This is defined in RFC 4880.",
4
- "version": "5.4.0",
4
+ "version": "5.7.0",
5
5
  "license": "LGPL-3.0+",
6
6
  "homepage": "https://openpgpjs.org/",
7
7
  "engines": {
@@ -44,7 +44,8 @@
44
44
  "start": "http-server",
45
45
  "prebrowsertest": "npm run build-test",
46
46
  "browsertest": "npm start -- -o test/unittests.html",
47
- "browserstack": "karma start test/karma.conf.js",
47
+ "test-browser": "karma start test/karma.conf.js",
48
+ "test-browserstack": "karma start test/karma.conf.js --browsers bs_safari_latest,bs_ios_15,bs_safari_13_1",
48
49
  "coverage": "nyc npm test",
49
50
  "lint": "eslint .",
50
51
  "docs": "jsdoc --configure .jsdocrc.js --destination docs --recurse README.md src && printf '%s' 'docs.openpgpjs.org' > docs/CNAME",
@@ -64,26 +65,29 @@
64
65
  "@rollup/plugin-node-resolve": "^7.1.3",
65
66
  "@rollup/plugin-replace": "^2.3.2",
66
67
  "@types/chai": "^4.2.14",
67
- "babel-eslint": "^10.1.0",
68
68
  "benchmark": "^2.1.4",
69
69
  "bn.js": "^4.11.8",
70
70
  "chai": "^4.3.6",
71
71
  "chai-as-promised": "^7.1.1",
72
72
  "email-addresses": "3.1.0",
73
- "eslint": "^4.17.0",
74
- "eslint-config-airbnb": "^16.1.0",
75
- "eslint-config-airbnb-base": "^12.1.0",
76
- "eslint-plugin-chai-friendly": "^0.5.0",
77
- "eslint-plugin-import": "^2.8.0",
73
+ "eslint": "^8.34.0",
74
+ "eslint-config-airbnb": "^19.0.4",
75
+ "eslint-config-airbnb-base": "^15.0.0",
76
+ "eslint-plugin-chai-friendly": "^0.7.2",
77
+ "eslint-plugin-import": "^2.27.5",
78
78
  "esm": "^3.2.25",
79
79
  "hash.js": "^1.1.3",
80
- "http-server": "^0.12.3",
81
- "karma": "^6.3.17",
80
+ "http-server": "^14.1.1",
81
+ "karma": "^6.4.0",
82
82
  "karma-browserstack-launcher": "^1.6.0",
83
+ "karma-chrome-launcher": "^3.1.1",
84
+ "karma-firefox-launcher": "^2.1.2",
83
85
  "karma-mocha": "^2.0.1",
84
86
  "karma-mocha-reporter": "^2.2.5",
87
+ "karma-webkit-launcher": "^2.1.0",
85
88
  "mocha": "^8.4.0",
86
89
  "nyc": "^14.1.1",
90
+ "playwright": "^1.30.0",
87
91
  "rollup": "^2.38.5",
88
92
  "rollup-plugin-terser": "^7.0.2",
89
93
  "sinon": "^4.3.0",