Security News
The Dark Side of Open Source
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
@mayahq/maya-db
Advanced tools
A small, encrypted simple document database meant for client-side use.
Readme
Encrypted, thread-safe local database for Electron apps
localStorage
), cloud (storing data in S3), etc. All you need to do is write a single adapter class.Currently, the database only supports desktop environments. It can be extended to other platforms via custom adapters (see below in docs).
Quick Example: setting data and querying it
const { localDb } = require('@mayahq/maya-db')
// The database will be stored inside dbroot
const dbroot = path.resolve(process.env.HOME, '.maya/localdb')
// Initialising the database
const db = localDb({
encryptionKey: '[64-bit encryption key]',
root: dbroot
})
const personalInfo = {
name: 'Dushyant',
education: {
college: 'BITS Pilani',
graduation: 2022,
degree: {
type: 'single',
branch: 'CS'
}
},
address: 'Etihad Stadium, UAE'
}
// Creating a new block (file) and storing personalInfo in it
db.createNewBlock('dushyant')
db.block('dushyant').lockAndSet(personalInfo)
// Querying the information stored in a GraphQL-like fashion
const query = {
name: null,
lastName: 'Jain',
education: {
college: null,
degreeType: 'single'
}
}
db.block('dushyant').lockAndGet(query)
.then((result) => {
console.log(result)
})
// Result is {
// name: 'Dushyant',
// lastName: 'Jain',
// education: {
// college: 'BITS Pilani',
// degreeType: 'single'
// }
// }
There are two main entities for modelling storage - Block
and Collection
. A Block
is like a document in MongoDB, while a Collection
is just a collection of Block
s. Both blocks and collections are identified by unique filesystem-like "paths".
Though collections have no purpose other than to organise blocks, blocks do have a few features of note -
Although blocks and collections are stored as files and directories in desktop environments, accessing them directly will break things. Always access them via the maya-db
library.
Visit this page for full documentation
FAQs
A small, encrypted simple document database meant for client-side use.
The npm package @mayahq/maya-db receives a total of 1 weekly downloads. As such, @mayahq/maya-db popularity was classified as not popular.
We found that @mayahq/maya-db demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 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
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.
Security News
OpenJS is warning of social engineering takeovers targeting open source projects after receiving a credible attempt on the foundation.