Getting Started
TypeScript library encapsulating the PintSwap p2p stack, protocol definitions, and associated cryptography routines. Embedded within the pintswap-daemon processes as well as the PintSwap web frontend.
Last updated
TypeScript library encapsulating the PintSwap p2p stack, protocol definitions, and associated cryptography routines. Embedded within the pintswap-daemon processes as well as the PintSwap web frontend.
Last updated
To add the SDK to your project, use the command:
The minimal requirement for a Pintswap instance to be instantiated is a signer object which conforms to the ethers.Signer
interface. If the Pintswap.initialize
method is used to construct a Pintswap instance, a PeerId will be generated randomly.
It is also possible to instantiate a Pintswap instance with a deterministically generated PeerId, using the provided signer object and a salt phrase. The signer provided via a call to Pintswap.fromPassword({ signer, password })
will be used to sign a message of the following structure:
The third line of this message is computed as:
Where your-password
is the password supplied to the function.
Note that a PeerId cannot be shared between two actively running peers on the network. The PeerId is integral to the way libp2p routes webRTC traffic, but it is also used as your identity on PintSwap.
It is required to explicitly start and stop the PintSwap connection to the p2p network using the following:
Starts P2P network connection.
Stops P2P connectivity associated with the PintSwap instance.