0.18.0 • Published 12 months ago

@christoffercarlsson/autograph v0.18.0

Weekly downloads
-
License
Unlicense
Repository
github
Last release
12 months ago

A JavaScript implementation of the Autograph protocol

Installation

npm install --save @christoffercarlsson/autograph

API

calculateSafetyNumber(ourPublicKey, theirPublicKey)

Calculates a safety number that can be used to protect against man-in-the-middle attacks.

The Promise is resolved with an <Uint8Array> containing the safety number upon success.

import { calculateSafetyNumber } from '@christoffercarlsson/autograph'

const alice = Buffer.from(
  'M5-vznxFiMUwEBtIw3HOg_RTnJHisJ1w_OnmMiXklaE',
  'base64url'
)

const bob = Buffer.from(
  'Sn7v22LDbP0V153J_yHPnYZ-wLgSKLJ7-nEk_JLsnDc',
  'base64url'
)

const safetyNumber = await calculateSafetyNumber(alice, bob)

generateKeyPair()

Generates a new Ed25519 identity key pair.

The Promise is resolved with an object containing publicKey and privateKey properties that holds the generated keys upon success.

import { generateKeyPair } from '@christoffercarlsson/autograph'

const { publicKey, privateKey } = await generateKeyPair()

Constants

Message type constants

The following constants are used to identify the different types of messages exchanged between parties and:

ConstantValueDescription
MESSAGE_TYPE_KEY_SHARE0Ephemeral X25519 key share message used for one-way authentication.
MESSAGE_TYPE_MUTUAL_KEY_SHARE1Ephemeral X25519 key share message used for mutual authentication.
MESSAGE_TYPE_AUTHENTICATION2Encrypted authentication message.

License

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to https://unlicense.org

0.17.0

12 months ago

0.18.0

12 months ago

0.15.0

1 year ago

0.16.0

1 year ago

0.14.1

1 year ago

0.12.0

2 years ago

0.13.0

1 year ago

0.12.1

2 years ago

0.14.0

1 year ago

0.13.1

1 year ago

0.13.2

1 year ago

0.10.0

2 years ago

0.11.0

2 years ago

0.10.1

2 years ago

0.9.0

2 years ago

0.8.0

4 years ago

0.7.1

4 years ago

0.7.0

4 years ago

0.6.0

4 years ago

0.5.0

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

5 years ago

0.1.0

5 years ago