
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Keycove is an easy-to-use API authentication library. Create, verify, and securely store API keys.
The key features are:
Generally, encryption / hashing algorithms work with bytes as inputs and outputs to these algorithms. Keycove takes care of converting values to / from bytes so you only need to work with strings.
generate_token(num_bytes: int = 32) -> str
This function generates a random string that can be uses as an API key.
The num_bytes parameter specifies the number of random bytes to generate before the encoding to a string using Base64 encoding.
Because of this encoding, the length of the resulting string is approximately 1.3x larger than the num_bytes specified.
num_bytes (int): The number of random bytes to generate before encoding. Default is 32.
str: A random string.
from keycove import generate_token
generate_token(num_bytes=16)
>>> '4LYAecdQvqH_W2OABLsZzV-6-zAAkt23'
generate_secret_key() -> str
This function generates a secret key that is compatible with the encrypt and decrypt functions.
The generated secret key is suitable for the Fernet symmetric encryption algorithm, which this library uses for encryption.
str: A secret key that can be used with the encrypt and decrypt functions.
from keycove import generate_secret_key
generate_secret_key()
>>> 'gAAAAABgTD0yR3O4hV7Kb7PZ6N4iZA3uJNeL3_ZI2QmGJHbLZUj4Cy5B2Pgh4lX3JNLUZ4Q8OvJZ8OZyXUYd8l4XQJZIV64nJA=='
encrypt(value_to_encrypt: str, secret_key: str) -> str
This function encrypts a given string using a provided secret key.
Use keycove.generate_secret_key() to generate this secret key.
This secret key is suitable for the Fernet symmetric encryption algorithm, which is used for encryption.
value_to_encrypt (str): The string to encrypt.
secret_key (str): The secret key to use for encryption.
Use keycove.generate_secret_key() to generate this secret key.
str: The encrypted string.
TypeError: If value_to_encrypt is not a string.
TypeError: If secret_key is not a string.
ValueError: If secret_key is incorrect.
from keycove import encrypt, generate_secret_key
secret_key = generate_secret_key()
encrypt(value_to_encrypt="Hello, World!", secret_key=secret_key)
>>> 'gAAAAABgTD0yR3O4hV7Kb7PZ6N4iZA3uJNeL3_ZI2QmGJHbLZUj4Cy5B2Pgh4lX3JNLUZ4Q8OvJZ8OZyXUYd8l4XQJZIV64nJA=='
decrypt(encrypted_value: str, secret_key: str) -> str
This function decrypts a given encrypted string using a provided secret key.
The same secret key that was used to encrypt the encrypted_value should be used to decrypt it.
encrypted_value (str): The encrypted string to decrypt.
secret_key (str): The secret key to use for decryption.
str: The decrypted string.
TypeError: If encrypted_value is not a string.
TypeError: If secret_key is not a string.
ValueError: If secret_key is incorrect.
from keycove import decrypt, encrypt, generate_secret_key
secret_key = generate_secret_key()
encrypted_value = encrypt(value_to_encrypt="Hello, World!", secret_key=secret_key)
decrypt(encrypted_value=encrypted_value, secret_key=secret_key)
>>> 'Hello, World!'
hash(value_to_hash: str) -> str
This function hashes a given string using the SHA256 algorithm.
value_to_hash (str): The string to hash.
str: The hashed string.
from keycove import hash
hash(value_to_hash="Hello, World!")
>>> '2ef7bde608ce5404e97d5f042f95f89f1c232871'
FAQs
An API authentication library. Create, verify, and securely store API keys.
We found that keycove demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.