Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@synonymdev/slashtags-contacts

Package Overview
Dependencies
Maintainers
7
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@synonymdev/slashtags-contacts

Slashtags contacts management.

latest
npmnpm
Version
1.0.0-alpha.0
Version published
Maintainers
7
Created
Source

slashtags-contacts

Slashtags contacts management.

Install

npm install @synonymdev/slashtags-contacts

Usage

Initialize

const coreData = new SlashtagsCoreData()

const contacts = new SlashtagsContacts(coreData)

await contacts.ready() // await loading contacts from disk

await contacts.set('slash:kencdz6km9xde46iph165d6isidssy9uate7b6srfaur8stm5br7', { name: "Foo" }) // set new contact

const contact = contacts.get('slash:kencdz6km9xde46iph165d6isidssy9uate7b6srfaur8stm5br7')
// { name: "Foo" }


for (let [id, contact] contacts.list() {
  // id: 'kencdz6km9xde46iph165d6isidssy9uate7b6srfaur8stm5br7'
  // ccontact: { name: "Foo" }
}

API

const contacts = new SlashtagsContacts(coreData)

Create a new contacts instance from a CoreData instance

await contacts.ready()

Await opening the contacts list from storage.

await contacts.set(url, contact)

Await setting the value of contact and storing it as persistent encrypted data. contact has to be in the shape:

{
  name: string, // Local (pet)name of the contact.
}

const contact = contacts.get(url)

Return contact value from contact's Slashtags url.

for (let [id, contact] contacts.list() {}

Return an iterator of entries in the internal Map. id is z-base32 endoced key of the contact. Internal map will be populated after contacts.ready()

contact.close()

Close underlying coreData instance and all subscriptions.

FAQs

Package last updated on 12 Jun 2023

Did you know?

Socket

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.

Install

Related posts