Example #1
0
 private async Task <IKeyStore> CreateKeyStore(string accessToken)
 {
     return(await KeyStoreFactory.CreateVaultStore(new VaultStoreConfig
     {
         Url = "https://stage-vault.delegatecall.com/v1/",
         VaultPrefix = "unity3d-sdk",
         AccessToken = accessToken
     }));
 }
Example #2
0
    public async void SignIn()
    {
        try
        {
            CertValidationBypass.Enable();
            var authClient = AuthClientFactory.Configure()
                             .WithLogger(Debug.unityLogger)
                             .WithClientId("25pDQvX4O5j7wgwT052Sh3UzXVR9X6Ud") // unity3d sdk
                             .WithDomain("loomx.auth0.com")
                             .WithScheme("io.loomx.unity3d")
                             .WithAudience("https://keystore.loomx.io/")
                             .WithScope("openid profile email picture")
                             .WithRedirectUrl("http://127.0.0.1:9999/auth/auth0/")
                             .Create();
            var accessToken = await authClient.GetAccessTokenAsync();

            var keyStore = await KeyStoreFactory.CreateVaultStore(new VaultStoreConfig
            {
                Url         = "https://stage-vault.delegatecall.com/v1/",
                VaultPrefix = "unity3d-sdk",
                AccessToken = accessToken
            });

            this.identity = await authClient.GetIdentityAsync(accessToken, keyStore);
        }
        finally
        {
            CertValidationBypass.Disable();
        }
        this.statusTextRef.text = "Signed in as " + this.identity.Username;

        // This DAppChain client will connect to the example REST server in the Loom Go SDK.
        this.chainClient = new DAppChainClient("http://localhost", 46657, 47000)
        {
            Logger = Debug.unityLogger
        };
        this.chainClient.TxMiddleware = new TxMiddleware(new ITxMiddlewareHandler[] {
            new NonceTxMiddleware {
                PublicKey = this.identity.PublicKey,
                Client    = this.chainClient
            },
            new SignedTxMiddleware(this.identity.PrivateKey)
        });
        this.callerAddr = this.identity.ToAddress("default");
    }
Example #3
0
 /// <summary>
 /// Extracts the trusted key store for generating bank authorization payload
 /// for account linking
 /// </summary>
 /// <returns>TrustedKeyStore</returns>
 public ITrustedKeyStore TrustedKeyStore()
 {
     return(KeyStoreFactory.CreateTrustedKeyStore(
                config.GetSection("account-linking:trusted-key-store").GetChildren().ToList()));
 }
Example #4
0
 /// <summary>
 /// Extracts the secret key store for generating bank authorization payload
 /// for account linking.
 /// </summary>
 /// <returns>SecretKeyStore</returns>
 public ISecretKeyStore SecretKeyStore()
 {
     return(KeyStoreFactory.CreateSecretKeyStore(
                config.GetSection("account-linking:secret-key-store").GetChildren().ToList()));
 }