Security News
RubyGems.org Adds New Maintainer Role
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
@solana/keys
Advanced tools
This package contains utilities for validating, generating, and manipulating addresses and key material. It can be used standalone, but it is also exported as part of the Solana JavaScript SDK @solana/web3.js@experimental
.
Base58EncodedAddress
This type represents a string that validates as a Solana address or public key. Functions that require well-formed addresses should specify their inputs in terms of this type.
Whenever you need to validate an arbitrary string as a base58-encoded address, use the assertIsBase58EncodedAddress()
function in this package.
assertIsBase58EncodedAddress()
Client applications primarily deal with addresses and public keys in the form of base58-encoded strings. Addresses and public keys returned from the RPC API conform to the type Base58EncodedAddress
. You can use a value of that type wherever a base58-encoded address or key is expected.
From time to time you might acquire a string, that you expect to validate as an address, from an untrusted network API or user input. To assert that such an arbitrary string is a base58-encoded address, use the assertIsBase58EncodedAddress
function.
import { assertIsBase58EncodedAddress } from '@solana/web3.js`;
// Imagine a function that fetches an account's balance when a user submits a form.
function handleSubmit() {
// We know only that what the user typed conforms to the `string` type.
const address: string = accountAddressInput.value;
try {
// If this type assertion function doesn't throw, then
// Typescript will upcast `address` to `Base58EncodedAddress`.
assertIsBase58EncodedAddress(address);
// At this point, `address` is a `Base58EncodedAddress` that can be used with the RPC.
const balanceInLamports = await rpc.getBalance(address);
} catch (e) {
// `address` turned out not to be a base58-encoded address
}
}
FAQs
Helpers for generating and transforming key material
The npm package @solana/keys receives a total of 2,521 weekly downloads. As such, @solana/keys popularity was classified as popular.
We found that @solana/keys demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers 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.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.
Security News
Research
Socket's threat research team has detected five malicious npm packages targeting Roblox developers, deploying malware to steal credentials and personal data.