Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPEC] Keyring #451

Open
frankiebee opened this issue Jan 10, 2025 · 5 comments
Open

[SPEC] Keyring #451

frankiebee opened this issue Jan 10, 2025 · 5 comments
Milestone

Comments

@frankiebee
Copy link
Contributor

frankiebee commented Jan 10, 2025

@entropyxyz/sdk/keys

The purpose of the keyring is to create functional signers for the keyData provided

example from app perspective:

import  Keyring, { generateMnemonic, mnemonicToKeyData } from `@entropyxyz/keyring`

// 1. create (and write down) mnemonic
const mnemonic = generateMnemonic()

// 2. use mnemonic to generate keyData
const keyData = mnemonicToKeyData(mnemonic)

// 3. instantiate keyring
const keyring = new Keyring(keyData)

// 4. export keyData + persist
const keyData = keyring.json()
/*
    {
      programMod: { type, secret },
      developer: { type, secret },
      device: { type, secret }
    } 
*/
await writeKeyData(keyData) // some function

types

export interface KeyPairJson {
type: 'sr25519' | 'ed25519'
private: string
public: string
}


export interface KeyData {
programMod: KeyPairJson
deviceKey?: KeyPairJson
developer?: KeyPairJson
[key: string]?: KeyPairJson

}

// signer is polkadot signer

methods

Instance Methods

  • new Keyring(keyData: Keydata) => keyring
  • keyring.json() => KeyData
  • keyring[context].signer => Signer
  • keyring. creatEephemeralSigner() => Signer

Class Methods

  • Keyring.createSigner(pair: KeyPairJson) => Signer

notes

should take all "3" seeds but only requires programMod i'm still stuck on this name i'd prefer not to call it it the program mod sense it's not that till we register it

are curent way of thinking is to have an admin key and registration key
the key that pays for registartion and the key that gets set as the programMod

they can be one in the same (infact they are right now)
however they can also be different. In my personal case i would want them to be different

i think also for "sponsorship" reason we should allow them to be different

Open questions:

  • should you be able to set a different keyring to an already initialized entropy?
entropy.setKeyring(Keyring)
@frankiebee frankiebee added this to the Keyring milestone Jan 10, 2025
@frankiebee frankiebee self-assigned this Jan 10, 2025
@frankiebee
Copy link
Contributor Author

all the "known" keys we "need"

registration:

  • a funded key to pay for the cost of registration (???)
  • a program modification key (admin) to modify the program list register to the verifying key (can be cold at the time of registration but required to change programs and configs)
  • the device key (if registered with the default program)

signing:

  • an ephemeral key for encryption of the message to the validators (no persistance)
  • the device key for local signature if the default program is registered (local only)

program deployment:

  • a funding key

registered accounts program modification

  • the admin key/ program mod key at time of registration

@frankiebee
Copy link
Contributor Author

possible api alterations to be made in the entropy class (future issue?):
the last argument of methods that submit extrinsic's are optional signers

@frankiebee
Copy link
Contributor Author

frankiebee commented Jan 14, 2025

the last argument of methods that submit extrinsic's are optional signers

if done this way we can make keyring optional on initialization

@frankiebee
Copy link
Contributor Author

frankiebee commented Jan 14, 2025

@mixmix and i did some thinking around the example code here are the "notes" from that

@frankiebee
Copy link
Contributor Author

frankiebee commented Jan 15, 2025

live notes for/from mix https://hackmd.io/@esjFsrEDTMahtSwNs1zZHA/SJYA3SVwJg

@frankiebee frankiebee changed the title [DRAFT] Keyring spec [SPEC] Keyring Jan 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant