
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@datasworn/core
Advanced tools
Typings and JSON schema common to Datasworn. This is a pre-release package, provided for developer feedback. It will almost certainly receive breaking changes.
Traversal utilities, JSON schema, and Typescript declarations common to Datasworn packages.
This is a pre-release package, provided for developer feedback. It will almost certainly receive breaking changes even on minor versions.
Deserialize (parse) the JSON files from one or more data packages (e.g. @datasworn/ironsworn-classic
).
fs
synchronouslyimport { readFileSync } from 'fs'
import type * as Datasworn from '@datasworn/core'
const rulesPackages: Datasworn.RulesPackage[] = [
readFileSync('node_modules/@datasworn/starforged/json/starforged.json'),
readFileSync('node_modules/@datasworn/ironsworn-classic/json/classic.json')
].map(JSON.parse)
fs/promises
asynchronouslyimport { readFile } from 'fs/promises'
import type * as Datasworn from '@datasworn/core'
const rulesPackages: Datasworn.RulesPackage[] = (await Promise.all([
readFile('node_modules/@datasworn/starforged/json/starforged.json')
readFile('node_modules/@datasworn/ironsworn-classic/json/classic.json')
])).map(JSON.parse)
import starforged from '@datasworn/starforged/json/starforged.json' with { type: 'json' }
import classic from '@datasworn/ironsworn-classic/json/classic.json' with { type: 'json' }
const rulesPackages = [starforged, classic] as Datasworn.RulesPackage[]
Once you've got all the rules packages you want properly deserialized, you'll need to create the "tree" object that contains every RulesPackage
object.
import { DataswornTree, IdParser } from '@datasworn/core'
const datasworn = new DataswornTree(...rulesPackages)
// Configure the ID parser to use the new tree by default. This is optional, but without it you'll have to specify the tree object every time
IdParser.datasworn = datasworn
The simplest way is to use the IdParser.get
and IdParser.getMatches
static methods. They will attempt to infer the type from the ID.
const oracleRollable = IdParser.get('starforged/oracles/core/action')
Note that for type safety, IdParser.get
will throw an error if you call it on a wildcard ID string. This is because wildcard IDs may return multiple results. Use IdParser.getMatches
for wildcard IDs.
// `IdParser.getMatches` returns an array of matched items, instead.
const allOracleRollables = IdParser.getMatches('*/oracles/**/*') // returns *all* OracleRollable objects!
For more advanced manipulations, you can create and interact with parser instances.
// create an ID parser instance from a string ID
const oracleRollableId = IdParser.from('starforged/oracles/core/action') // returns an instance of the RecursiveCollectableId subclass
// wildcard IDs work too -- they use the same subclasses as regular IDs. This wildcard would match *any* OracleRollable object.
const anyOracleRollableId = IdParser.from('*/oracles/**/*')
// Use the instance's `get` method to look up the appropriate item
const oracleRollable = oracleRollableIdParser.get()
// create an ID parser for the *parent* ID
const oracleRollableParentId = oracleRollableIdParser.getParentCollectionId() // returns an instance of the RecursiveCollectionId subclass
// Create a collectable child ID for the parent -- in other words, the sibling ID of `oracleRollableId`
const oracleRollableId = oracleCollectionIdParser.createChildCollectableId('theme')
console.log(oracleRollableIdParser.toString()) // 'starforged/oracles/core/theme'
It's also possible to use the parser subclass constructors directly.
import { RecursiveCollectionId } from '@datasworn/core'
// Create an ID parser instance from string parameters
const oracleRollableId = new RecursiveCollectionId('custom', 'oracles', ['core'], 'action')
// Create an ID parser instance with wildcard elements
const anyOracleRollableId = new RecursiveCollectionId('*', 'oracles', ['**'], '*')
FAQs
Typings and JSON schema common to Datasworn. This is a pre-release package, provided for developer feedback. It will almost certainly receive breaking changes.
The npm package @datasworn/core receives a total of 23 weekly downloads. As such, @datasworn/core popularity was classified as not popular.
We found that @datasworn/core demonstrated a not healthy version release cadence and project activity because the last version was released 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.