hypercore-sign-lib
v1.1.0
Published
Sign Hypercores
Readme
hypercore-sign-lib
Sign hypercore signing requests using public/private key cryptography, and verify the signatures.
The flow is:
- The signer creates a public/private key pair, and shares the public key
- The signer signs Hypercores (for example to approve of their content at a certain length), and shares the signed message.
- Anyone with the public key can verify that the hypercore was indeed approved by the signer.
Install
npm i -g hypercore-sign-libAPI
const encryptedKey = await generate(password)
Generate a keyPair and encrypt it using password. Returns a buffer.
const response = await sign(request, encryptedKey, password, [publicKey])
Sign a request using the key and password combination. If password is not correct, signing will fail.
publicKey is only needed for legacy key support.
const valid = verify(response, signingRequest, publicKey)
Veriy response is a valid signature over signingRequest by publicKey.
License
Apache-2.0
