@questnetwork/quest-os-js
v0.9.4
Published
![Completion](https://img.shields.io/badge/completion-14%25-orange) ![Help Wanted](https://img.shields.io/badge/%20-help--wanted-%23159818) ![Version 0.9.4](https://img.shields.io/badge/version-v0.9.4-green) ![Version 0.9.5](https://img.shields.io/badge/v
Downloads
5
Readme
Quest OS JS
Lead Maintainer
Description
Unified API for the QuestNetwork dStack. Use with our example app: qDesk.
Main strategy is to create a Quest Network / IPFS / Ethereum interface that even kids can easily understand.
Quest OS offers encrypted channels, persistent storage, peer management, timelines, posts and more. It it used to load add-on modules, like quest-coral-js to use IPFS DAGs, or quest-dolphin-js to use IPFS GossipSub.
Security
Quest OS uses 4096 Bit RSA-OAEP encryption, 256 Bit AES-CBC encryption and NIST P-521 EC signatures.
Installation & Usage
npm install @questnetwork/[email protected]
OR
git clone https://github.com/QuestNetwork/quest-os-js && cd quest-os-js && git checkout 0.9.3 && cd ..
API
async boot(config)
Boots the operating system. The GitHub branches master/0.9.2/0.9.3+ boot with:
JavaScript/NodeJS
import { qOS } from '@questnetwork/quest-os-js'
// configure with a bootstrap swarm peer, for testing you can use:
let config = {
ipfs: {
Swarm: [<swarm star peer ip>,<swarm star peer ip>],
API: '',
Gateway: ''
},
version: <version>
dev: <true/false>
};
// boot the operating system
qOS.boot().then( () => {
//the operating system is online, build the future
})
TypeScript/Angular Service
import { Injectable } from '@angular/core';
import { qOS } from '@questnetwork/quest-os-js';
import * as swarmJson from '../swarm.json';
import packageJson from '../../../package.json';
const version = packageJson.version;
@Injectable({
providedIn: 'root'
})
export class QuestOSService {
public os;
ready = false;
config;
constructor() {
this.config = {
ipfs: {
Swarm: swarmJson['ipfs']['Swarm'],
API: '',
Gateway: ''
},
version: version,
dev: swarmJson['dev']
};
this.os = qOS;
}
async boot(){
try{
await this.os.boot(this.config);
this.ready = true;
}
catch(e){
throw(e);
}
}
}
isReady()
Returns true once boot is complete, otherwise returns false.
if(<os>.isReady()){
console.log("Ready To Sign In");
};
onReady()
Returns a Subject that pushes next when boot is complete
if(<os>.onReady().subsribe( () => {
console.log("Ready To Sign In");
});
reboot()
Reboots the entire system
<os>.reboot();
utilities.engine.detect()
Returns a string 'node', 'electron' or 'browser'
if(<os>.utilities.engine.detect() == 'node'){
console.log("Hello Universe");
};
enableSaveLock()
Locks the system from saving any changes
<os>.enableSaveLock();
disableSaveLock()
Unlocks the system from saving changes and saves changes normally
<os>.disableSaveLock();
setStorageLocation(location)
Sets the storage location for the app. Normally Quest OS does this automatically and you do not need to call this function.
Possible locations are: "Download"
,"LocalStorage"
or "ConfigFile"
<os>.setStorageLocation("LocalStorage");
getStorageLocation(location)
Returns a string with the current storage location
<os>.getStorageLocation();
signIn(config = {})
Activates Accounts. Empty config creates a new account
<os>.signIn({});
signOut()
Deactivates Accounts And Restarts The Interface On The Web, Closes The Current Window In Electron
<os>.signOut();
onSignIn()
Returns a subscribable Subject that fires when the account is signed in.
<os>.onSignIn().subscribe( () => {
console.log("Hello Universe");
});
isSignedIn()
Returns a boolean true or false
if(<os>.isSignedIn()){
console.log("Hello Universe");
};
channel
async channel.create(dirtyChannelName, parentFolderId = "")
Returns the clean channel name
let claenChannelName = await <os>.channel.create('propaganda');
channel.remove(cleanChannelName)
Removes a channel
<os>.channel.remove('propaganda----1234');
channel.listen(cleanChannelName)
Returns a Subject that forwards non-system channel messages.
<os>.channel.listen('propaganda----1234').subscribe( msg ){
console.log(msg);
}
async channel.publish(cleanChannelName, message, type = 'CHANNEL_MESSAGE')
Returns a Subject that forwards non-system channel messages.
await <os>.channel.publish('propaganda----1234',"Hello Universe");
channel.challenge
channel.challenge.enable(cleanChannelName)
Opens the channel to everyone who can solve the Captcha provided by Quest Image Captcha JS
<os>.channel.challenge.enable('propaganda----1234');
channel.challenge.disable(cleanChannelName)
Closes the channel to invite only participation
<os>.channel.challenge.disable('propaganda----1234');
channel.challenge.isEnabled(cleanChannelName)
if(<os>.isEnabled()){
console.log("Hello Universe");
};
channel.invite
channel.invite.create(cleanChannelName,newInviteCodeMax, exportFolders = false)
Creates a new channel invite, specify max uses of this invite code and whether or not to include your folder structure.
<os>.channel.invite.create('propaganda----1234',5,true);
channel.invite.remove(cleanChannelName,link)
Removes a channel invite
<os>.channel.invite.remove('propaganda----1234',"5448495320495320414e2045585452454d454c59204c4f4e4720414e4420494e56414c494420494e5649544520434f4445");
channel.invite.get(channel)
Gets all invites for a channel
let invites = <os>.channel.invite.get('propaganda----1234');
channel.invite.get(channel)
Gets all invites for a channel
let invites = <os>.channel.invite.get('propaganda----1234');
Unfortunately nobody is working on a detailed API documentation yet, until then check out the source in qDesk Messages 0.9.3+ to see how to use the OS.
We recommend to use our quest-cli to test and build the package. It allows you to bootstrap your Quest Network apps with the same peers and settings.
Pro Tip: Put a file in your /bin
that runs the quest-cli like so node /path/to/quest-cli/index.js
from any folder on your system. It's much nicer!
Features
0.9.2
- Encrypted P2P Channels
- API for high level IPFS functionality
- Saves Config
- Quest Ocean JS
- Quest Bee JS
0.9.3
- Quest Social JS
- Documentation Extended
- Easier Access
- Offer "LocalStorage" As A Storage Container On The Web To Stay Signed In
0.9.4 Change Peer Configuration in browser, Electron and on NodeJS
Roadmap
0.9.4
- Democratically block or mute peers
- Faux requests. Send request in channel, wait for response, deliver response as if it was an http request.
Support Us
Please consider supporting us, so that we can build a non-profit for this project (ツ)
| Ethereum| Bitcoin |
|---|---|
| 0xBC2A050E7B87610Bc29657e7e7901DdBA6f2D34E
| bc1qujrqa3s34r5h0exgmmcuf8ejhyydm8wwja4fmq
|
| | |
License
GNU Affero GPLv3