blockchain-profile
Advanced tools
Comparing version 0.3.0 to 0.3.2
'use strict' | ||
module.exports = { | ||
Person: require('./lib/schemas/person'), | ||
Organization: require('./lib/schemas/organization'), | ||
Person: require('./lib/schemas/Person'), | ||
Organization: require('./lib/schemas/Organization'), | ||
CreativeWork: require('./lib/schemas/CreativeWork'), | ||
createZoneFile: require('./lib/zonefile'), | ||
@@ -7,0 +8,0 @@ signProfileTokens: require('./lib/tokening').signProfileTokens, |
@@ -69,3 +69,3 @@ 'use strict' | ||
"@type": "Account", | ||
"service": "Bitcoin", | ||
"service": "bitcoin", | ||
"role": "payment", | ||
@@ -72,0 +72,0 @@ "identifier": profile.bitcoin.address |
{ | ||
"name": "blockchain-profile", | ||
"version": "0.3.0", | ||
"version": "0.3.2", | ||
"description": "Blockchain ID Profile Generator", | ||
@@ -29,2 +29,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"dateformat": "^1.0.12", | ||
"elliptic-curve": "0.0.1", | ||
@@ -31,0 +32,0 @@ "hasprop": "0.0.3", |
123
README.md
@@ -11,3 +11,7 @@ # Blockchain Profile JS | ||
* [Usage](#usage) | ||
* [Types](#types) | ||
* [Person](#person) | ||
* [Organization](#organization) | ||
* [CreativeWork](#creative-work) | ||
* [Registration](#registration) | ||
* [Create a Profile Object](#create-a-profile-object) | ||
@@ -28,6 +32,113 @@ * [Create a Token File](#create-a-token-file) | ||
## Usage | ||
## Types | ||
Follow these steps to generate a profile for a Blockchain ID: | ||
### Person | ||
```js | ||
var person = new Person() | ||
person.setName("Naval", "Ravikant") | ||
person.setDescription("Co-founder of AngelList") | ||
person.setImage("avatar", "https://pbs.twimg.com/profile_images/3696617328/667874c5936764d93d56ccc76a2bcc13.jpeg") | ||
person.setSocialAccount("facebook", "navalr", "https://facebook.com/navalr/posts/10152190734077261") | ||
person.setSocialAccount("twitter", "naval", "https://twitter.com/naval/status/486609266212499456") | ||
person.setEmployer("angellist.id", "Angel List") | ||
person.setFriend("muneeb.id", "Muneeb Ali") | ||
person.setFriend("ryan.id", "Ryan Shea") | ||
console.log(person.profile) | ||
{ | ||
"@type": "Person", | ||
"name": "Naval Ravikant", | ||
"image": [ | ||
{ | ||
"@type": "ImageObject", | ||
"name": "avatar", | ||
"contentUrl": "https://pbs.twimg.com/profile_images/3696617328/667874c5936764d93d56ccc76a2bcc13.jpeg" | ||
} | ||
] | ||
"account": [ | ||
{ | ||
"@type": "Account", | ||
"service": "facebook", | ||
"identifier": "navalr", | ||
"proofType": "http", | ||
"proofUrl": "https://facebook.com/navalr/posts/10152190734077261" | ||
}, | ||
{ | ||
"@type": "Account", | ||
"service": "twitter", | ||
"identifier": "naval", | ||
"proofType": "http", | ||
"proofUrl": "https://twitter.com/naval/status/486609266212499456" | ||
} | ||
], | ||
"worksFor": [ | ||
{ | ||
"@type": "Organization", | ||
"name": "AngelList", | ||
"id": "angellist.id" | ||
} | ||
], | ||
"knows": [ | ||
{ | ||
"@type": "Person", | ||
"name": "Muneeb Ali", | ||
"id": "muneeb.id" | ||
}, | ||
{ | ||
"@type": "Person", | ||
"name": "Ryan Shea", | ||
"id": "ryan.id" | ||
} | ||
] | ||
} | ||
``` | ||
### Organization | ||
```js | ||
var organization = new Organization() | ||
organization.setName("AngelList") | ||
organization.setEmployee("naval.id", "Naval Ravikant") | ||
console.log(organization.profile) | ||
{ | ||
"@type": "Organization", | ||
"name": "AngelList", | ||
"employee": [ | ||
{ | ||
"@type": "Person", | ||
"name": "Naval Ravikant", | ||
"id": "naval.id" | ||
} | ||
] | ||
} | ||
``` | ||
### Creative Work | ||
```js | ||
var creativeWork = new CreativeWork() | ||
creativeWork.setName("Balloon Dog") | ||
creativeWork.setCreator("therealjeffkoons.id", "Jeff Koons") | ||
creativeWork.setDateCreated("May 9 1994") | ||
creativeWork.setDatePublished(new Date()) | ||
console.log(creativeWork.profile) | ||
{ | ||
"@type": "CreativeWork", | ||
"name": "Balloon Dog", | ||
"creator": [ | ||
{ | ||
"@type": "Person", | ||
"name": "Jeff Koons", | ||
"id": "therealjeffkoons.id" | ||
} | ||
], | ||
"dateCreated": "1994-05-09T00:00:00-0400", | ||
"datePublished": "2015-12-10T14:44:26-0500" | ||
} | ||
``` | ||
## Registration | ||
Follow these steps to create and register a profile for a Blockchain ID: | ||
1. Create a JSON profile object | ||
@@ -121,3 +232,3 @@ 2. Convert the profile object into tokens | ||
[<img src="/docs/button-profile.png" width="200">](/docs/person/profile.md) | ||
[<img src="/docs/buttons/button-profile.png" width="200">](/docs/Person/profile.md) | ||
@@ -171,3 +282,3 @@ ### Profile Storage | ||
[<img src="/docs/button-zone-file.png" width="200">](/docs/person/zone-file.md) | ||
[<img src="/docs/buttons/button-zone-file.png" width="200">](/docs/Person/zone-file.md) | ||
@@ -204,3 +315,3 @@ ### Token Files | ||
[<img src="/docs/button-token-file.png" width="200">](/docs/person/token-file.md) | ||
[<img src="/docs/buttons/button-token-file.png" width="200">](/docs/Person/token-file.md) | ||
var profileDirectory = { | ||
pgpPublicKeyHash: "e508f0c2c455ab79a4fabc4b51aa537e123c08abee40a87c47e6705a2bbae4ae", | ||
navalChecksums: [{ | ||
field: 'pgp[0].publicKey', | ||
hash: 'e508f0c2c455ab79a4fabc4b51aa537e123c08abee40a87c47e6705a2bbae4ae', | ||
algorithm: 'SHA256' | ||
}], | ||
balloondog_art: { | ||
"@context": "http://schema.org/", | ||
"@type": "CreativeWork", | ||
"name": "Balloon Dog", | ||
"creator": [ | ||
{ | ||
"@type": "Person", | ||
"name": "Jeff Koons", | ||
"id": "therealjeffkoons.id" | ||
} | ||
], | ||
"dateCreated": "1994-05-09T00:00:00-0400", | ||
"datePublished": "2015-12-10T14:44:26-0500" | ||
}, | ||
google_id: { | ||
"@context": "http://schema.org", | ||
"@context": "http://schema.org/", | ||
"@type": "Organization", | ||
@@ -41,2 +59,3 @@ "name": "Google", | ||
naval_profile: { | ||
"@context": "http://schema.org/", | ||
"@type": "Person", | ||
@@ -43,0 +62,0 @@ "name": "Naval Ravikant", |
68
test.js
@@ -10,3 +10,4 @@ 'use strict' | ||
PrivateKeychain = require('keychain-manager').PrivateKeychain, | ||
PublicKeychain = require('keychain-manager').PublicKeychain | ||
PublicKeychain = require('keychain-manager').PublicKeychain, | ||
dateFormat = require('dateformat') | ||
@@ -17,2 +18,3 @@ var profileDirectory = require('./sample-data') | ||
Organization = require('./index').Organization, | ||
CreativeWork = require('./index').CreativeWork, | ||
createZoneFile = require('./index').createZoneFile, | ||
@@ -101,3 +103,3 @@ signProfileTokens = require('./index').signProfileTokens, | ||
function testFileCreation(objectType, username, profile) { | ||
function testFileCreation(objectType, username, profile, checksums) { | ||
var zoneFile, tokenFile, profile | ||
@@ -109,7 +111,2 @@ | ||
var hostUrls = ['https://s3.amazonaws.com/mq9/' + username + '.json'] | ||
var checksums = [{ | ||
field: 'pgp[0].publicKey', | ||
hash: profileDirectory.pgpPublicKeyHash, | ||
algorithm: 'SHA256' | ||
}] | ||
zoneFile = createZoneFile(username, publicKeychain, hostUrls, checksums) | ||
@@ -252,3 +249,3 @@ t.ok(zoneFile, 'zone file should have been created') | ||
t.ok(person.profile, 'person profile should have been created') | ||
console.log(person.profile) | ||
//console.log(person.profile) | ||
}) | ||
@@ -260,3 +257,3 @@ | ||
t.ok(person.profile, 'person profile should have been created') | ||
console.log(person.profile) | ||
//console.log(person.profile) | ||
}) | ||
@@ -316,10 +313,55 @@ | ||
function testCreativeWorkProfile() { | ||
var creativeWork | ||
test('createCreativeWork', function(t) { | ||
t.plan(2) | ||
creativeWork = new CreativeWork() | ||
t.ok(creativeWork, 'creative work should have been created') | ||
t.ok(creativeWork.profile, 'profile should have been created') | ||
}) | ||
test('setName', function(t) { | ||
t.plan(1) | ||
creativeWork.setName('Balloon Dog') | ||
t.equal(creativeWork.profile.name, 'Balloon Dog', 'profile name should have been properly set') | ||
}) | ||
test('setCreator', function(t) { | ||
t.plan(2) | ||
creativeWork.setCreator('therealjeffkoons.id') | ||
t.ok(creativeWork.profile.creator, 'creator list should have been created') | ||
t.equal(creativeWork.profile.creator.length, 1, 'there should be 1 creator') | ||
}) | ||
test('setDateCreated', function(t) { | ||
t.plan(2) | ||
creativeWork.setDateCreated('May 9 1994') | ||
t.ok(creativeWork.profile.dateCreated, 'date created should have been set') | ||
t.equal(creativeWork.profile.dateCreated.slice(0, -5), '1994-05-09T00:00:00', 'date created should be equal to reference') | ||
}) | ||
test('setDatePublished', function(t) { | ||
t.plan(2) | ||
var datePublished = new Date() | ||
creativeWork.setDatePublished(datePublished) | ||
t.ok(creativeWork.profile.datePublished, 'date published should have been set') | ||
t.equal(creativeWork.profile.datePublished, dateFormat(datePublished, 'isoDateTime'), 'date published should be equal to reference') | ||
}) | ||
} | ||
testPersonProfile() | ||
testOrganizationProfile() | ||
testCreativeWorkProfile() | ||
testTokening(profileDirectory.naval_profile) | ||
testTokening(profileDirectory.google_id) | ||
testTokening(profileDirectory.balloondog_art) | ||
testFlattening() | ||
testFileCreation('person', 'naval.id', profileDirectory.naval_profile) | ||
testFileCreation('organization', 'google.id', profileDirectory.google_id) | ||
testFileCreation('Person', 'naval.id', profileDirectory.naval_profile, profileDirectory.navalChecksums) | ||
testFileCreation('Organization', 'google.id', profileDirectory.google_id, []) | ||
testFileCreation('CreativeWork', 'balloondog.art', profileDirectory.balloondog_art, []) | ||
testLegacyFormat() | ||
testPersonProfile() | ||
testOrganizationProfile() |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
131595
26
1228
313
6
+ Addeddateformat@^1.0.12
+ Addedarray-find-index@1.0.2(transitive)
+ Addedcamelcase@2.1.1(transitive)
+ Addedcamelcase-keys@2.1.0(transitive)
+ Addedcurrently-unhandled@0.4.1(transitive)
+ Addeddateformat@1.0.12(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedfind-up@1.1.2(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedindent-string@2.1.0(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-utf8@0.2.1(transitive)
+ Addedload-json-file@1.1.0(transitive)
+ Addedloud-rejection@1.6.0(transitive)
+ Addedmeow@3.7.0(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedpath-exists@2.1.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@1.1.0(transitive)
+ Addedpify@2.3.0(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedread-pkg@1.1.0(transitive)
+ Addedread-pkg-up@1.0.1(transitive)
+ Addedredent@1.0.0(transitive)
+ Addedrepeating@2.0.1(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedstrip-bom@2.0.0(transitive)
+ Addedstrip-indent@1.0.1(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtrim-newlines@1.0.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)