Skip to content

Commit

Permalink
Update user model to use public/private key instead of verifying/sign…
Browse files Browse the repository at this point in the history
…ing key because of upstream changes
  • Loading branch information
sohkai committed Feb 10, 2017
1 parent b2856e3 commit 0b4ac49
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ The API server can be configured with a number of environment variables [see
### Create Users

This call will not store any data on the running instance of BigchainDB.
It simply generates a verifying and signing key-pair that can be used in a
It simply generates a public/private key-pair that can be used in a
POST-manifestation call.

```
Expand All @@ -151,17 +151,17 @@ PAYLOAD: None
RETURNS:
{
"verifyingKey": "<base58 string>",
"signingKey": "<base58 string>",
"publicKey": "<base58 string>",
"privateKey": "<base58 string>",
}
```


### Register a Manifestation

In order to register the manifestation on BigchainDB as transactions on a
specific copyright holder's name, the copyright holder's `verifyingKey` and
`signingKey` must be provided here.
specific copyright holder's name, the copyright holder's `publicKey` and
`privateKey` must be provided here.

Note that the attributes shown for `manifestation` and `work` can be much more
diverse; for this, see the COALA IP models definition (not yet publicly
Expand All @@ -179,8 +179,8 @@ PAYLOAD:
"url": "<URI pointing to a media blob>"
},
"copyrightHolder": {
"verifyingKey": "<base58 string>",
"signingKey": "<base58 string>"
"publicKey": "<base58 string>",
"privateKey": "<base58 string>"
},
"work": {
"name": "The Lord of the Rings Triology",
Expand Down Expand Up @@ -278,8 +278,8 @@ PAYLOAD:
"license": "<Legal license text or URI pointing to a license document>"
},
"currentHolder": {
"verifyingKey": "<base58 string>",
"signingKey": "<base58 string>"
"publicKey": "<base58 string>",
"privateKey": "<base58 string>"
},
"sourceRightId": "<ID of an existing Right that allows for the creation of this new Right>"
}
Expand Down
4 changes: 2 additions & 2 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
def test_create_user(client):
resp = client.post(url_for('user_views.userapi'))
assert resp.status_code == 200
assert resp.json['verifyingKey']
assert resp.json['signingKey']
assert resp.json['publicKey']
assert resp.json['privateKey']


def test_create_manifestation(client, user):
Expand Down
2 changes: 1 addition & 1 deletion web/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from web.utils import parse_model


user_model = parse_model(['verifyingKey', 'signingKey'])
user_model = parse_model(['publicKey', 'privateKey'])
manifestation_model = parse_model(['name', 'datePublished', 'url'])
work_model = parse_model(['name', 'author'])
right_model = parse_model(['license'])
4 changes: 2 additions & 2 deletions web/views/manifestations.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def post(self):

copyright_holder = args['copyrightHolder']
copyright_holder = {
'verifying_key': copyright_holder.pop('verifyingKey'),
'signing_key': copyright_holder.pop('signingKey')
'public_key': copyright_holder.pop('publicKey'),
'private_key': copyright_holder.pop('privateKey')
}

copyright_, manifestation, work = coalaip.register_manifestation(
Expand Down
4 changes: 2 additions & 2 deletions web/views/rights.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ def post(self):
right['allowedBy'] = source_right_id

current_holder = args['currentHolder']
current_holder['verifying_key'] = current_holder.pop('verifyingKey')
current_holder['signing_key'] = current_holder.pop('signingKey')
current_holder['public_key'] = current_holder.pop('publicKey')
current_holder['private_key'] = current_holder.pop('privateKey')

right = coalaip.derive_right(right_data=right,
current_holder=current_holder)
Expand Down
6 changes: 3 additions & 3 deletions web/views/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ def post(self):
"""API endpoint to create a new keypair for a user
Return:
A dict containing the verifying_key and signing_key.
A dict containing the publicKey and privateKey.
"""
# TODO FOR COALA IP: Return CamelCase key names
user = coalaip.generate_user()
# TODO: We might want to have a generic function for this at one point.
user['verifyingKey'] = user.pop('verifying_key')
user['signingKey'] = user.pop('signing_key')
user['publicKey'] = user.pop('public_key')
user['privateKey'] = user.pop('private_key')
return user


Expand Down

0 comments on commit 0b4ac49

Please sign in to comment.