Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
@iota/validators
Advanced tools
Collection of guards and validators, useful in IOTA development.
Collection of guards and validators, useful in IOTA development.
Instal using npm:
npm install @iota/validators
or using yarn:
yarn add @iota/validators
Summary: Validates the checksum of the given address.
Param | Type | Description |
---|---|---|
address | string | Address with a checksum |
This method takes an address with a checksum and validates that the checksum is correct.
To generate a new address with a checksum, use the getNewAddress()
method.
Returns: boolean
- valid - Whether the checksum is valid
Example
let valid = Validator.isAddress('9FNJWLMBECSQDKHQAGDHDPXBMZFMQIMAFAUIQTDECJVGKJBKHLEBVU9TWCTPRJGYORFDSYENIQKBVSYKW9NSLGS9UW');
Param | Type |
---|---|
input | any |
Checks if input is an Int8Array
of trit values; -1, 0, 1
.
Param | Type |
---|---|
trits | Int8Array |
Checks if trits are NULL.
Param | Type | Default |
---|---|---|
trytes | string | |
[length] | string | number | "'1,'" |
Checks if input is correct trytes consisting of [9A-Z]; optionally validate length
Param | Type |
---|---|
trytes | string |
length | number |
Param | Type |
---|---|
trytes | string |
length | number |
Param | Type |
---|---|
hash | string |
Checks if input contains 9
s only.
Param | Type |
---|---|
hash | string |
Checks if input is correct hash (81 trytes) or address with checksum (90 trytes)
Param | Type |
---|---|
address | string |
Checks if input is valid input object. Address can be passed with or without checksum. It does not validate the checksum.
Param | Type |
---|---|
tag | string |
Checks that input is valid tag trytes.
Param | Type |
---|---|
transfer | Transfer |
Checks if input is valid transfer
object.
Param | Type |
---|---|
uri | string |
Checks that a given URI
is valid
Valid Examples:
udp://[2001:db8:a0b:12f0::1]:14265
udp://[2001:db8:a0b:12f0::1]
udp://8.8.8.8:14265
udp://domain.com
udp://domain2.com:14265
Throws:
Error
errorRuns each validator in sequence, and throws on the first occurence of invalid data.
Validators are passed as arguments and executed in given order.
You might want place validate()
in promise chains before operations that require valid inputs,
taking advantage of built-in promise branching.
Example
try {
validate([
value, // Given value
isTrytes, // Validator function
'Invalid trytes' // Error message
])
} catch (err) {
console.log(err.message) // 'Invalid trytes'
}
FAQs
Collection of guards and validators, useful in IOTA development.
The npm package @iota/validators receives a total of 10,880 weekly downloads. As such, @iota/validators popularity was classified as popular.
We found that @iota/validators demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.