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

Use consistent name casing #1268

Merged
merged 18 commits into from Mar 25, 2021
Merged

Use consistent name casing #1268

merged 18 commits into from Mar 25, 2021

Conversation

larabr
Copy link
Collaborator

@larabr larabr commented Mar 19, 2021

Fix #955 by settling on consistent casing:

  • use PascalCase for classes, with uppercase acronyms
  • use camelCase for function and variables. First word/acronym is always lowercase, otherwise acronyms are uppercase

Public API breaking changes:

  • Top-level functions (openpgp.encrypt({ ...options }) etc):

    • rename options.signingKeyIds -> .signingKeyIDs
    • rename options.encryptionKeyIds -> .encryptionKeyIDs
    • rename options.userIds -> .userIDs
    • rename options.fromUserIds -> .fromUserIDs
    • rename options.toUserIds -> .toUserIDs
  • openpgp.config:

    • rename config.preferredAeadAlgorithm -> config.preferredAEADAlgorithm
    • rename config.minRsaBits -> config.minRSABits
    • rename config.maxUseridLength -> config.maxUserIDLength
  • openpgp.enums:

    • rename enums.primaryUserId -> .primaryUserID
    • rename enums.signersUserId -> .signersUserID
    • rename enums.userIdInvalid -> .userIDInvalid
    • rename enums.packet.AEADEncryptedData -> .aeadEncryptedData
    • rename enums.aead.experimentalGcm -> .experimentalGCM
    • rename enums.signatureSubpacket.policyUri -> .policyURI
  • Key / Subkey classes:

    • rename *Key.getKeyIds() -> .getKeyIDs
    • rename *Key.getKeyId() -> .getKeyID
    • rename Key.getUserIds() -> .getUserIDs
  • Packet classes:

    • the tag property is now static
    • rename OnePassSignaturePacket.issuerKeyId -> .issuerKeyID
    • rename *KeyPacket.keyid -> .keyID
    • rename *KeyPacket.getKeyId() -> .getKeyID
    • rename SecretKeyPacket.s2k_usage -> .s2kUsage
    • rename PublicKeyEncryptedSessionKeyPacket.publicKeyID -> .publicKeyID
    • rename SignaturePacket.issuerKeyId -> .issuerKeyID
    • rename SignaturePacket.signersUserId -> .signersUserID
    • rename UserIDPacket.userId -> .userID
  • KeyID class:

    • rename KeyID.fromId() -> .fromID()
  • S2K class:

    • rename S2K.get_count() -> .getCount()
    • rename S2K.produce_key() -> .produceKey()

TODO:

@larabr larabr marked this pull request as ready for review March 25, 2021 15:12
@larabr larabr requested review from twiss and removed request for twiss March 25, 2021 15:12
@twiss twiss merged commit 6cff19c into openpgpjs:master Mar 25, 2021
twiss pushed a commit that referenced this pull request Apr 29, 2021
…types (#1289)

Changes:
- Implementation:
  - Remove `PacketList.prototype.concat` and `push`
    (we solely rely on `Array.push` instead)
  - Fix #907 by
    correctly handling result of `filterByTag`
  - Implement `write()` method for `Trust` and `Marker` packets,
    to make them compatible with the `BasePacket` interface
- Types:
  - Simplify and updated `PacketList` type definitions
  - Fix types for `Packet.tag`, which is `static` since
    #1268
  - Prevent passing SubkeyPackets where KeyPackets are expected,
    and vice versa
@larabr larabr deleted the uniform-naming branch June 10, 2021 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use camelCase for the object and functions, and PascalCase for constructors.
2 participants