SecretUri class
A secret uri (SURI
) that can be used to generate a key pair.
The SURI
can be parsed from a string. The string is interpreted in the following way:
- If
string
is a possibly0x
prefixed 64-digit hex string, then it will be interpreted directly as aMiniSecretKey
(aka "seed" insubkey
). - If
string
is a valid BIP-39 key phrase of 12, 15, 18, 21 or 24 words, then the key will be derived from it. In this case:- the phrase may be followed by one or more items delimited by
/
characters. - the path may be followed by
///
, in which case everything after the///
is treated as a password.
- the phrase may be followed by one or more items delimited by
- If
string
begins with a/
character it is prefixed with the Substrate publicDEV_PHRASE
and interpreted as above.
In this case they are interpreted as HDKD junctions; purely numeric items are interpreted as
integers, non-numeric items as strings. Junctions prefixed with /
are interpreted as soft
junctions, and with //
as hard junctions.
There is no correspondence mapping between SURI
strings and the keys they represent.
Two different non-identical strings can actually lead to the same secret being derived.
Notably, integer junction indices may be legally prefixed with arbitrary number of zeros.
Similarly an empty password (ending the SURI
with ///
) is perfectly valid and will
generally be equivalent to no password at all.
Constructors
-
SecretUri(String phrase, String? password, List<
DeriveJunction> junctions) - SecretUri.fromStr(String str)
-
factory
Properties
- hashCode → int
-
The hash code for this object.
no setteroverride
-
junctions
→ List<
DeriveJunction> -
The junctions as part of the uri.
final
- password → String?
-
Optional password as given as part of the uri.
final
- phrase → String
-
The phrase to derive the private key.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override