WIP invitation API
This commit is contained in:
@@ -3,23 +3,50 @@ var factory = function (Util, Cred, nThen) {
|
||||
nThen = nThen; // XXX
|
||||
var Invite = {};
|
||||
|
||||
/*
|
||||
TODO key derivation
|
||||
/* INPUTS
|
||||
|
||||
* password (for scrypt)
|
||||
* message (personal note)
|
||||
* link hash
|
||||
* bytes64 (scrypt output)
|
||||
* preview_hash
|
||||
|
||||
scrypt(seed, passwd) => {
|
||||
curve: {
|
||||
private,
|
||||
public,
|
||||
},
|
||||
ed: {
|
||||
private,
|
||||
public,
|
||||
}
|
||||
cryptKey,
|
||||
channel
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/* DERIVATIONS
|
||||
|
||||
* components corresponding to www/common/invitation.js
|
||||
* preview_hash => components
|
||||
* channel
|
||||
* cryptKey
|
||||
* b64_bytes
|
||||
* curvePrivate => curvePublic
|
||||
* edSeed => edPrivate => edPublic
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* IO / FUNCTIONALITY
|
||||
|
||||
* creator
|
||||
* generate a random signKey (prevent writes to preview channel)
|
||||
* encrypt and upload the preview content
|
||||
* via CryptGet
|
||||
* owned by:
|
||||
* the ephemeral edPublic
|
||||
* the invite creator
|
||||
* create a roster entry for the invitation
|
||||
* with encrypted notes for the creator
|
||||
* redeemer
|
||||
* get the preview content
|
||||
* redeem the invite
|
||||
* add yourself to the roster
|
||||
* add the team to your proxy-manager
|
||||
|
||||
*/
|
||||
|
||||
|
||||
var BYTES_REQUIRED = 256;
|
||||
|
||||
Invite.deriveKeys = function (seed, passwd, cb) {
|
||||
|
||||
@@ -10,6 +10,7 @@ define([
|
||||
'/common/outer/roster.js',
|
||||
'/common/common-messaging.js',
|
||||
'/common/common-feedback.js',
|
||||
'/common/outer/invitation.js',
|
||||
|
||||
'/bower_components/chainpad-listmap/chainpad-listmap.js',
|
||||
'/bower_components/chainpad-crypto/crypto.js',
|
||||
@@ -19,7 +20,7 @@ define([
|
||||
'/bower_components/saferphore/index.js',
|
||||
'/bower_components/tweetnacl/nacl-fast.min.js',
|
||||
], function (Util, Hash, Constants, Realtime,
|
||||
ProxyManager, UserObject, SF, Roster, Messaging, Feedback,
|
||||
ProxyManager, UserObject, SF, Roster, Messaging, Feedback, Invite,
|
||||
Listmap, Crypto, CpNetflux, ChainPad, nThen, Saferphore) {
|
||||
var Team = {};
|
||||
|
||||
@@ -1259,7 +1260,9 @@ define([
|
||||
ctx.store.messenger.openTeamChat(team.getChatData(), onUpdate, cId, cb);
|
||||
};
|
||||
|
||||
// XXX ansuz
|
||||
var createInviteLink = function (ctx, data, cId, cb) {
|
||||
Invite = Invite;
|
||||
var team = ctx.teams[data.teamId];
|
||||
team = team;
|
||||
/*
|
||||
@@ -1277,6 +1280,7 @@ define([
|
||||
});
|
||||
*/
|
||||
};
|
||||
// XXX ansuz
|
||||
var getLinkData = function (ctx, data, cId, cb) {
|
||||
/*
|
||||
var password = data.password;
|
||||
|
||||
Reference in New Issue
Block a user