public static Identity Open(string name, string password) { if (name == null) throw new ArgumentNullException("name"); if (password == null) throw new ArgumentNullException("password"); var id = new Identity(name, password); id.LoadIdentity(); return id; }
public static Identity CreateNew(string name, string password, byte[] entropy) { if (name == null) throw new ArgumentNullException("name"); if (password == null) throw new ArgumentNullException("password"); if (entropy == null) throw new ArgumentNullException("entropy"); var id= new Identity(name, password); id.GenerateMasterKey(entropy); return id; }
private void CreateIdentity(string password = null) { if (password == null) { password = GetIdentityPassword(); } if (password == null) return; var random = new Random(); var entropy = new byte[64]; random.NextBytes(entropy); _identity = Identity.CreateNew("Identity", password, entropy); }
private void LoadIdentity() { if (_identity != null) return; string password = GetIdentityPassword(); if (password != null) { try { _identity = Identity.Open("Identity", password); } catch (SqrlIdentityNotFoundException) { CreateIdentity(password); } } }
public SqrlClient(Identity identity) { if (identity == null) throw new ArgumentNullException("identity"); _identity = identity; }