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

github.com/sid-sun/secure-notes-api

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/sid-sun/secure-notes-api

  • v0.0.0-20200627202923-761ab62619bf
  • Source
  • Go
  • Socket score

Version published
Created
Source

PASSWORDLESS SECURE NOTES API

An API written in Go to demonstrate CRUD (Create Read Update Delete) on encrypted notes anonymous without storing password in any manner - As an example to using cryptography to facilitate authentication

A proof-of-concept to my Medium article on Doing secure password authentication without storing passwords - the main difference being here we do CRUD on notes instead of encryption and decryption on asymmetric private keys

Usage:

To Be Greeted

We all like greetings - This API likes to greet, but it is not pushy about it, it only offers you its heartfelt time-appropriate greetings if you ask for them. Request Type: HTTP GET

URL:

http://$host:$port/

To Set A New Note

Request Type: HTTP POST

BODY:

{
    "id": "mySecretNote",
    "pass": "&now:we@pluto",
    "note": "I am a bufferfly, flying through the sky"
}

URL:

http://$host:$port/set

Upon success, the Original ID is returned along with Status: 200. If an ID is not supplied or a note already exists with the supplied id, A randomly generated 8 character ID is returned insted.

Response on success:

{
    "ID": "mySecretNote"
}

A request may fail due to any one (or all) of the following reasons:

  • The note in request is empty
  • The password in request is empty

If the Request fails, Status: 400 is returned

To Get A Note

Request Type: HTTP GET

BODY:

{
    "id": "mySecretNote",
    "pass": "&now:we@pluto"
}

URL:

http://$host:$port/get

Upon success, the Original ID is returned along with the note with Status: 200.

Response on success:

{
    "ID": "mySecretNote",
    "Note": "I am a bufferfly, flying through the sky"
}

A request may fail due to any one of the following reasons:

  1. The ID in the request is empty
  2. The pass in request is empty
  3. The supplied ID is incorrect
  4. The supplied pass is incorrect

If the Request fails due to 1 or 2, Status: 400 is returned

If the Request fails due to 3 or 4, Status: 404 is returned

To Delete A Note

Request Type: HTTP DELETE

BODY:

{
    "id": "mySecretNote",
    "pass": "&now:we@pluto"
}

URL:

http://$host:$port/delete

Upon success, the Original ID is returned with Status: 200.

Response on success:

{
    "ID": "mySecretNote"
}

A request may fail due to any one of the following reasons:

  1. The ID in the request is empty
  2. The pass in request is empty
  3. The supplied ID is incorrect
  4. The supplied pass is incorrect

If the Request fails due to 1 or 2, Status: 400 is returned

If the Request fails due to 3 or 4, Status: 404 is returned

To Update A Note

Request Type: HTTP PUT

BODY:

{
    "id": "mySecretNote",
    "pass": "&now:we@pluto",
    "note": "I am a bufferfly, flying through the sky on Mars"
}

Optionally to change the password for the new note, newpass may also be defined, like so:

BODY:

{
    "id": "mySecretNote",
    "pass": "&now:we@pluto",
    "newpass": "&now:we@moon",
    "note": "I am a bufferfly, flying through the sky on Mars"
}

URL:

http://$host:$port/update/note

Upon success, the Original ID is returned with Status: 200.

Response on success:

{
    "ID": "mySecretNote"
}

A request may fail due to any one of the following reasons:

  1. The ID, pass or note in the request are empty
  2. The supplied ID or pass are incorrect

If the Request fails due to 1, Status: 400 is returned

If the Request fails due to 2, Status: 404 is returned

To Update A Note's Pass

Request Type: HTTP PATCH

BODY:

{
    "id": "mySecretNote",
    "pass": "&now:we@pluto",
    "newpass": "&now:we@moon"
}

URL:

http://$host:$port/update/pass

Upon success, the Original ID is returned with Status: 200.

Response on success:

{
    "ID": "mySecretNote"
}

A request may fail due to any one of the following reasons:

  1. The ID, pass or newpass fields are request are empty
  2. The newpass and pass fields are equal
  3. The supplied ID or pass are incorrect

If the Request fails due to 1 or 2, Status: 400 is returned

If the Request fails due to 3, Status: 404 is returned

Cheers!

FAQs

Package last updated on 27 Jun 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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