0.5.11 • Published 10 years ago

remotestorage-server v0.5.11

Weekly downloads
847
License
MIT
Repository
github
Last release
10 years ago

remotestorage-server

The remoteStorage core from https://github.com/remotestorage/starter-kit

Build Status devDependency Status Code Climate

interface

    //set up the remoteStorage server instance:
    var RemotestorageServer = require('remotestorage-server'),
      specVersion = 'draft-dejong-remotestorage-02',
      tokenStore = { _data: {}, get: function(username, token, cb) {
        cb(null, this._data[username+':'+token]);
      }, set: function(username, token, scopes, cb) {
        this._data[username+':'+token] = scopes; cb(null); } },
      dataStore =  { _data: {}, get: function(username, key, cb) {
        cb(null, this._data[username+':'+key]);
      }, set: function(username, key, buf, cb) {
        this._data[usernae+':'+key] = buf; cb(null);
      }
    };

    var serverInstance = new RemotestorageServer(specVersion, tokenStore, dataStore);
    
    //set up a https server:
    var fs = require('fs'),
      https = require('https'),
      httpsConfig = {
        key: fs.readFileSync('./tls.key'),
        cert: fs.readFileSync('./tls.cert'),
        ca: fs.readFileSync('./ca.pem')
      };

    //add access tokens (you would typically do this from an ajax call in your OAuth dialog):
    tokenStore._data['me:SECRET'] = serverInstance.makeScopePaths(['tasks:rw', 'contacts:r']);
    tokenStore._data['me:GOD'] = serverInstance.makeScopePaths(['*:rw']);

    //serve storage:
    https.createServer(httpsConfig, serverInstance.storage).listen(8000);
    
    //get the link for including in your webfinger record:
    var link = remotestorageServer.getWebfingerLink('https', 'example.com', 8000, 'me', 'https://example.com/auth/me');

You will also need:

  • a webfinger server, serving your webfinger record on path /.well-known/webfinger on port 443 (or on port 80 when testing on localhost).
  • an html page which serves as an OAuth dialog

See https://github.com/remotestorage/starter-kit for an examples of both.

0.5.11

10 years ago

0.5.10

10 years ago

0.5.9

10 years ago

0.5.8

10 years ago

0.5.7

10 years ago

0.5.6

10 years ago

0.5.5

10 years ago

0.5.4

10 years ago

0.5.3

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.1

10 years ago

0.4.0

10 years ago

0.3.2

10 years ago

0.3.1

10 years ago

0.3.0

10 years ago

0.2.4

10 years ago

0.2.3

10 years ago

0.2.2

10 years ago

0.2.1

10 years ago

0.1.8

10 years ago

0.1.7

10 years ago

0.1.6-pre

10 years ago

0.1.5-pre

10 years ago

0.1.3-pre

10 years ago

0.1.2-pre

10 years ago

0.1.1-pre

10 years ago

0.1.0-pre

10 years ago