Key
A public key that can be associated with a Dango account. Discriminated by key family.
Definition
type Key =
| { secp256k1: Base64 } // compressed pubkey
| { ethereum: Address } // EOA address
| { secp256r1: Base64 } // compressed pubkey
const KeyTag = {
secp256r1: 0,
secp256k1: 1,
ethereum: 2,
} as constConstruction
import type { Key } from "@left-curve/sdk"
const k1: Key = { secp256k1: "Ahw5..." }
const eth: Key = { ethereum: "0x1234567890abcdef1234567890abcdef12345678" }
const r1: Key = { secp256r1: "BJw5..." }Notes
- Use the
inoperator or check the present field to narrow:if ("secp256k1" in key) { /* ... */ } KeyTagis the discriminant value the chain uses when packing a key into a salt — seecreateAccountSalt.