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 May 4, 2022
1 parent a39e718 commit b672345
Showing 1 changed file with 82 additions and 0 deletions.
82 changes: 82 additions & 0 deletions docs/spec/2-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ 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](#identity-visual-representation)
- [Chars Cutoff](#chars-cutoff)
- [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 +420,84 @@ 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 three elements (Chars Cutoff, 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 three 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:
|Chars Cutoff |Emoji Hash |Color Hash | Chars Cutoff |
|-------------|-----------|-----------|--------------|
| 1.5 bytes | 20 bytes | 10 bytes | 1.5 bytes |

```text
030 (Chars Cutoff)
86138b210f21d41c757ae8a5d2a4cb29c1350f73 (Emoji Hash)
89517608378ebd9efcf4 (Color Hash)
a55 (Chars Cutoff)
```

### Chars Cutoff
Chars Cutoff is a sequence of first and last 3 charactes of Compressed Chat Public Key.
- Chars Cutoff MUST encode at least 3 bytes of data from the Compressed Chat Public Key, it implies at least `base16` representation of pk

Example:
```
0x030...a55
```

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

- Emoji Hash MUST be a sequence of `len` 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 equation: <img src="https://render.githubusercontent.com/render/math?math=n^{len} \geq 2^{(20 \times 8)}">

Recommended values:
|len|n |
|---|---------|
|14 | 2757 |

Example:
```
๐Ÿง โญ•๐Ÿ˜€๐Ÿค”๐Ÿฅต๐Ÿฅณ๐Ÿ˜ฎ๐Ÿ™ˆ๐Ÿ™Š๐Ÿ’ฏ๐Ÿ’ฆ๐ŸคŒ๐Ÿง ๐ŸŠ
```
Reference implementation: https://github.com/status-im/status-go/tree/develop/protocol/identity/emojihash

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

- Color Hash MUST be at max `s` segments long
- Color Hash segment must be one of `c` distinctive colors
- `c` distictive colors set used for Color Hash MUST be immutable
- Color Hash segment MAY be of differet lengths and MUST be composed of 1 to `u` units (unit represents physical entity with color assigned, e.g. pixel)
- Color Hash MAY contain non-consecutive same color segments

Color Hash to be collision resistant MUST fulfill given equation: <img src="https://render.githubusercontent.com/render/math?math=(u \times c)^{s} \geq 2^{(10 \times 8)}">

Recommended values:
|c |u |s |
|----|----|-------|
|32 | 5 | 11 |

Example:
```
๐ŸŸฅ๐ŸŸฅ๐ŸŸฅ๐ŸŸฅ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸจ๐ŸŸฅ๐ŸŸฉ๐ŸŸฉโฌ›โฌ›โฌ›โฌ›๐ŸŸช๐ŸŸช๐ŸŸซ๐ŸŸซ๐ŸŸซ๐ŸŸซ๐ŸŸง๐ŸŸฅ๐ŸŸฅ๐ŸŸฅ๐ŸŸฅ๐ŸŸฉ๐ŸŸฉ๐ŸŸช
```
Reference implementation: https://github.com/status-im/status-go/tree/develop/protocol/identity/colorhash

## Security Considerations

-
Expand Down

0 comments on commit b672345

Please sign in to comment.