Is this true?

A safe walletURL is of the form safe://+exactly 70 lowercase alphanumeric chars

A public key is always exactly 97 hex chars long

Can someone confirm/deny and for bonus points, give me a hint where to look in the source, please?

2 Likes

for i in {0..100}; do safe wallet create --dry-run; done

example output:

safe://hyryynysshc1kiwed9w48pcibnwf3esjwr4o5e3fggn3qpf9kjm1ztmqk5eb6o

All wallets are 69 chars, 62 chars when safe:// is excluded

An xorname will always be 64 hex chars, ie 32 bytes, ie 256 bits. Even with leading or trailing 0s there will never be truncation. But the tricky part is converting an xorname to an xorurl depends on what other metadata is encoded into the xorurl, eg type_tag and content_type.

A bls public public key is always 96 hex chars, ie 48 bytes, ie 384 bits. In sn_dbc (which is what a wallet uses) the public key is a bls public key.

But again, converting this to an xorurl depends on what other metadata is included with it.

A wallet is a multimap, see wallet.rs L66

A multimap is a register, see multimap.rs L32

The register is converted to a safeurl, see register.rs L46 and safeurl/mod.rs L545

The creation of safeurl is pretty complex with lots of conditionals so I didn’t go any further than this in the code.

18 Likes

So basically you are saying I can’t count ? :rofl: :rofl: :rofl: :rofl:

Seriously, thank you for the explanation :+1: