Пример #1
0
 public static ApiAuth Generate()
 {
     using (var cryptoProvider = new RNGCryptoServiceProvider())
     {
         byte[] btSecret = new byte[32];
         cryptoProvider.GetBytes(btSecret);
         var apiSecretKey = Convert.ToBase64String(btSecret);
         var apiId        = Guid.NewGuid().ToString("N");
         var auth         = new ApiAuth()
         {
             AppId     = apiId,
             AppSecret = apiSecretKey
         };
         return(auth);
     }
 }
Пример #2
0
 public Organization()
 {
     Members = new HashSet <User>();
     ApiKey  = ApiAuth.Generate();
 }