-
Notifications
You must be signed in to change notification settings - Fork 25k
Align Flow lib defs for Node.js crypto with v24 #55009
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
Closed
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Summary: This is an AI-assisted change to align the Flow definitions for the `crypto` module with the Node.js docs as at v24. **New v24 APIs:** 1. **`hash(algorithm, data, [outputEncoding])`** - One-shot hashing convenience function - Added in Node.js v21.7.0, v20.12.0 - https://nodejs.org/api/crypto.html#cryptohashalgorithm-data-outputencoding 2. **X509Certificate new properties** (added in v22.10.0): - `validFromDate` - Certificate valid-from as Date object - `validToDate` - Certificate valid-to as Date object - https://nodejs.org/api/crypto.html#x509certificatevalidfromdate - https://nodejs.org/api/crypto.html#x509certificatevalidtodate **New Classes:** 3. **KeyObject** - Represents cryptographic keys (symmetric/asymmetric) - Properties: `type`, `asymmetricKeyType`, `asymmetricKeySize`, `symmetricKeySize` - Methods: `export()`, `equals()` - https://nodejs.org/api/crypto.html#class-keyobject 4. **X509Certificate** - X.509 certificate handling - Properties: `ca`, `fingerprint*`, `issuer`, `subject`, `publicKey`, `raw`, etc. - Methods: `checkEmail()`, `checkHost()`, `checkIP()`, `verify()`, etc. - https://nodejs.org/api/crypto.html#class-x509certificate 5. **Certificate** - Legacy SPKAC (Signed Public Key and Challenge) support - Static methods: `exportChallenge()`, `exportPublicKey()`, `verifySpkac()` - https://nodejs.org/api/crypto.html#class-certificate **Key Management Functions:** 6. **Key Creation:** - `createSecretKey(key, [encoding])` - Create symmetric KeyObject - `createPublicKey(key)` - Create public KeyObject - `createPrivateKey(key)` - Create private KeyObject - https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding - https://nodejs.org/api/crypto.html#cryptocreatepublickeykey - https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey 7. **Key Generation:** - `generateKeyPair()` / `generateKeyPairSync()` - Generate asymmetric key pairs - `generateKey()` / `generateKeySync()` - Generate symmetric keys - Supports: RSA, RSA-PSS, DSA, EC, Ed25519, Ed448, X25519, X448 - https://nodejs.org/api/crypto.html#cryptogeneratekeypairtype-options-callback - https://nodejs.org/api/crypto.html#cryptogeneratekeytype-options-callback 8. **Primality Testing:** - `checkPrime()` / `checkPrimeSync()` - Test if candidate is prime - https://nodejs.org/api/crypto.html#cryptocheckprimecandidate-options-callback **Other Improvements:** 9. **Hash.copy()** - Create deep copy of Hash object - https://nodejs.org/api/crypto.html#hashcopyoptions 10. **webcrypto property** - References web Crypto type - Web Crypto API types are NOT redefined (use existing definitions where available) - https://nodejs.org/api/webcrypto.html **Type Safety:** - All options objects use modern `Readonly<{...}>` syntax for inputs - Exact-by-default types throughout - Proper overloading for functions with optional parameters **References:** - Node.js crypto module docs: https://nodejs.org/api/crypto.html - Node.js Web Crypto API: https://nodejs.org/api/webcrypto.html Changelog: [Internal] --- > Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/) [Confucius Session](https://www.internalfb.com/confucius?host=devvm45708.cln0.facebook.com&port=8086&tab=Chat&session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&tab=Trace) Reviewed By: vzaidman Differential Revision: D89934145
meta-codesync bot
pushed a commit
to facebook/metro
that referenced
this pull request
Jan 2, 2026
Summary: X-link: facebook/react-native#55009 This is an AI-assisted change to align the Flow definitions for the `crypto` module with the Node.js docs as at v24. **New v24 APIs:** 1. **`hash(algorithm, data, [outputEncoding])`** - One-shot hashing convenience function - Added in Node.js v21.7.0, v20.12.0 - https://nodejs.org/api/crypto.html#cryptohashalgorithm-data-outputencoding 2. **X509Certificate new properties** (added in v22.10.0): - `validFromDate` - Certificate valid-from as Date object - `validToDate` - Certificate valid-to as Date object - https://nodejs.org/api/crypto.html#x509certificatevalidfromdate - https://nodejs.org/api/crypto.html#x509certificatevalidtodate **New Classes:** 3. **KeyObject** - Represents cryptographic keys (symmetric/asymmetric) - Properties: `type`, `asymmetricKeyType`, `asymmetricKeySize`, `symmetricKeySize` - Methods: `export()`, `equals()` - https://nodejs.org/api/crypto.html#class-keyobject 4. **X509Certificate** - X.509 certificate handling - Properties: `ca`, `fingerprint*`, `issuer`, `subject`, `publicKey`, `raw`, etc. - Methods: `checkEmail()`, `checkHost()`, `checkIP()`, `verify()`, etc. - https://nodejs.org/api/crypto.html#class-x509certificate 5. **Certificate** - Legacy SPKAC (Signed Public Key and Challenge) support - Static methods: `exportChallenge()`, `exportPublicKey()`, `verifySpkac()` - https://nodejs.org/api/crypto.html#class-certificate **Key Management Functions:** 6. **Key Creation:** - `createSecretKey(key, [encoding])` - Create symmetric KeyObject - `createPublicKey(key)` - Create public KeyObject - `createPrivateKey(key)` - Create private KeyObject - https://nodejs.org/api/crypto.html#cryptocreatesecretkeykey-encoding - https://nodejs.org/api/crypto.html#cryptocreatepublickeykey - https://nodejs.org/api/crypto.html#cryptocreateprivatekeykey 7. **Key Generation:** - `generateKeyPair()` / `generateKeyPairSync()` - Generate asymmetric key pairs - `generateKey()` / `generateKeySync()` - Generate symmetric keys - Supports: RSA, RSA-PSS, DSA, EC, Ed25519, Ed448, X25519, X448 - https://nodejs.org/api/crypto.html#cryptogeneratekeypairtype-options-callback - https://nodejs.org/api/crypto.html#cryptogeneratekeytype-options-callback 8. **Primality Testing:** - `checkPrime()` / `checkPrimeSync()` - Test if candidate is prime - https://nodejs.org/api/crypto.html#cryptocheckprimecandidate-options-callback **Other Improvements:** 9. **Hash.copy()** - Create deep copy of Hash object - https://nodejs.org/api/crypto.html#hashcopyoptions 10. **webcrypto property** - References web Crypto type - Web Crypto API types are NOT redefined (use existing definitions where available) - https://nodejs.org/api/webcrypto.html **Type Safety:** - All options objects use modern `Readonly<{...}>` syntax for inputs - Exact-by-default types throughout - Proper overloading for functions with optional parameters **References:** - Node.js crypto module docs: https://nodejs.org/api/crypto.html - Node.js Web Crypto API: https://nodejs.org/api/webcrypto.html Changelog: [Internal] --- > Generated by [Confucius Code Assist (CCA)](https://www.internalfb.com/wiki/Confucius/Analect/Shared_Analects/Confucius_Code_Assist_(CCA)/) [Confucius Session](https://www.internalfb.com/confucius?host=devvm45708.cln0.facebook.com&port=8086&tab=Chat&session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&entry_name=Code+Assist), [Trace](https://www.internalfb.com/confucius?session_id=1a3aa26e-e5a9-11f0-8d47-71a4a90f0494&tab=Trace) Reviewed By: vzaidman Differential Revision: D89934145 fbshipit-source-id: 021fed306823469bad5be9e7bbab73da2477c42f
|
This pull request has been merged in 83b21bb. |
Collaborator
|
This pull request was successfully merged by @robhogan in 83b21bb When will my fix make it into a release? | How to file a pick request? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CLA Signed
This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
fb-exported
Merged
This PR has been merged.
meta-exported
p: Facebook
Partner: Facebook
Partner
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary:
This is an AI-assisted change to align the Flow definitions for the
cryptomodule with the Node.js docs as at v24.New v24 APIs:
hash(algorithm, data, [outputEncoding])- One-shot hashing convenience functionX509Certificate new properties (added in v22.10.0):
validFromDate- Certificate valid-from as Date objectvalidToDate- Certificate valid-to as Date objectNew Classes:
KeyObject - Represents cryptographic keys (symmetric/asymmetric)
type,asymmetricKeyType,asymmetricKeySize,symmetricKeySizeexport(),equals()X509Certificate - X.509 certificate handling
ca,fingerprint*,issuer,subject,publicKey,raw, etc.checkEmail(),checkHost(),checkIP(),verify(), etc.Certificate - Legacy SPKAC (Signed Public Key and Challenge) support
exportChallenge(),exportPublicKey(),verifySpkac()Key Management Functions:
Key Creation:
createSecretKey(key, [encoding])- Create symmetric KeyObjectcreatePublicKey(key)- Create public KeyObjectcreatePrivateKey(key)- Create private KeyObjectKey Generation:
generateKeyPair()/generateKeyPairSync()- Generate asymmetric key pairsgenerateKey()/generateKeySync()- Generate symmetric keysPrimality Testing:
checkPrime()/checkPrimeSync()- Test if candidate is primeOther Improvements:
Hash.copy() - Create deep copy of Hash object
webcrypto property - References web Crypto type
Type Safety:
Readonly<{...}>syntax for inputsReferences:
Changelog: [Internal]
Reviewed By: vzaidman
Differential Revision: D89934145