diff --git a/ecosystem/sep-0023.md b/ecosystem/sep-0023.md index 25af5745d..234e53469 100644 --- a/ecosystem/sep-0023.md +++ b/ecosystem/sep-0023.md @@ -3,10 +3,12 @@ ``` SEP: 0023 Title: Augmented strkey format for multiplexed accounts -Author: David Mazières and Tomer Weller +Author: David Mazières, Tomer Weller <@tomerweller>, Leigh McCulloch <@leighmcculloch>, Alfonso Acosta <@2opremio> Track: Standard Status: Draft Created: 2019-09-16 +Updated: 2021-03-25 +Version: 0.0.2 Discussion: https://groups.google.com/forum/#!forum/stellar-dev ``` @@ -75,10 +77,10 @@ The following steps transform a binary key into a strkey: 1. Start with the appropriate version byte computed by the OR of a key type base value and algorithm selector from the tables above. -2. If we are encoding a multiplexed address, append an 8-byte memo ID - in network byte order (most significant byte first). +2. Append the binary bytes of the key (e.g., 32-bytes for ED25519). -3. Append the binary bytes of the key (e.g., 32-bytes for ED25519). +3. If we are encoding a multiplexed address, append an 8-byte memo ID + in network byte order (most significant byte first). 4. Compute a 16-bit CRC16 checksum of the combined version byte, optional memo ID, and binary key (using polynomial @@ -119,12 +121,12 @@ accounts in a backwards-compatible way: - Base field name + `_muxed_id` is the integer. For example, given the MuxedAccount - `MAAAAAAAAAAAJURAAB2X52XFQP6FBXLGT6LWOOWMEXWHEWBDVRZ7V5WH34Y22MPFBHUHY`, + `MAQAA5L65LSYH7CQ3VTJ7F3HHLGCL3DSLAR2Y47263D56MNNGHSQSAAAAAAAAAAE2LP26`, you might get the following fields: ~~~ source_account: GAQAA5L65LSYH7CQ3VTJ7F3HHLGCL3DSLAR2Y47263D56MNNGHSQSTVY - source_account_muxed: MAAAAAAAAAAAJURAAB2X52XFQP6FBXLGT6LWOOWMEXWHEWBDVRZ7V5WH34Y22MPFBHUHY + source_account_muxed: MAQAA5L65LSYH7CQ3VTJ7F3HHLGCL3DSLAR2Y47263D56MNNGHSQSAAAAAAAAAAE2LP26 source_account_muxed_id: 1234 ~~~~ @@ -169,7 +171,7 @@ test cases, which could in turn cause security problems. 1. Valid multiplexed account - - Strkey: `MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6` + - Strkey: `MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAAACJUQ` - type: `KEY_TYPE_MUXED_ED25519` - id: 0 - ed25519: `GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ` @@ -188,7 +190,7 @@ test cases, which could in turn cause security problems. 1. Valid multiplexed account in which unsigned id exceeds maximum signed 64-bit integer - - Strkey: `MCAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITKNOG` + - Strkey: `MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVAAAAAAAAAAAAAJLK` - type: `KEY_TYPE_MUXED_ED25519` - id: 9223372036854775808 - ed25519: `GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZ` @@ -212,7 +214,7 @@ test cases, which could in turn cause security problems. 1. The unused trailing bit must be zero in the encoding of the last three bytes (24 bits) as five base-32 symbols (25 bits) - - Strkey: `MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL7` + - Strkey: `MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAAACJUR` 1. Invalid length (congruent to 1 mod 8) - Strkey: `GA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVSGZA` @@ -224,20 +226,20 @@ test cases, which could in turn cause security problems. - Strkey: `G47QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVP2I` 1. Invalid length (congruent to 6 mod 8) - - Strkey: `MCAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITKNOGA` + - Strkey: `MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVAAAAAAAAAAAAAJLKA` 1. Invalid length (base-32 decoding should yield 43 bytes, not 44) - - Strkey: `MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITIADJPA` + - Strkey: `MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJVAAAAAAAAAAAAAAV75I` 1. Invalid algorithm (low 3 bits of version byte are 7) - - Strkey: `M4AAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITIU2K` + - Strkey: `M47QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAAACJUQ` 1. Padding bytes are not allowed - - Strkey: `MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL6===` + - Strkey: `MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAAACJUK===` 1. Invalid checksum - Strkey: - `MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL4` + `MA7QYNF7SOWQ3GLR2BGMZEHXAVIRZA4KVWLTJJFC7MGXUA74P7UJUAAAAAAAAAAAACJUO` You can paste these invalid strkeys more conveniently into a unit test using the following array: @@ -245,15 +247,15 @@ using the following array: ~~~ {.c} { "GAAAAAAAACGC6", - "MAAAAAAAAAAAAAB7BQ2L7E5NBWMXDUCMZSIPOBKRDSBYVLMXGSSKF6YNPIB7Y77ITLVL7", + "MA7QYNF7SOWQ3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