0.0.10 • Published 5 years ago

@paladin-privacy/profiles v0.0.10

Weekly downloads
3
License
GPL-3.0
Repository
github
Last release
5 years ago

Paladin Profiles

This javascript library lets you create and manage profiles for Paladin, the distributed social network.

Basic usage

import { Profile, Fields, Visibility } from '@paladin-privacy/profiles';

const profile = new Profile();
profile.initialize();
profile.setField(Fields.Nickname, 'Jane', Visibility.Public);
profile.setField(Fields.Email, 'jane@example.com', Visibility.Private);
profile.sign();
const data = profile.getProfile();

This will create a profile (complete with its keychain), and sign the profile using the generated private key. The data can then be persisted to a user's machine.

The profile can be loaded back into memory with the constructor on Profile.

const data = // get the data from the file system
const profile = new Profile(data);

To share the profile with someone else, first use filterFor; it will strip out confidential information from the profile, such as the profile's private key.

import { Visibility } from '@paladin-privacy/profiles';
const toShare = profile.filterFor(Visibility.Public);
const dataToShare = profile.getProfile();

Add friends and encrypt data for them only:

import { Profile, Fields, Visibility, forFriends } from '@paladin-privacy/profiles';

const alice = new Profile();
alice.setField(Fields.Nickname, 'Alice', Visibility.Public);
alice.sign();

const bob = new Profile();
bob.addFriend(alice);
bob.setField(Fields.Nickname, 'Bob', Visibility.Public);
bob.setField(Fields.Email, 'bob@example.org', forFriends([ alice.toFriend() ]));

console.log(bob.getField(Fields.Email, alice));
// Result: bob@example.org
0.0.10

5 years ago

0.0.9

5 years ago

0.0.8

5 years ago

0.0.7

5 years ago

0.0.6

5 years ago

0.0.5

5 years ago

0.0.4

5 years ago

0.0.3

5 years ago

0.0.2

5 years ago

0.0.1

5 years ago