Skip to content

PKID is a public Key Indexed Datastore. You can save plain or encrypted data in a public key index; as long as you are the owner of the secret corresponding to that public key.

License

Notifications You must be signed in to change notification settings

rawdaGastan/pkid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PKID

Codacy Badge Dependabot Testing gopherbadger-tag-do-not-edit

PKID is a public Key Indexed Datastore. You can save plain or encrypted data in a public key index; as long as you are the owner of the secret corresponding to that public key.

Routes

Set document

POST /{pk}/{project}/{key}

Set the value of a document corresponding to {key} inside a {project} indexed by the public key {pk}. This is only possible when sending following header; signed by the private key corresponding to {pk}.

pk is hex encoded; request data is a base64 encoded and signed;

{ "is_encrypted": true, "payload": "document value", "data_version": 1}

header is base64 encoded and signed;

{ "intent": "pkid.store", "timestamp": "epochtime"}

Get document

GET /{pk}/{project}/{key}

Get the value of a document corresponding to {key} inside a {project} indexed by the public key {pk}. There is no requirement for a security header

pk is hex encoded; response data is base64 encoded;

Delete document

DELETE /{pk}/{project}/{key}

Delete the value of a document corresponding to {key} inside a {project} indexed by the public key {pk}. There is no requirement for a security header

pk is hex encoded;

Delete project

DELETE /{pk}/{project}

Delete all values of documents inside a {project} indexed by the public key {pk}. There is no requirement for a security header

pk is hex encoded;

List

GET /{pk}/{project}

Get the keys of a {project} indexed by the public key {pk}. There is no requirement for a security header

pk is hex encoded; response data is base64 encoded;

Build

First create config.json check configuration

make build

Run

First create config.json check configuration

make run

Configuration

Before building or running create config.json.

example config.json:

{
	"port": ":3000",
	"version": "v1",
	"db_file": "pkid.db"
}

Test

  • Run the app
make test

GO PKID client

  • This is a go client for pkid to be able to use pkid

How to use

import "github.com/rawdaGastan/pkid/client"

privateKey, publicKey := GenerateKeyPair()
serverUrl := "http://localhost:3000"
timeout := 5 * time.Second
pkidClient := NewPkidClient(privateKey, publicKey, serverUrl, timeout)

err := pkidClient.Set("pkid", "key", "value", true)
value, err := pkidClient.Get("pkid", "key")
keys, err := pkidClient.List("pkid")
err = pkidClient.DeleteProject("pkid")
err = pkidClient.Delete("pkid", "key")

Using PKID in combination with the Threefold Connect app - derived seed scope

  • Get the derived seed from TF login
  • Generate the key pair using the derived seed
import "github.com/rawdaGastan/pkid/client"

seed := <your seed>
privateKey, publicKey, err := GenerateKeyPairUsingSeed(seed)
serverUrl := "http://localhost:3000"
timeout := 5 * time.Second
pkidClient := NewPkidClient(privateKey, publicKey, serverUrl, timeout)
...
...

About

PKID is a public Key Indexed Datastore. You can save plain or encrypted data in a public key index; as long as you are the owner of the secret corresponding to that public key.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published