@christoffercarlsson/autograph v0.18.0
A JavaScript implementation of the Autograph protocol
Installation
npm install --save @christoffercarlsson/autograph
API
calculateSafetyNumber(ourPublicKey, theirPublicKey)
ourPublicKey
<TypedArray>
|<DataView>
|<Buffer>
Our identity public key.theirPublicKey
<TypedArray>
|<DataView>
|<Buffer>
The identity public key of the other party.- Returns:
<Promise>
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()
- Returns:
<Promise>
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:
Constant | Value | Description |
---|---|---|
MESSAGE_TYPE_KEY_SHARE | 0 | Ephemeral X25519 key share message used for one-way authentication. |
MESSAGE_TYPE_MUTUAL_KEY_SHARE | 1 | Ephemeral X25519 key share message used for mutual authentication. |
MESSAGE_TYPE_AUTHENTICATION | 2 | Encrypted 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
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
2 years ago
1 year ago
2 years ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago