Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@textile/threads-client
Advanced tools
Server-side (remote) event sourced storage layer for Textile's Threads protocol & database
Server-side (remote) event sourced storage layer for Textile's Threads protocol & database
This sub-package is part of js-threads
. See the top-level documentation for details.
npm install @textile/threads-client
create a threads client
import {Client} from '@textile/threads'
const client = new Client()
create a threads client using Textile Hub APIs
Read the full Hub API documentation.
create a store
import {Client, Identity, ThreadID, UserAuth} from '@textile/threads'
async function newToken (client: Client, user: Identity) {
const token = await client.getToken(user)
return token
}
async function createDB (client: Client) {
const thread: ThreadID = await client.newDB()
return thread
}
async function collectionFromObject (client: Client, thread: ThreadID, name: string, obj: any) {
await client.newCollectionFromObject(thread, name, obj)
return
}
async function setup (auth: UserAuth) {
const user = await Client.randomIdentity()
const client = await Client.withUserAuth(auth)
const token = await newToken(client, user)
const thread = await createDB(client)
const astronaut = {name: 'Buzz', missions: 3}
await collectionFromObject(client, thread, 'astronauts', astronaut)
}
get all instances
import {Client, ThreadID} from '@textile/threads'
async function findEntity (client: Client, threadId: ThreadID, collection: string) {
const found = await client.find(threadId, collection, {})
console.debug('found:', found.instancesList.length)
}
add an instance
import {Client, ThreadID} from '@textile/threads'
// matches YourModel and schema
async function create (client: Client, threadId: ThreadID, collection: string) {
const created = await client.create(threadId, collection, [{
some: 'data',
numbers: [1, 2, 3]
}])
}
The following has been tested on Android Only.
js-thread-client
should be compatible with React Native. Here are some helpful pointers if you find issues testing it out.
You can run the daemon released as part of the early preview. To do so,
git clone git@github.com:textileio/go-threads.git
cd go-threads
go run threadsd/main.go
Make daemon available to RN
You can make the daemon API port available to your app with,
adb reverse tcp:6007 tcp:6007
Altenatively, you can ensure this is run whenever you run your app by modifying your package.json
as follows.
{
...
"scripts": {
...
"bind": "adb reverse tcp:6007 tcp:6007",
"android": "npm run bind && npx react-native run-android",
...
},
...
}
Then, run your app with,
npm run android
js-threads-client
relies on Buffer being available. To make Buffer
available in your project, you may need to introduce a shim. Here are the steps.
install rn-nodeify
read more about rn-nodeify.
npm install -G rn-nodeify
run nodeify in the root of your project
rn-nodeify --install buffer --hack
This will create a shim.js
in the root of your project. You need to import this at the top of your apps entry file (e.g. indes.js
).
The top of index.js
would look like,
require('./shim')
...
add nodeify to your postinstall
Ensure that the shim is still configured after any module updates. Inside package.json
add the following line to your scripts
tag,
{
...
"scripts": {
...
"postinstall": "rn-nodeify --install buffer --hack"
}
}
FAQs
**Info**
We found that @textile/threads-client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 7 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
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.