open-index/open-npm huggingface dataset:
npm package: @highkey-dev/sdk
Description: <div align="center"> <a href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://avatars.githubusercontent.com/u/119080471?s=400&u=c2e2fa0033716043dac2fb6e683f9c5eba79a3db&v=4" width="100" height=100></a> </div>
Latest version: 0.0.7-beta

# SDK

<div align="center">
<a href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://avatars.githubusercontent.com/u/119080471?s=400&u=c2e2fa0033716043dac2fb6e683f9c5eba79a3db&v=4" width="100" height=100></a>
</div>

Highkey is a frictionless way to onboard users into Web3—no seed phrases and no browser extensions! 
With the Highkey SDK, your users will be equipped with a decentralized, MPC-based, cross-chain wallet with just the touch of a finger, which they can use across all of Web3.


Currently supports the following chain types
- EVM 

**NOTE** Currently the SDK is in beta, do not use for sensitive data / assets.
**NOTE** Backwards compatibility will not be guaranteed until after beta releases. 
## Quick Start
### `Registration` session
```javascript

const registrar = await WalletRegistrar.fromOptions(options)
​
// create a wallet creation session for signing up users
if (!await registrar.startRegisterSession()) {
    throw new Error("failed to start session")
}
​
// add callback
registrar.registerSession.onDeviceAdded = (guid: string, deviceName: string, credential: any) => {
    // use this device info to update your UI or state
    myState.devices.push({ guid, deviceName, credential })
}
​
// add a credential for the current device to the session
await registrar.registerSession.addCurrentDevice()
​
// closes the session and creates the wallet
const { wallet } = await registrar.registerSession.createWallet()

```

### Get a `Wallet`
```javascript

// get all wallets for an account
const wallets: Wallet[] = await resolveWalletsForAccount("<acct-name>")
​
// find a wallet with a particular eth address
const wallet = wallets.find((w) => w.getAddress() === "0xsomething")
```

### Authenticate a `Wallet`

``` javascript
// Create a login session
if (!await wallet.startLoginSession()) {
    throw new Error("failed to start session")
}

// Add callback for when signatures are added
wallet.loginSession.onSignatureAdded = (deviceId: string, signature: any) => {
    // use this info to update your UI or state
    myState.signatures.push({ deviceId, signature })
}

wallet.loginSession.onSignaturesReady = (signatures: DeviceSignature[]) => {
    // use this to know when the wallet is ready to sign
    const signedTxn = await wallet.signTransaction({ /* any txn */ })
    const result = await wallet.sendTransaction(signedTxn)
}

// create a signature for the credential stored on the host device
await wallet.loginSession.addCurrentDevice()
```

## Sign and send transactions
``` javascript
const signedTxn = await wallet.signTransaction({ /* any txn */ })
const result = await wallet.sendTransaction(signedTxn)
```