blockchainid
Advanced tools
Comparing version 0.0.0 to 0.0.1
```json | ||
{ | ||
"@type": "Person", | ||
"name": "Ryan Shea", | ||
@@ -54,3 +55,4 @@ "givenName": "Ryan", | ||
"service": "instagram", | ||
"identifier": "ryaneshea" | ||
"identifier": "ryaneshea", | ||
"proofType": "http" | ||
}, | ||
@@ -75,3 +77,3 @@ { | ||
"service": "openbazaar", | ||
"role": "data", | ||
"role": "storage", | ||
"data": { | ||
@@ -78,0 +80,0 @@ "guid": "34e57db64ce7435ab0f759oca31386527c670bd1" |
@@ -11,3 +11,3 @@ ```json | ||
"data": "https://s3.amazonaws.com/mq9/ryan.json", | ||
"publicKeychain": "xpub661MyMwAqRbcGihYVzyeNKUXSxeTrsmW61yi8CxiJYXd9zAvADmjqbMXGeEKKUsGMLAFXDkidEFrG9rE2YwKLGQbGA21ARDku1WYg2Escy6", | ||
"publicKeychain": "xpub661MyMwAqRbcEwdHeVxVcykgE8PK7j6gCajq8z6yDC74FuoQEjwrSdFiHEVnN3TaAMHQW9i32wdYkXpzUe84X9m4LpFmaogQMpjZdMHVmEh", | ||
"checksums": [ | ||
@@ -14,0 +14,0 @@ { |
@@ -11,7 +11,12 @@ 'use strict' | ||
function tokensToV3Profile(tokenRecords, publicKeychain) { | ||
function tokensToV3Profile(tokenRecords, publicKeychain, objectType) { | ||
if (!tokenRecords) { | ||
throw Error('tokenVerifier and tokens are required') | ||
} | ||
var profile = {} | ||
if (!objectType) { | ||
objectType = 'Person' | ||
} | ||
var profile = { | ||
'@type': objectType | ||
} | ||
tokenRecords.map(function(tokenRecord) { | ||
@@ -327,2 +332,4 @@ var token = tokenRecord.token, | ||
identifier: data.linkedinUsername, | ||
proofType: 'http', | ||
proofUrl: data.linkedinProofUrl | ||
}] | ||
@@ -337,2 +344,4 @@ }) | ||
identifier: data.instagramUsername, | ||
proofType: 'http', | ||
proofUrl: data.instagramProofUrl | ||
}] | ||
@@ -374,3 +383,3 @@ }) | ||
service: appName, | ||
role: 'data', | ||
role: 'storage', | ||
data: appData | ||
@@ -474,3 +483,5 @@ }] | ||
var claims = flatProfileToClaims(flatProfile) | ||
var profile = {} | ||
var profile = { | ||
'@type': 'Person' | ||
} | ||
claims.map(function(claim) { | ||
@@ -477,0 +488,0 @@ mergeObjects(profile, claim) |
{ | ||
"name": "blockchainid", | ||
"version": "0.0.0", | ||
"version": "0.0.1", | ||
"description": "Blockchain ID profile generator", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -11,12 +11,20 @@ # Blockchain ID JS | ||
* [Usernames](#usernames) | ||
* [Profiles](#profiles) | ||
- [Example Profile](#example-profile) | ||
* [Profile Storage](#profile-storage) | ||
* [Lookups](#lookups) | ||
* [Zone Files](#zone-files) | ||
- [Example Zone File](#example-zone-file) | ||
* [Token Files](#token-files) | ||
- [Example Token File](#example-token-file) | ||
* [Overview](#Overview) | ||
* [Usernames](#usernames) | ||
* [Profiles](#profiles) | ||
- [Example Profile](#example-profile) | ||
* [Profile Storage](#profile-storage) | ||
* [Lookups](#lookups) | ||
* [Zone Files](#zone-files) | ||
- [Example Zone File](#example-zone-file) | ||
* [Token Files](#token-files) | ||
- [Example Token File](#example-token-file) | ||
* [Usage](#usage) | ||
* [Create a Blockchain ID](#create-a-blockchain-id) | ||
* [Create a Zone File](#create-a-zone-file) | ||
* [Create a Token File](#create-a-token-file) | ||
* [Recover a Profile](#recover-a-profile) | ||
## Overview | ||
### Usernames | ||
@@ -123,1 +131,61 @@ | ||
[<img src="/docs/button-token-file.png" width="200">](/docs/token-file.md) | ||
## Usage | ||
```js | ||
var BlockchainID = require('blockchainid').BlockchainID, | ||
PrivateKeychain = require('keychain-manager').PrivateKeychain, | ||
PublicKeychain = require('keychain-manager').PublicKeychain | ||
var privateKeychain = new PrivateKeychain(), | ||
publicKeychain = privateKeychain.publicKeychain() | ||
``` | ||
### Create a Blockchain ID | ||
```js | ||
var profile = { | ||
"@type": "Person", | ||
"givenName": "Satoshi", | ||
"familyName": "Nakamoto", | ||
"knows": [ | ||
{ | ||
"@type": "Person", | ||
"id": "gavinandresen.id" | ||
} | ||
] | ||
} | ||
var blockchainID = new BlockchainID('satoshinakamoto.id', profile) | ||
``` | ||
### Create a Zone File | ||
```js | ||
var zoneFile = blockchainID.zoneFile(publicKeychain, hostUrls, checksums) | ||
``` | ||
### Create a Token File | ||
```js | ||
var tokenFile = blockchainID.signTokens(privateKeychain) | ||
``` | ||
### Recover a Profile | ||
```js | ||
var loadedBlockchainID = BlockchainID.fromTokens('satoshinakamoto.id', tokenFile, publicKeychain) | ||
var profile = loadedBlockchainID.profile() | ||
console.log(profile) | ||
{ | ||
"@type": "Person", | ||
"givenName": "Satoshi", | ||
"familyName": "Nakamoto", | ||
"knows": [ | ||
{ | ||
"@type": "Person", | ||
"id": "gavinandresen.id" | ||
} | ||
] | ||
} | ||
``` |
Sorry, the diff of this file is too big to display
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
136705
813
190