@protontech/openpgp 5.5.0 → 5.8.0-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/argon2id.min.mjs +3 -0
  3. package/dist/lightweight/argon2id.min.mjs.map +1 -0
  4. package/dist/lightweight/argon2id.mjs +705 -0
  5. package/dist/lightweight/bn.interface.min.mjs +1 -1
  6. package/dist/lightweight/bn.interface.mjs +1 -1
  7. package/dist/lightweight/bn.min.mjs +2 -2
  8. package/dist/lightweight/bn.min.mjs.map +1 -1
  9. package/dist/lightweight/bn.mjs +1 -1
  10. package/dist/lightweight/elliptic.min.mjs +2 -2
  11. package/dist/lightweight/elliptic.min.mjs.map +1 -1
  12. package/dist/lightweight/elliptic.mjs +1 -1
  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 +6118 -5964
  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 +6733 -5861
  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 +6733 -5861
  28. package/dist/openpgp.js +6761 -5895
  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 +6761 -5895
  34. package/openpgp.d.ts +30 -5
  35. package/package.json +16 -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
  */
@@ -328,7 +332,9 @@ interface Config {
328
332
  v5Keys: boolean;
329
333
  preferredAEADAlgorithm: enums.aead;
330
334
  aeadChunkSizeByte: number;
335
+ s2kType: enums.s2k.iterated | enums.s2k.argon2;
331
336
  s2kIterationCountByte: number;
337
+ s2kArgon2Params: { passes: number, parallelism: number; memoryExponent: number; };
332
338
  minBytesForWebCrypto: number;
333
339
  maxUserIDLength: number;
334
340
  knownNotations: string[];
@@ -427,7 +433,7 @@ export class PublicKeyEncryptedSessionKeyPacket extends BasePacket {
427
433
  private encrypt(keyPacket: PublicKeyPacket): void; // throws on error
428
434
  }
429
435
 
430
- export class SymEncryptedSessionKey extends BasePacket {
436
+ export class SymEncryptedSessionKeyPacket extends BasePacket {
431
437
  static readonly tag: enums.packet.symEncryptedSessionKey;
432
438
  private decrypt(passphrase: string): Promise<void>;
433
439
  private encrypt(passphrase: string, config?: Config): Promise<void>;
@@ -518,12 +524,20 @@ export class SignaturePacket extends BasePacket {
518
524
  public issuerFingerprint: null | Uint8Array;
519
525
  public preferredAEADAlgorithms: enums.aead[] | null;
520
526
  public revoked: null | boolean;
527
+ public rawNotations: RawNotation[];
521
528
  public sign(key: AnySecretKeyPacket, data: Uint8Array, date?: Date, detached?: boolean): Promise<void>;
522
529
  public verify(key: AnyKeyPacket, signatureType: enums.signature, data: Uint8Array | object, date?: Date, detached?: boolean, config?: Config): Promise<void>; // throws on error
523
530
  public isExpired(date?: Date): boolean;
524
531
  public getExpirationTime(): Date | typeof Infinity;
525
532
  }
526
533
 
534
+ export interface RawNotation {
535
+ name: string;
536
+ value: Uint8Array;
537
+ humanReadable: boolean;
538
+ critical: boolean;
539
+ }
540
+
527
541
  export class TrustPacket extends BasePacket {
528
542
  static readonly tag: enums.packet.trust;
529
543
  }
@@ -594,6 +608,8 @@ interface EncryptOptions {
594
608
  signingUserIDs?: MaybeArray<UserID>;
595
609
  /** (optional) array of user IDs to encrypt for, e.g. { name:'Robert Receiver', email:'robert@openpgp.org' } */
596
610
  encryptionUserIDs?: MaybeArray<UserID>;
611
+ /** (optional) array of notations to add to the signatures, e.g. { name: 'test@example.org', value: new TextEncoder().encode('test'), humanReadable: true, critical: false } */
612
+ signatureNotations?: MaybeArray<RawNotation>;
597
613
  config?: PartialConfig;
598
614
  }
599
615
 
@@ -627,6 +643,7 @@ interface SignOptions {
627
643
  signingKeyIDs?: MaybeArray<KeyID>;
628
644
  date?: Date;
629
645
  signingUserIDs?: MaybeArray<UserID>;
646
+ signatureNotations?: MaybeArray<RawNotation>;
630
647
  config?: PartialConfig;
631
648
  }
632
649
 
@@ -714,7 +731,7 @@ interface VerifyMessageResult {
714
731
  /**
715
732
  * Armor an OpenPGP binary packet block
716
733
  */
717
- export function armor(messagetype: enums.armor, body: object, partindex: number, parttotal: number, config?: Config): string;
734
+ export function armor(messagetype: enums.armor, body: object, partindex?: number, parttotal?: number, customComment?: string, config?: Config): string;
718
735
 
719
736
  /**
720
737
  * DeArmor an OpenPGP armored message; verify the checksum and return the encoded bytes
@@ -887,4 +904,12 @@ export namespace enums {
887
904
  utf8 = 117,
888
905
  mime = 109
889
906
  }
907
+
908
+ enum s2k {
909
+ simple = 0,
910
+ salted = 1,
911
+ iterated = 3,
912
+ argon2 = 4,
913
+ gnu = 101
914
+ }
890
915
  }
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.5.0",
4
+ "version": "5.8.0-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",
@@ -63,27 +64,32 @@
63
64
  "@rollup/plugin-commonjs": "^11.1.0",
64
65
  "@rollup/plugin-node-resolve": "^7.1.3",
65
66
  "@rollup/plugin-replace": "^2.3.2",
67
+ "@rollup/plugin-wasm": "^6.1.2",
66
68
  "@types/chai": "^4.2.14",
67
- "babel-eslint": "^10.1.0",
69
+ "argon2id": "^1.0.0",
68
70
  "benchmark": "^2.1.4",
69
71
  "bn.js": "^4.11.8",
70
72
  "chai": "^4.3.6",
71
73
  "chai-as-promised": "^7.1.1",
72
74
  "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",
75
+ "eslint": "^8.34.0",
76
+ "eslint-config-airbnb": "^19.0.4",
77
+ "eslint-config-airbnb-base": "^15.0.0",
78
+ "eslint-plugin-chai-friendly": "^0.7.2",
79
+ "eslint-plugin-import": "^2.27.5",
78
80
  "esm": "^3.2.25",
79
81
  "hash.js": "^1.1.3",
80
- "http-server": "^0.12.3",
81
- "karma": "^6.3.17",
82
+ "http-server": "^14.1.1",
83
+ "karma": "^6.4.0",
82
84
  "karma-browserstack-launcher": "^1.6.0",
85
+ "karma-chrome-launcher": "^3.1.1",
86
+ "karma-firefox-launcher": "^2.1.2",
83
87
  "karma-mocha": "^2.0.1",
84
88
  "karma-mocha-reporter": "^2.2.5",
89
+ "karma-webkit-launcher": "^2.1.0",
85
90
  "mocha": "^8.4.0",
86
91
  "nyc": "^14.1.1",
92
+ "playwright": "^1.30.0",
87
93
  "rollup": "^2.38.5",
88
94
  "rollup-plugin-terser": "^7.0.2",
89
95
  "sinon": "^4.3.0",