Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beginning ofTypescript migration & S2K Gnu case refactor #1709

Open
wants to merge 13 commits into
base: v6
Choose a base branch
from
Open
13 changes: 12 additions & 1 deletion openpgp.d.ts
Expand Up @@ -314,6 +314,7 @@ interface Config {
showVersion: boolean;
showComment: boolean;
deflateLevel: number;
additionalAllowedPackets:string[];
aeadProtect: boolean;
allowUnauthenticatedMessages: boolean;
allowUnauthenticatedStream: boolean;
Expand Down Expand Up @@ -341,7 +342,7 @@ interface Config {
rejectHashAlgorithms: Set<enums.hash>;
rejectMessageHashAlgorithms: Set<enums.hash>;
rejectPublicKeyAlgorithms: Set<enums.publicKey>;
rejectCurves: Set<enums.curve>;
rejectCurves: Set<string>;
}
export var config: Config;

Expand Down Expand Up @@ -732,6 +733,16 @@ interface VerifyMessageResult<T extends MaybeStream<Data> = MaybeStream<Data>> {
signatures: VerificationResult[];
}

export type S2KType = enums.s2k.argon2 | enums.s2k.gnu | enums.s2k.iterated | enums.s2k.salted | enums.s2k.simple

type S2KNames = 'argon2' | 'gnu' | 'iterated' | 'salted' | 'simple' | string
export interface S2K {
type: S2KNames
read(bytes: Uint8Array):number
write(): Uint8Array
produceKey(passphrase: string, keySize: number): Promise<Uint8Array>
}


/**
* Armor an OpenPGP binary packet block
Expand Down
273 changes: 273 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -100,6 +100,7 @@
"mocha": "^10.2.0",
"playwright": "^1.30.0",
"rollup": "^3.29.4",
"rollup-plugin-typescript2": "^0.36.0",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are there technical reasons to not use the official plugin?
I'd rather go with that one if it's an option, for security reasons.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we went with this one because it prints typeScript diagnostic messages when bundling the code while the official ones does not and I feel this why we wanted to move to typescript in the first place.

"sinon": "^15.1.0",
"ts-node": "^10.9.1",
"typescript": "^4.1.2",
Expand Down