Skip to content

Commit

Permalink
Add Identity Visual Representation
Browse files Browse the repository at this point in the history
  • Loading branch information
osmaczko committed Feb 16, 2022
1 parent a39e718 commit 575c4b6
Showing 1 changed file with 65 additions and 0 deletions.
65 changes: 65 additions & 0 deletions docs/spec/2-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ This specification explains what Status account is, and how a node establishes t
- [De/Serialization Process Flow](#deserialization-process-flow)
- [Serialization Example](#serialization-example)
- [Deserialization Example](#deserialization-example)
- [Identity Visual Representation](#visual-identity-representation)
- [Emoji Hash](#emoji-hash)
- [Identicon Ring](#identicon-ring)
- [Security Considerations](#security-considerations)
- [Changelog](#changelog)
- [Version 0.3](#version-03)
Expand Down Expand Up @@ -416,6 +419,68 @@ For the user, the deserialization process is exactly the same as serialization w

For further guidance on the implementation of public key de/serialization consult the [`status-go` implementation and tests](https://github.com/status-im/status-go/blob/c9772325f2dca76b3504191c53313663ca2efbe5/api/utils_test.go).

## Identity Visual Representation
Identity Visual Representation is a mechanism to minimize the risk of impersonation attacks. It is composed of two elements (Emoji Hash and Color Hash) that together deterministically reflect the [User's Chat Public Key](#publicprivate-keypairs). The client app MAY use it as an enhancement to profile/identity representation in the user interface.

Each of the two components MUST encode corresponding parts of the Compressed Chat Public Key.

Comporessed secp256k1 pk:
|prefix |x coord |
|-------------|----------|
|0x02 or 0x03 | 32 bytes |

```text
0x03 (prefix)
086138b210f21d41c757ae8a5d2a4cb29c1350f7389517608378ebd9efcf4a55 (x coord)
```

Identity Visual Representation mapping:
|Emoji Hash|Color Hash|
|----------|----------|
|0x02 or 0x03 + 16 bytes (first half of x coord) | 16 bytes (second half of x coord) |

```text
03086138b210f21d41c757ae8a5d2a4cb2 (17 bytes encoded as Emoji Hash)
9c1350f7389517608378ebd9efcf4a55 (16 bytes encoded as Color Hash)
```

### Emoji Hash
Emoji Hash is a deterministic sequence of emojis that (in conjunction with Color Hash) uniquely identifies a profile. It encodes the first 17 bytes of data from the Compressed Chat Public Key.

- Emoji Hash MUST be a sequence of `len` distinctive emojis
- Emoji Hash MUST be one of `n` distinctive emojis
- emojis set of length `n` used for Emoji Hash MUST be immutable

Emoji Hash to be collision resistant MUST fulfill given equasion: $\frac{n!}{(n-len)!} \geq 2^{(17*8)}$

Sample values:
|len|n |
|---|--------|
|12 | >= 2586|
|14 | >= 847 |
|16 | >= 264 |

### Color Hash
Color Hash is a deterministic sequence of colors that (in conjunction with Emoji Hash) uniquely identifies a profile. It encodes the last 16 bytes of data from the Compressed Chat Public Key.

- Color Hash MUST be exactly `u` units length (unit represents physical entity with color assigned, e.g. pixel)
- Color Hash unit MUST be one of `c` distinctive colors
- `c` distictive colors set used for Color Hash MUST be immutable
- Color Hash MUST be composed of `s` color segments
- Color Hash segment MUST be composed by units of the same color
- Color Hash segment MAY be of different length
- Color Hash MUST NOT contain same color segments

Color Hash to be collision resistant MUST fulfill given equastion: $\frac{(u-1)!}{(s-1)!(u-s)!} \times \frac{c!}{(c-s)!} \geq 2^{(16*8)}$

Sample values:
|u |s |c |
|----|----|-------|
|64 | 12 | >= 175|
|64 | 16 | >= 42 |
|128 | 14 | >= 40 |
|256 | 12 | >= 50 |

## Security Considerations

-
Expand Down

0 comments on commit 575c4b6

Please sign in to comment.