1.1.11 • Published 2 years ago

@bitcoinunlimited/bchidentity v1.1.11

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
2 years ago

bchidentity

bchidentity is a JavaScript library that lets you authenticate using the BCH Identity Protocol.

logo

Example

const bchidentity = require("bchidentity");
(async () => {

    // Private key to sign authentication challenge with
    const wif = 'L4vmKsStbQaCvaKPnCzdRArZgdAxTqVx8vjMGLW5nHtWdRguiRi1';

    // The bchidentity login offer
    const offer = "bchidentity://example.org:443/login?op=login&chal=ci7P10BiPlL7B1QWa&cookie=fBAMYnHSwa";

    bchidentity.identify(offer, wif)
        .then(([status, response]) => {
            console.log("OK: ", status, response);
        })
        .catch(([status, response]) => {
            console.log("Error: ", status, response);
        });
})();

Client example

Examples includes an example authenticating client. The private key authenticated with is deterministically generated from the --user parameter.

Example:

$ npm run cli -- "bchidentity://example.org:443/login?op=login&chal=ci7P10BiPlL7B1QWa&cookie=fBAMYnHSwa" --user bob

Authenticating to bchidentity://example.org:443/login?op=login&chal=ci7P10BiPlL7B1QWa&cookie=fBAMYnHSwa with address 19vcfWqUTxHvSfPfBqE54bWVGS5R5R7LCR and private key KzX4C7Hrk2sXzVTGjGqekakwXLc3NZ6G6Rta4JBduMaF49hLe9sE

Demo

Go to https://voter.cash/#/login, copy the bchidentity:// url and run npm run cli -- <url>.

License

This project is licensed under the MIT License.

1.1.11

2 years ago

1.1.10

2 years ago

1.1.8

2 years ago