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

[account] Fix Multikey authentication key docs #583

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 15 additions & 6 deletions apps/nextra/pages/en/network/blockchain/accounts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,17 @@ To generate a K-of-N multisig account's authentication key and the account addre

### Generalized authentication

Generalized authentication supports both Ed25519 and Secp256k1 ECDSA. Like the previous authentication schemes, these schemes contain a scheme value, `0x02` and `0x03` for single and multikey respectively, but also each key contains a prefix value to indicate its key type:

- **1-byte Ed25519 generalized scheme**: `0x00`,
- **1-byte Secp256k1 ECDSA generalized scheme**: `0x01`.
Generalized authentication supports both Ed25519 and Secp256k1 ECDSA. Like the
previous authentication schemes, these schemes contain a scheme value, `0x02`
and `0x03` for single and multikey respectively, but also each key contains a
prefix value to indicate its key type:

| Key type | Prefix byte |
|-----------------------------------|-------------|
| Ed25519 generalized scheme | `0x00` |
| Secp256k1Ecdsa generalized scheme | `0x01` |
| Secp256r1Ecdsa WebAuthn scheme | `0x02` |
| Keyless | `0x03` |

For a single key Secp256k1 ECDSA account, using public key `pubkey`, the authentication key would be derived as follows:

Expand All @@ -116,10 +123,12 @@ Where
- the first entry, `0x01`, represents the use of a Secp256k1 ECDSA key;
- the last entry, `0x02`, represents the authentication scheme.

For a multi-key account containing, a single Secp256k1 ECDSA public key, `pubkey_0`, and a single Ed25519 public key, `pubkey_1`, where one signature suffices, the authentication key would be derived as follows:
For a 1-of-2 multi-key account containing, a single Secp256k1 ECDSA public key, `pubkey_0`,
and a single Ed25519 public key, `pubkey_1`, where one signature suffices, the
authentication key would be derived as follows:

```text
auth_key = sha3-256(0x02 | 0x01 | pubkey_0 | 0x02 | pubkey_2 | 0x01 | 0x03)
auth_key = sha3-256(0x02 | 0x01 | pubkey_0 | 0x00 | pubkey_1 | 0x01 | 0x03)
```

Where
Expand Down
Loading