Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

blockchain-profile

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

blockchain-profile - npm Package Compare versions

Comparing version 0.3.0 to 0.3.2

docs/buttons/button-profile.png

5

index.js
'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,

2

lib/legacy-formats/person.js

@@ -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",

@@ -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",

@@ -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()
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc