An easy to use javascript library for interacting with HaLo chips
npm i halo-chip
import { listKeys, ethSignMessage } from `halo-chip`
const keys = await listKeys()
console.log('keys:')
keys.map(k => console.log)
const address = keys[0].address
const signature = await ethSignMessage('test123', 1, address)
console.log('signature:', signature)
import { DIDSession } from 'did-session'
import { EthereumWebAuth, getAccountId } from '@didtools/pkh-ethereum'
const keys = await listKeys()
const { address, slot } = keys[0]
const accountId = { address: address.toLowerCase(), chainId: { reference: 1, namespace: 'eip155' } }
const authMethod = await EthereumWebAuth.getAuthMethod({
request: async ({ method, params }) => ethSignMessage(params[0], slot, params[1])
}, accountId)
const session = await DIDSession.authorize(authMethod, { resources: ['ceramic:https://*?model=kjz...'] })
import { parseURLParams } from `halo-chip`
const params = `?v=c3&static=4104FAC52DEA1D02FC0F1473B832B88F15DC9CEFBFEE690C3C9B8FECF8045B2A06166119F5C539E9FF418A58DA95ED057DB17E76E9B57531025BEFE4B45EB0DF07634104422738D17192382F19482649E07022615930C3C1CB29A51CFE23D62445CDB8729A40DE69A79697F3704C7D684365846CF6DB974E33E47998BDB2DAB1131D330E000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&latch1=E5D961F8DAD5F030F57E88E72AAD26492D722AFB5CC84256DCA2BA6362BEBF51&latch2=0000000000000000000000000000000000000000000000000000000000000000&cmd=81020000001B8F48E0B1A3B19C5DF8D763717A7BE27475FA6AF0E34F8449704C3A8B00&res=3046022100D5871CDE09C5AB891F4D023EC278DF8F1CE5B6970F478C825D812C946F15593B022100EA326B2683E212F34CF87C051CF0BA00BCD1530B72FE8D8754584F480C38ED3400000000`
const parsed = parseURLParams(params)
console.log(parsed)
List the keys of the device
object[]
- The list of keysobject[].key
- The public keyobject[].slot
- Slot number of the keyobject[].address
- Ethereum address of the keyobject[].did
- PKH DID of the key
Sign a message using EIP191.
message
:string
- The message to signslot
:number
- The slot index of the key to useaddress
:string
- The the ethereum address of the key used
string
- The signature encoded as a hex string
Sign a hash and return a recoverable signature.
hash
:string
- The hex encoded hash to signslot
:number
- The slot index of the key to useaddress
:string
- The the ethereum address of the key used
string
- The signature encoded as a hex string
Sign a hash