text:
# IO.Swagger - the C# library for the Coinsecure Api Documentation

To generate an API key, please visit https://coinsecure.in/api.
Guidelines for use can be accessed at https://api.coinsecure.in/v1/guidelines.
Programming Language Libraries for use can be accessed at https://api.coinsecure.in/v1/code-libraries.

This C# SDK is automatically generated by the [Swagger Codegen](https://github.com/swagger-api/swagger-codegen) project:

- API version: beta
- SDK version: 1.0.0
- Build package: class io.swagger.codegen.languages.CSharpClientCodegen

## Frameworks supported
- .NET 4.0 or later
- Windows Phone 7.1 (Mango)

## Dependencies
- [RestSharp](https://www.nuget.org/packages/RestSharp) - 105.1.0 or later
- [Json.NET](https://www.nuget.org/packages/Newtonsoft.Json/) - 7.0.0 or later

The DLLs included in the package may not be the latest version. We recommned using [NuGet] (https://docs.nuget.org/consume/installing-nuget) to obtain the latest version of the packages:
```
Install-Package RestSharp
Install-Package Newtonsoft.Json
```

NOTE: RestSharp versions greater than 105.1.0 have a bug which causes file uploads to fail. See [RestSharp#742](https://github.com/restsharp/RestSharp/issues/742)

## Installation
Run the following command to generate the DLL
- [Mac/Linux] `/bin/sh build.sh`
- [Windows] `build.bat`

Then include the DLL (under the `bin` folder) in the C# project, and use the namespaces:
```csharp
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;
```

## Getting Started

```csharp
using System;
using System.Diagnostics;
using IO.Swagger.Api;
using IO.Swagger.Client;
using IO.Swagger.Model;

namespace Example
{
    public class Example
    {
        public void main()
        {

            var apiInstance = new AccountActionsApi();
            var body = new LoginFormNew(); // LoginFormNew | Please send the form with valid inputs.
            var accept = accept_example;  // string | JSON, XML or CSV can be returned (Optional) (optional)

            try
            {
                // Creates a Login Instance and returns an API Key.
                StandardLoginResultData result = apiInstance.V1login(body, accept);
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("Exception when calling AccountActionsApi.V1login: " + e.Message );
            }
        }
    }
}
```

## Documentation for API Endpoints

All URIs are relative to *https://api.coinsecure.in/*

Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AccountActionsApi* | [**V1login**](docs/AccountActionsApi.md#v1login) | **POST** /v1/login | Creates a Login Instance and returns an API Key.
*AccountActionsApi* | [**V1logininitiate**](docs/AccountActionsApi.md#v1logininitiate) | **POST** /v1/login/initiate | Initiate Login
*AccountActionsApi* | [**V1loginpasswordforgot**](docs/AccountActionsApi.md#v1loginpasswordforgot) | **POST** /v1/login/password/forgot | Sends an email with a password reset token
*AccountActionsApi* | [**V1signup**](docs/AccountActionsApi.md#v1signup) | **POST** /v1/signup | Creates a new Unverified Account.
*AccountActionsApi* | [**V1signupverifyToken**](docs/AccountActionsApi.md#v1signupverifytoken) | **PUT** /v1/signup/verify/{token} | Verifies an Email token for Signup .
*AccountActionsApi* | [**V1userbankotpNumber**](docs/AccountActionsApi.md#v1userbankotpnumber) | **GET** /v1/user/bank/otp/{number} | Send OTP for Bank Link
*AccountActionsApi* | [**V1userexchangekyc**](docs/AccountActionsApi.md#v1userexchangekyc) | **PUT** /v1/user/exchange/kyc | Submits a New Bank Link and initial KYC Documents.
*AccountActionsApi* | [**V1usergcmCode**](docs/AccountActionsApi.md#v1usergcmcode) | **DELETE** /v1/user/gcm/{code} | Delete GCM Code
*AccountActionsApi* | [**V1userkycotpNumber**](docs/AccountActionsApi.md#v1userkycotpnumber) | **GET** /v1/user/kyc/otp/{number} | Send OTP for KYC Link
*AccountActionsApi* | [**V1userlogout**](docs/AccountActionsApi.md#v1userlogout) | **DELETE** /v1/user/logout | Logout User
*AccountActionsApi* | [**V1usernetkicreate**](docs/AccountActionsApi.md#v1usernetkicreate) | **PUT** /v1/user/netki/create | Create Neki Wallet Name
*AccountActionsApi* | [**V1usernetkiupdate**](docs/AccountActionsApi.md#v1usernetkiupdate) | **POST** /v1/user/netki/update | Update Netki Address
*AccountActionsApi* | [**V1userprofileimagedeleteNetkiName**](docs/AccountActionsApi.md#v1userprofileimagedeletenetkiname) | **DELETE** /v1/user/profile/image/delete/{netkiName} | Delete Profile Image
*AccountActionsApi* | [**V1userprofileimageupdate**](docs/AccountActionsApi.md#v1userprofileimageupdate) | **POST** /v1/user/profile/image/update | Update Profile Image
*AccountActionsApi* | [**V1userprofilephone**](docs/AccountActionsApi.md#v1userprofilephone) | **PUT** /v1/user/profile/phone/new | New Profile Phone
*AccountActionsApi* | [**V1userprofilephoneNumber**](docs/AccountActionsApi.md#v1userprofilephonenumber) | **DELETE** /v1/user/profile/phone/delete | Delete Profile Phone Number
*AccountActionsApi* | [**V1userprofilephoneotpNumber**](docs/AccountActionsApi.md#v1userprofilephoneotpnumber) | **GET** /v1/user/profile/phone/otp/{number} | Send OTP for Profile Phone
*AccountDataApi* | [**V1exchangebanksummary**](docs/AccountDataApi.md#v1exchangebanksummary) | **GET** /v1/user/exchange/bank/summary | Exchange Bank Summary
*AccountDataApi* | [**V1exchangeusercoinfee**](docs/AccountDataApi.md#v1exchangeusercoinfee) | **GET** /v1/user/exchange/coin/fee | Users Coin Fee Percentage
*AccountDataApi* | [**V1exchangeuserfiatfee**](docs/AccountDataApi.md#v1exchangeuserfiatfee) | **GET** /v1/user/exchange/fiat/fee | Users Fiat Fee Percentage
*AccountDataApi* | [**V1netkisearchNetkiName**](docs/AccountDataApi.md#v1netkisearchnetkiname) | **GET** /v1/netki/search/{netkiName} | Coinsecure.me Netki Lookup
*AccountDataApi* | [**V1userexchangekycs**](docs/AccountDataApi.md#v1userexchangekycs) | **GET** /v1/user/exchange/kycs | Gets KYC Status Details
*AccountDataApi* | [**V1userexchangereferralcoinpaid**](docs/AccountDataApi.md#v1userexchangereferralcoinpaid) | **GET** /v1/user/exchange/referral/coin/paid | Users Paid Fiat Referrals
*AccountDataApi* | [**V1userexchangereferralcoinsuccessful**](docs/AccountDataApi.md#v1userexchangereferralcoinsuccessful) | **GET** /v1/user/exchange/referral/coin/successful | Gets Users Successful Referral Links
*AccountDataApi* | [**V1userexchangereferralfiatpaid**](docs/AccountDataApi.md#v1userexchangereferralfiatpaid) | **GET** /v1/user/exchange/referral/fiat/paid | Users Paid Fiat Referrals
*AccountDataApi* | [**V1userexchangereferrals**](docs/AccountDataApi.md#v1userexchangereferrals) | **GET** /v1/user/exchange/referrals | Gets Users Referral Links
*AccountDataApi* | [**V1userexchangetradesummary**](docs/AccountDataApi.md#v1userexchangetradesummary) | **GET** /v1/user/exchange/trade/summary | Exchange Trade Summary
*AccountDataApi* | [**V1userlogintokenToken**](docs/AccountDataApi.md#v1userlogintokentoken) | **GET** /v1/user/login/token/{token} | Login Token Email
*AccountDataApi* | [**V1usersummary**](docs/AccountDataApi.md#v1usersummary) | **GET** /v1/user/summary | Exchange Bank Summary
*AccountDataApi* | [**V1userwalletsummary**](docs/AccountDataApi.md#v1userwalletsummary) | **GET** /v1/user/wallet/summary | Exchange Bank Summary
*BlockchainToolsApi* | [**V1bitcoinsearchAddress**](docs/BlockchainToolsApi.md#v1bitcoinsearchaddress) | **GET** /v1/bitcoin/search/{any} | Search Bitcoin Blockchain
*BlockchainToolsApi* | [**V1bitcoinsearchTxid**](docs/BlockchainToolsApi.md#v1bitcoinsearchtxid) | **GET** /v1/bitcoin/search/confirmation/{txid} | Get Confirmations
*ExchangeBankActionsApi* | [**V1userexchangebankcoinwithdrawinitiate**](docs/ExchangeBankActionsApi.md#v1userexchangebankcoinwithdrawinitiate) | **POST** /v1/user/exchange/bank/coin/withdraw/initiate | Initiate Bitcoin Withdrawal
*ExchangeBankActionsApi* | [**V1userexchangebankcoinwithdrawnewVerifycode**](docs/ExchangeBankActionsApi.md#v1userexchangebankcoinwithdrawnewverifycode) | **POST** /v1/user/exchange/bank/coin/withdraw/newVerifycode | Gets a Verification Code.
*ExchangeBankActionsApi* | [**V1userexchangebankcoinwithdrawunverifiedcancelWithdrawID**](docs/ExchangeBankActionsApi.md#v1userexchangebankcoinwithdrawunverifiedcancelwithdrawid) | **DELETE** /v1/user/exchange/bank/coin/withdraw/unverified/cancel/{withdrawID} | Cancel Bitcoin Withdrawal
*ExchangeBankActionsApi* | [**V1userexchangebankcoinwithdrawverify**](docs/ExchangeBankActionsApi.md#v1userexchangebankcoinwithdrawverify) | **PUT** /v1/user/exchange/bank/coin/withdraw/verify | Verify Bitcoin Withdrawal
*ExchangeBankActionsApi* | [**V1userexchangebankfiataccountnew**](docs/ExchangeBankActionsApi.md#v1userexchangebankfiataccountnew) | **PUT** /v1/user/exchange/bank/fiat/account/new | New Bank Link
*ExchangeBankActionsApi* | [**V1userexchangebankfiatdepositcancelDepositID**](docs/ExchangeBankActionsApi.md#v1userexchangebankfiatdepositcanceldepositid) | **DELETE** /v1/user/exchange/bank/fiat/deposit/cancel/{depositID} | Cancel Unverified Exchange Fiat Deposit
*ExchangeBankActionsApi* | [**V1userexchangebankfiatdepositnew**](docs/ExchangeBankActionsApi.md#v1userexchangebankfiatdepositnew) | **PUT** /v1/user/exchange/bank/fiat/deposit/new | New Exchange Fiat Deposit
*ExchangeBankActionsApi* | [**V1userexchangebankfiatwithdrawinitiate**](docs/ExchangeBankActionsApi.md#v1userexchangebankfiatwithdrawinitiate) | **POST** /v1/user/exchange/bank/fiat/withdraw/initiate | Initiate Fiat Withdrawal
*ExchangeBankActionsApi* | [**V1userexchangebankfiatwithdrawnewVerifycode**](docs/ExchangeBankActionsApi.md#v1userexchangebankfiatwithdrawnewverifycode) | **POST** /v1/user/exchange/bank/fiat/withdraw/newVerifycode | Gets a Fiat Verification Code.
*ExchangeBankActionsApi* | [**V1userexchangebankfiatwithdrawunverifiedcancelWithdrawID**](docs/ExchangeBankActionsApi.md#v1userexchangebankfiatwithdrawunverifiedcancelwithdrawid) | **DELETE** /v1/user/exchange/bank/fiat/withdraw/unverified/cancel/{withdrawID} | Cancel Fiat Withdrawal
*ExchangeBankActionsApi* | [**V1userexchangebankfiatwithdrawverify**](docs/ExchangeBankActionsApi.md#v1userexchangebankfiatwithdrawverify) | **PUT** /v1/user/exchange/bank/fiat/withdraw/verify | Verify Fiat Withdrawal
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoinaddresses**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoinaddresses) | **GET** /v1/user/exchange/bank/coin/addresses | Exchange Coin Addresses
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoinbalanceavailable**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoinbalanceavailable) | **GET** /v1/user/exchange/bank/coin/balance/total | Available Exchange Coin Balance
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoinbalancepending**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoinbalancepending) | **GET** /v1/user/exchange/bank/coin/balance/pending | In Trade Coin Balance
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoinbalancetotal**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoinbalancetotal) | **GET** /v1/user/exchange/bank/coin/balance/available | Total Exchange Coin Balance
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoindepositcancelled**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoindepositcancelled) | **GET** /v1/user/exchange/bank/coin/deposit/cancelled | Cancelled Exchange Coin Deposits
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoindepositunverified**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoindepositunverified) | **GET** /v1/user/exchange/bank/coin/deposit/unverified | Unverified Exchange Coin Deposits
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoindepositverified**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoindepositverified) | **GET** /v1/user/exchange/bank/coin/deposit/verified | Verified Exchange Coin Deposits
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoinwithdrawcancelled**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoinwithdrawcancelled) | **GET** /v1/user/exchange/bank/coin/withdraw/cancelled | Cancelled Exchange Coin Withdrawals
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoinwithdrawcompleted**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoinwithdrawcompleted) | **GET** /v1/user/exchange/bank/coin/withdraw/completed | Completed Exchange Coin Withdrawals
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoinwithdrawunverified**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoinwithdrawunverified) | **GET** /v1/user/exchange/bank/coin/withdraw/unverified | Unverified Exchange Coin Withdrawals
*ExchangeBankCoinDataApi* | [**V1userexchangebankcoinwithdrawverified**](docs/ExchangeBankCoinDataApi.md#v1userexchangebankcoinwithdrawverified) | **GET** /v1/user/exchange/bank/coin/withdraw/verified | Verified Exchange Coin Withdrawals
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiataccounts**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiataccounts) | **GET** /v1/user/exchange/bank/fiat/accounts | Exchange Bitcoin Deposit Addresses
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiatbalanceavailable**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiatbalanceavailable) | **GET** /v1/user/exchange/bank/fiat/balance/total | Available Exchange Fiat Balance
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiatbalancepending**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiatbalancepending) | **GET** /v1/user/exchange/bank/fiat/balance/pending | In Trade Coin Balance
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiatbalancetotal**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiatbalancetotal) | **GET** /v1/user/exchange/bank/fiat/balance/available | Total Exchange Fiat Balance
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiatdepositcancelled**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiatdepositcancelled) | **GET** /v1/user/exchange/bank/fiat/deposit/cancelled | Cancelled Exchange Fiat Deposits
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiatdepositunverified**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiatdepositunverified) | **GET** /v1/user/exchange/bank/fiat/deposit/unverified | Unverified Exchange Fiat Deposits
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiatdepositverified**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiatdepositverified) | **GET** /v1/user/exchange/bank/fiat/deposit/verified | Verified Exchange Fiat Deposits
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiatwithdrawcancelled**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiatwithdrawcancelled) | **GET** /v1/user/exchange/bank/fiat/withdraw/cancelled | Cancelled Exchange Fiat Withdrawals
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiatwithdrawcompleted**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiatwithdrawcompleted) | **GET** /v1/user/exchange/bank/fiat/withdraw/completed | Completed Exchange Fiat Withdrawals
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiatwithdrawunverified**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiatwithdrawunverified) | **GET** /v1/user/exchange/bank/fiat/withdraw/unverified | Unverified Exchange Fiat Withdrawals
*ExchangeBankFiatDataApi* | [**V1userexchangebankfiatwithdrawverified**](docs/ExchangeBankFiatDataApi.md#v1userexchangebankfiatwithdrawverified) | **GET** /v1/user/exchange/bank/fiat/withdraw/verified | Verified Exchange Fiat Withdrawals
*ExchangeTradeActionsApi* | [**V1userexchangeaskcancelOrderID**](docs/ExchangeTradeActionsApi.md#v1userexchangeaskcancelorderid) | **DELETE** /v1/user/exchange/ask/cancel/{orderID} | Cancel Open Sell Order
*ExchangeTradeActionsApi* | [**V1userexchangeasknew**](docs/ExchangeTradeActionsApi.md#v1userexchangeasknew) | **PUT** /v1/user/exchange/ask/new | BTC Sell Order
*ExchangeTradeActionsApi* | [**V1userexchangebidcancelOrderID**](docs/ExchangeTradeActionsApi.md#v1userexchangebidcancelorderid) | **DELETE** /v1/user/exchange/bid/cancel/{orderID} | Cancel Open Buy Order
*ExchangeTradeActionsApi* | [**V1userexchangebidnew**](docs/ExchangeTradeActionsApi.md#v1userexchangebidnew) | **PUT** /v1/user/exchange/bid/new | BTC Buy Order
*ExchangeTradeActionsApi* | [**V1userexchangeinstantbuy**](docs/ExchangeTradeActionsApi.md#v1userexchangeinstantbuy) | **PUT** /v1/user/exchange/instant/buy | Instantly Buy BTC
*ExchangeTradeActionsApi* | [**V1userexchangeinstantsell**](docs/ExchangeTradeActionsApi.md#v1userexchangeinstantsell) | **PUT** /v1/user/exchange/instant/sell | Instantly Sell BTC
*ExchangeTradeDataApi* | [**V1exchangeasklow**](docs/ExchangeTradeDataApi.md#v1exchangeasklow) | **GET** /v1/exchange/ask/low | Lowest Ask
*ExchangeTradeDataApi* | [**V1exchangeaskorders**](docs/ExchangeTradeDataApi.md#v1exchangeaskorders) | **GET** /v1/exchange/ask/orders | All Sell Orders
*ExchangeTradeDataApi* | [**V1exchangebidhigh**](docs/ExchangeTradeDataApi.md#v1exchangebidhigh) | **GET** /v1/exchange/bid/high | Returns the Highest Bid in the Order Book
*ExchangeTradeDataApi* | [**V1exchangebidorders**](docs/ExchangeTradeDataApi.md#v1exchangebidorders) | **GET** /v1/exchange/bid/orders | All Buy Orders
*ExchangeTradeDataApi* | [**V1exchangelastTrade**](docs/ExchangeTradeDataApi.md#v1exchangelasttrade) | **GET** /v1/exchange/lastTrade | Last Trade
*ExchangeTradeDataApi* | [**V1exchangemax24Hr**](docs/ExchangeTradeDataApi.md#v1exchangemax24hr) | **GET** /v1/exchange/max24Hr | Max 24 Hour Rate
*ExchangeTradeDataApi* | [**V1exchangemin24Hr**](docs/ExchangeTradeDataApi.md#v1exchangemin24hr) | **GET** /v1/exchange/min24Hr | Min 24 Hour Rate
*ExchangeTradeDataApi* | [**V1exchangeticker**](docs/ExchangeTradeDataApi.md#v1exchangeticker) | **GET** /v1/exchange/ticker | Exchange Ticker
*ExchangeTradeDataApi* | [**V1userexchangeaskcancelled**](docs/ExchangeTradeDataApi.md#v1userexchangeaskcancelled) | **GET** /v1/user/exchange/ask/cancelled | Cancelled User Sell Orders
*ExchangeTradeDataApi* | [**V1userexchangeaskcompleted**](docs/ExchangeTradeDataApi.md#v1userexchangeaskcompleted) | **GET** /v1/user/exchange/ask/completed | Completed User Sell Orders
*ExchangeTradeDataApi* | [**V1userexchangeaskpending**](docs/ExchangeTradeDataApi.md#v1userexchangeaskpending) | **GET** /v1/user/exchange/ask/pending | Pending User Sell Orders
*ExchangeTradeDataApi* | [**V1userexchangebidcancelled**](docs/ExchangeTradeDataApi.md#v1userexchangebidcancelled) | **GET** /v1/user/exchange/bid/cancelled | Cancelled User Buy Orders
*ExchangeTradeDataApi* | [**V1userexchangebidcompleted**](docs/ExchangeTradeDataApi.md#v1userexchangebidcompleted) | **GET** /v1/user/exchange/bid/completed | Completed User Buy Orders
*ExchangeTradeDataApi* | [**V1userexchangebidpending**](docs/ExchangeTradeDataApi.md#v1userexchangebidpending) | **GET** /v1/user/exchange/bid/pending | Pending User Buy Orders
*ExchangeTradeDataApi* | [**V1userexchangetrades**](docs/ExchangeTradeDataApi.md#v1userexchangetrades) | **GET** /v1/exchange/trades | Completed Exchange Trades
*SecurityActionsApi* | [**V1mfaauthyinitiate**](docs/SecurityActionsApi.md#v1mfaauthyinitiate) | **POST** /v1/mfa/authy/initiate | Initiate Authy Registration.
*SecurityActionsApi* | [**V1mfagainitiate**](docs/SecurityActionsApi.md#v1mfagainitiate) | **POST** /v1/mfa/ga/initiate | Initiate GA Registration.
*SecurityActionsApi* | [**V1usermfaauthycall**](docs/SecurityActionsApi.md#v1usermfaauthycall) | **GET** /v1/mfa/authy/call | Authy Call Code
*SecurityActionsApi* | [**V1usermfaauthydisableCode**](docs/SecurityActionsApi.md#v1usermfaauthydisablecode) | **DELETE** /v1/user/mfa/authy/disable/{code} | Disable Authy
*SecurityActionsApi* | [**V1usermfaauthyinitiateenable**](docs/SecurityActionsApi.md#v1usermfaauthyinitiateenable) | **PUT** /v1/user/mfa/authy/initiate/enable | Verify Authy Registration
*SecurityActionsApi* | [**V1usermfaauthysms**](docs/SecurityActionsApi.md#v1usermfaauthysms) | **GET** /v1/mfa/authy/sms | Authy Sms Code
*SecurityActionsApi* | [**V1usermfagadisableCode**](docs/SecurityActionsApi.md#v1usermfagadisablecode) | **DELETE** /v1/user/mfa/ga/disable/{code} | Disable Google Authenticator
*SecurityActionsApi* | [**V1usermfagainitiateenable**](docs/SecurityActionsApi.md#v1usermfagainitiateenable) | **PUT** /v1/user/mfa/ga/initiate/enable | Enable Google Authenticator
*SecurityActionsApi* | [**V1userpasswordchange**](docs/SecurityActionsApi.md#v1userpasswordchange) | **POST** /v1/user/password/change | Change Password.
*SecurityActionsApi* | [**V1userpasswordreset**](docs/SecurityActionsApi.md#v1userpasswordreset) | **POST** /v1/user/password/reset | Reset Password.
*WalletActionsApi* | [**V1userwalletcoinaddressnew**](docs/WalletActionsApi.md#v1userwalletcoinaddressnew) | **PUT** /v1/user/wallet/coin/address/new | New Bitcoin Address
*WalletActionsApi* | [**V1userwalletcoinnew**](docs/WalletActionsApi.md#v1userwalletcoinnew) | **PUT** /v1/user/wallet/coin/new | Create New Wallet
*WalletActionsApi* | [**V1userwalletcoinwithdrawinitiate**](docs/WalletActionsApi.md#v1userwalletcoinwithdrawinitiate) | **POST** /v1/user/wallet/coin/withdraw/initiate | Initiate Bitcoin Withdrawal
*WalletActionsApi* | [**V1userwalletcoinwithdrawsendToExchange**](docs/WalletActionsApi.md#v1userwalletcoinwithdrawsendtoexchange) | **PUT** /v1/user/wallet/coin/withdraw/sendToExchange | Send to Exchange
*WalletActionsApi* | [**V1userwalletcoinwithdrawunverifiedcancelWithdrawID**](docs/WalletActionsApi.md#v1userwalletcoinwithdrawunverifiedcancelwithdrawid) | **DELETE** /v1/user/wallet/coin/withdraw/unverified/cancel/{withdrawID} | Cancel Bitcoin Withdrawal
*WalletActionsApi* | [**V1userwalletcoinwithdrawverify**](docs/WalletActionsApi.md#v1userwalletcoinwithdrawverify) | **PUT** /v1/user/wallet/coin/withdraw/verify | Verify Bitcoin Withdrawal
*WalletActionsApi* | [**V1walletcoinwithdrawnewVerifycode**](docs/WalletActionsApi.md#v1walletcoinwithdrawnewverifycode) | **POST** /v1/wallet/coin/withdraw/newVerifycode | Gets a Verification Code
*WalletDataApi* | [**V1userwalletcoinaddressWalletID**](docs/WalletDataApi.md#v1userwalletcoinaddresswalletid) | **GET** /v1/user/wallet/coin/address/{walletID} | Wallet Bitcoin Addresses
*WalletDataApi* | [**V1userwalletcoindepositconfirmedWalletID**](docs/WalletDataApi.md#v1userwalletcoindepositconfirmedwalletid) | **GET** /v1/user/wallet/coin/deposit/confirmed/{walletID} | Confirmed Wallet Transactions
*WalletDataApi* | [**V1userwalletcoindepositconfirmedall**](docs/WalletDataApi.md#v1userwalletcoindepositconfirmedall) | **GET** /v1/user/wallet/coin/deposit/confirmed/all | Confirmed Wallet Deposit
*WalletDataApi* | [**V1userwalletcoindepositunconfirmedWalletID**](docs/WalletDataApi.md#v1userwalletcoindepositunconfirmedwalletid) | **GET** /v1/user/wallet/coin/deposit/unconfirmed/{walletID} | Unconfirmed Transactions in Wallet
*WalletDataApi* | [**V1userwalletcoindepositunconfirmedall**](docs/WalletDataApi.md#v1userwalletcoindepositunconfirmedall) | **GET** /v1/user/wallet/coin/deposit/unconfirmed/all | All Unconfirmed Deposits
*WalletDataApi* | [**V1userwalletcoinwallets**](docs/WalletDataApi.md#v1userwalletcoinwallets) | **GET** /v1/user/wallet/coin/wallets | Wallet Details
*WalletDataApi* | [**V1walletwithdrawcancelled**](docs/WalletDataApi.md#v1walletwithdrawcancelled) | **GET** /v1/wallet/coin/withdraw/cancelled | Cancelled Coin Withdrawals
*WalletDataApi* | [**V1walletwithdrawcompleted**](docs/WalletDataApi.md#v1walletwithdrawcompleted) | **GET** /v1/wallet/coin/withdraw/completed | Completed Coin Withdrawals
*WalletDataApi* | [**V1walletwithdrawunverified**](docs/WalletDataApi.md#v1walletwithdrawunverified) | **GET** /v1/wallet/coin/withdraw/unverified | Unverified Coin Withdrawals
*WalletDataApi* | [**V1walletwithdrawverified**](docs/WalletDataApi.md#v1walletwithdrawverified) | **GET** /v1/wallet/coin/withdraw/verified | Verified Coin Withdrawals

## Documentation for Models

 - [Model.Address](docs/Address.md)
 - [Model.AllRefData](docs/AllRefData.md)
 - [Model.AllRefDataResponse](docs/AllRefDataResponse.md)
 - [Model.BankSummaryData](docs/BankSummaryData.md)
 - [Model.BankSummaryDataResponse](docs/BankSummaryDataResponse.md)
 - [Model.ChangePassword](docs/ChangePassword.md)
 - [Model.Code](docs/Code.md)
 - [Model.CodeCountryMobile](docs/CodeCountryMobile.md)
 - [Model.CoinDepData](docs/CoinDepData.md)
 - [Model.CoinDepDataResponse](docs/CoinDepDataResponse.md)
 - [Model.ConfirmData](docs/ConfirmData.md)
 - [Model.ConfirmDataResponse](docs/ConfirmDataResponse.md)
 - [Model.DoubleData](docs/DoubleData.md)
 - [Model.DoubleDataResponse](docs/DoubleDataResponse.md)
 - [Model.Email](docs/Email.md)
 - [Model.FailResult](docs/FailResult.md)
 - [Model.FiatBankData](docs/FiatBankData.md)
 - [Model.FiatBankDataResponse](docs/FiatBankDataResponse.md)
 - [Model.FiatDepData](docs/FiatDepData.md)
 - [Model.FiatDepDataResponse](docs/FiatDepDataResponse.md)
 - [Model.FiatWithData](docs/FiatWithData.md)
 - [Model.FiatWithDataResponse](docs/FiatWithDataResponse.md)
 - [Model.JsValue](docs/JsValue.md)
 - [Model.KYCData](docs/KYCData.md)
 - [Model.KYCDataResponse](docs/KYCDataResponse.md)
 - [Model.LastTradeData](docs/LastTradeData.md)
 - [Model.LastTradeDataResponse](docs/LastTradeDataResponse.md)
 - [Model.LoginFormNew](docs/LoginFormNew.md)
 - [Model.LoginId](docs/LoginId.md)
 - [Model.MaxVol](docs/MaxVol.md)
 - [Model.MethodCountryMobile](docs/MethodCountryMobile.md)
 - [Model.MinFiat](docs/MinFiat.md)
 - [Model.NetkiNameAddress](docs/NetkiNameAddress.md)
 - [Model.NewAddress](docs/NewAddress.md)
 - [Model.NewBankForm](docs/NewBankForm.md)
 - [Model.NewFiatBankDeposit](docs/NewFiatBankDeposit.md)
 - [Model.NewWallet](docs/NewWallet.md)
 - [Model.NumberOtp](docs/NumberOtp.md)
 - [Model.OrderData](docs/OrderData.md)
 - [Model.OrderDataResponse](docs/OrderDataResponse.md)
 - [Model.RateData](docs/RateData.md)
 - [Model.RateDataResponse](docs/RateDataResponse.md)
 - [Model.RateDiffData](docs/RateDiffData.md)
 - [Model.RateDiffDataResponse](docs/RateDiffDataResponse.md)
 - [Model.RateVolData](docs/RateVolData.md)
 - [Model.RateVolDataResponse](docs/RateVolDataResponse.md)
 - [Model.RateVolTimeTypeData](docs/RateVolTimeTypeData.md)
 - [Model.RateVolTimeTypeDataResponse](docs/RateVolTimeTypeDataResponse.md)
 - [Model.ResetPassword](docs/ResetPassword.md)
 - [Model.SendCoin](docs/SendCoin.md)
 - [Model.SendCoinWallet](docs/SendCoinWallet.md)
 - [Model.SendExchange](docs/SendExchange.md)
 - [Model.SignupForm](docs/SignupForm.md)
 - [Model.StandardInitiateLoginResultData](docs/StandardInitiateLoginResultData.md)
 - [Model.StandardLoginResultData](docs/StandardLoginResultData.md)
 - [Model.StandardTickerResultData](docs/StandardTickerResultData.md)
 - [Model.StandardVerifySignupResultData](docs/StandardVerifySignupResultData.md)
 - [Model.SuccCoinRefData](docs/SuccCoinRefData.md)
 - [Model.SuccCoinRefDataResponse](docs/SuccCoinRefDataResponse.md)
 - [Model.SuccRefData](docs/SuccRefData.md)
 - [Model.SuccRefDataResponse](docs/SuccRefDataResponse.md)
 - [Model.SuccessCancelData](docs/SuccessCancelData.md)
 - [Model.SuccessCancelDataResponse](docs/SuccessCancelDataResponse.md)
 - [Model.SuccessInitiateLoginResponse](docs/SuccessInitiateLoginResponse.md)
 - [Model.SuccessLoginResponse](docs/SuccessLoginResponse.md)
 - [Model.SuccessOrderData](docs/SuccessOrderData.md)
 - [Model.SuccessOrderDataResponse](docs/SuccessOrderDataResponse.md)
 - [Model.SuccessResult](docs/SuccessResult.md)
 - [Model.SuccessTickerResponse](docs/SuccessTickerResponse.md)
 - [Model.SuccessVerifySignupResponse](docs/SuccessVerifySignupResponse.md)
 - [Model.TimeData](docs/TimeData.md)
 - [Model.TimeDataCoin](docs/TimeDataCoin.md)
 - [Model.TimeKYCData](docs/TimeKYCData.md)
 - [Model.TradeAddressData](docs/TradeAddressData.md)
 - [Model.TradeAddressDataResponse](docs/TradeAddressDataResponse.md)
 - [Model.TradeCoinWithdrawData](docs/TradeCoinWithdrawData.md)
 - [Model.TradeCoinWithdrawDataResponse](docs/TradeCoinWithdrawDataResponse.md)
 - [Model.TradeSummaryData](docs/TradeSummaryData.md)
 - [Model.TradeSummaryDataResponse](docs/TradeSummaryDataResponse.md)
 - [Model.UserSummaryData](docs/UserSummaryData.md)
 - [Model.UserSummaryDataResponse](docs/UserSummaryDataResponse.md)
 - [Model.ValidAddressSearchData](docs/ValidAddressSearchData.md)
 - [Model.ValidAddressSearchDataResponse](docs/ValidAddressSearchDataResponse.md)
 - [Model.VolData](docs/VolData.md)
 - [Model.VolDataResponse](docs/VolDataResponse.md)
 - [Model.WalletAddressData](docs/WalletAddressData.md)
 - [Model.WalletAddressDataResponse](docs/WalletAddressDataResponse.md)
 - [Model.WalletCoinWithdrawData](docs/WalletCoinWithdrawData.md)
 - [Model.WalletCoinWithdrawDataResponse](docs/WalletCoinWithdrawDataResponse.md)
 - [Model.WalletSummaryData](docs/WalletSummaryData.md)
 - [Model.WalletSummaryDataResponse](docs/WalletSummaryDataResponse.md)
 - [Model.WalletsData](docs/WalletsData.md)
 - [Model.WalletsDataResponse](docs/WalletsDataResponse.md)
 - [Model.WithdrawFiat](docs/WithdrawFiat.md)
 - [Model.WithdrawID](docs/WithdrawID.md)

## Documentation for Authorization

All endpoints do not require authorization.

repository: coinsecure/plugins

repo_name: coinsecure/plugins


text:
# Contributing

## Launching the app

First install the dependencies

```bash
yarn
```

Then copy the example env file

```bash
cp .env.example .env
```

(Optionnal) Install the React Developper Tools in your chrome browser. Then, find the extension install path and add it to the .env file. More info [here](https://electronjs.org/docs/tutorial/devtools-extension). You must provide the absolute path.

You should use autoreloading when developping, using

```bash
yarn dev
```

and in another terminal, to launch the electron app:

```bash
yarn dev-app
```

and then, reload your electron app with the refresh command (`CMD + R` on OS X)

You can make the app automatically load a specific folder by doing:

```bash
yarn dev --autoload /absolute/or/relative/path/to/folder
```

## Writing code

- Use JSDoc comments to document new functions.
- Try to keep you methods simple using meaningful function names and variable names.

## Comitting

For our commits message, we are following [conventional commits](https://www.conventionalcommits.org).

## Tests

### Unit tests

You can run unit tests by running

```bash
yarn test
```

### e2e tests

You can run end-to-end tests by running

```bash
yarn e2e
```

E2E tests may fail after you installed new dependencies. You can fix it by doing

```bash
yarn install --force
```

## Resource consuming tasks

When doing heavy resource consuming tasks, we use NodeJS `childProcess.fork` method to keep the UI reactive. To do so,
we use [webpack-fork-loader](https://www.npmjs.com/package/webpack-fork-loader), which will wrap every `*.fork.js` or
`*.fork.ts` file into a ChildProcess constructor that will build a nodeJS ChildProcess element.

We added some utility classes to adapt the ChildProcess API to the formerly used WebWorkers API which can be found in
the `src/util/async-worker-util.ts` file.

A basic new ChildProcess would look like :

```typescript
// child-process.controller.ts
import MyChildProcess from "./child-process.fork.ts";
import { createAsyncWorkerForChildProcessControllerFactory } from "util/async-worker/child-process";
import { MessageTypes } from "util/batch-process/batch-process-util-types";
import { cancelableBackgroundWorkerProcess$ } from "util/batch-process/batch-process-util";

export const runMyChildProcess = () => {
    // We build a factory that return the AsyncWorker object. The parameter is the child process file name
    const asyncProcessFactory = createAsyncWorkerForChildProcessControllerFactory("my-child-process.fork");

    const result$ = cancelableBackgroundWorkerProcess$({ data }, asyncProcessFactory);

    // use the result observable
}
```

```typescript
// my-child-process.fork.ts
import { MessageTypes } from "../util/batch-process/batch-process-util-types";
import { createAsyncWorkerForChildProcess } from "util/async-worker/child-process";
import { setupChildWorkerListeners } from "util/async-worker/async-worker-util";

const asyncWorker = createAsyncWorkerForChildProcess();

setupChildWorkerListeners(asyncWorker, {
    onInitialize: () => console.log("handleInitializeMessage"),
    onData: () => console.log("handleDataMessage"),
})
```

## Translations

Translations are managed using i18n json files in `src/translations/`. To make it easier for translators to work, we
created a script that allows to generate csv containing the english text (which is our reference) and another
language translation. This will simplify identifying the missing translations. To do that, simply run :

```bash
yarn generate-translation-csv
```

You will then find your translations csv in the `./translations` folder.

Once your translator filled the CSV, you can import it back. Assuming that the first column of the csv is the path,
the second your reference language and the following columns the translated languages, you can do, for a file that
contains french translation in the third column and german translation in the fourth:

```bash
yarn import-translation-csv ./translations/fr-de.csv fr de
```

## Pull requests

If you want to contribute, you must respect our linter specs. You can run `yarn lint` for compliance test.

You are welcome to open pull requests to add features to the project.

We are trying to improve our test coverage, so you are welcome to test the services you are adding.

repository: SocialGouv/archifiltre-docs

branch_name: refs/heads/dev

extension: md

gha_language: TypeScript

license_type: permissive

repo_name: SocialGouv/archifiltre-docs


text:
# peflocus
`peflocus` is a command line tool to work with the ILCD data sets of the
[PEF pilots](http://ec.europa.eu/environment/eussd/smgp/ef_pilots.htm#pef) (and
also other ILCD packages). It has a set of sub-commands that are described
below. The general usage of the tool is (where command and options are
placeholders; see the command descriptions below):

```bash
peflocus [command] [options]
```

`peflocus` writes log messages to the stderr output. Thus, you can pipe them
into a file via:

```bash
peflocus [command] [options] 2> [path/to/logfile]
```

## The `map` command
The PEF data sets are partly regionalized via the `location` element in
exchanges of processes and characterization factors of LCIA method data sets.
This means that a flow can occur multiple times in exchanges of a process
or in characterization factors of an LCIA method but with different location
codes. The code snippets below show examples of a regionalized exchange and
characterization factors:

```xml
<exchange dataSetInternalID="1">
  <referenceToFlowDataSet
    type="flow data set"
    refObjectId="e3abf13f-3bb9-4e52-b72b-9bd276625c55"
    version="01.00.000"
    uri="../flows/e3abf13f-3bb9-4e52-b72b-9bd276625c55">
    <common:shortDescription xml:lang="en">1,1,1,2-Tetrachloroethane</common:shortDescription>
  </referenceToFlowDataSet>
	<location>PL</location>
  <exchangeDirection>Output</exchangeDirection>
  <meanAmount>1.0</meanAmount>
  <resultingAmount>1.0</resultingAmount>
</exchange>
```

```xml
<factor>
  <referenceToFlowDataSet
    refObjectId="03b56eb6-cc68-4251-9317-06878cb27dff"
    type="flow data set"
    uri="../flows/03b56eb6-cc68-4251-9317-06878cb27dff.xml"
    version="03.00.000">
    <common:shortDescription xml:lang="en">from arable, irrigated,</common:shortDescription>
  </referenceToFlowDataSet>
  <location>AD</location>
  <exchangeDirection>Input</exchangeDirection>
  <meanValue>-128</meanValue>
</factor>
```

[openLCA](http://www.openlca.org/) (which has another approach for
[regionalization](https://www.openlca.org/wp-content/uploads/2016/08/Regionalized-LCIA-in-openLCA.pdf))
and other tools may not support these `location` elements. The `map` command
takes a mapping file with of the format `(flow-UUID, location) -> new-flow-UUID`
and applies this to a set of ILCD zip files in a folder. It assigns the new
UUIDs to the exchanges and characterization factors and also creates new flows
for these new IDs. For each zip file `x.zip` it will create a file
`peflocus_x.zip` where these mappings are applied.

The mapping file should be an `utf-8` encoded CSV file (with comma as column
separator) with the following colums:

* UUID of the ILCD flow
* Location code
* New UUID of the flow

The first line of the file is ignored.

The map command has the following options:

* `-workdir` => The path to the folder with the ILCD zip packages; defaults to
  `zips`
* `-mapfile` => The path to the mapping file that should be used; defaults to
  `flow_mapping.csv`

Thus, the command `peflocus map` is the same as:

```
peflocus map -wordir zips -mapfile flow_mapping.csv
```

## The `merge` command
With the `merge` command you can merge multiple ILCD packages into a single file.
As in the `map` command, you can pass the `-workdir` option to specify the
folder where the zip files are located (the `zips` folder is again the default).
The `merge` command will then aggregate all data sets and external documents
into a file `peflocus_merged.zip`. External documents are identified by its
name, XML data sets by its data set type and UUID. Thus, if there is a data set
with the same type and UUID in multiple packages (maybe in different versions!)
it will only be added once in the merged package. With the `-skipdocs 1` option,
external documents will not be added to the result package.

## The `model-check` command
The `model-check` command checks the life cycle models of the zip files in the
working directory (which is the `zips` folder by default; zips that start with
`peflocus_` are ignored; see above). It checks things like if there is a
reference process in the model or if all connections are valid regarding the
inputs and outputs of the processes. The results are printed to the console and
can be piped into a text file, e.g.:

```
peflocus model-check -wordir zips > zips/model_report.txt
```

For each model, the model graph using the model internal IDs for the processes
is also printed out in the [dot format](https://en.wikipedia.org/wiki/DOT_(graph_description_language))
which can be rendered with [Graphviz](http://www.webgraphviz.com/) (the pink
node is the reference process):

![](./graph_example.png)

license: MIT

repository: msrocka/peflocus

branch_name: refs/heads/master

repo_name: msrocka/peflocus


text:
This is a guide for migrating from the `NService.Router` community package to Particular Software's `NServiceBus.Transport.Bridge` package.

## Router versus bridge

One important difference between `NServiceBus.Transport.Bridge` and `NServiceBus.Router` is that `NServiceBus.Transport.Bridge` is supported by Particular Software. `NServiceBus.Router` is a community package and is not supported by Particular Software.

The bridge does not require what the NServiceBus.Router calls _connectors_.

`NServiceBus.Router` has the concept of _connectors_ which it uses to configure endpoints so that messages are delivered to the correct destination. Connectors must be deployed alongside the endpoints they are routing. The bridge does not require connectors or any other similar component. Endpoints are not aware that a bridge is translating messages between transports so after migrating to the bridge, these connectors no longer need to be deployed with each endpoint. One of the benefits of this is that [migration to a different transport](scenarios.md) is easier with `NServiceBus.Transport.Bridge` than with `NServiceBus.Router`.

## Steps to migrate

The following types of messages must be taken into consideration for migration:

- In-flight messages
- Commands
- Events
- Additional messages

### In-flight messages

In-flight messages are messages that were sent to an endpoint but have not been processed yet. That is, a message may have been sent using `NServiceBus.Router` but after migration, it may be processed by the messaging bridge. Since `NServiceBus.Router` changes the routing for messages so that they are sent directly to the `Router` component, this means that any in-flight messages will require the `Router` component to be available, even when endpoints have already been configured to no longer use `NServiceBus.Router`.

Because of this, `NServiceBus.Router` must remain running until all in-flight messages have been delivered. The time this takes is specific to each system. If it is unclear what the right time is to stop the NServiceBus.Router, contact [Particular Software](https://particular.net/contactus) for guidance.

#### Commands

Commands are the easiest to migrate as they have a specific route to a specific logical endpoint. As soon as `NServiceBus.Transport.Bridge` is introduced, all `NServiceBus.Router`-related configuration for routing commands using the connector can be removed from every endpoint. This implies that the original routing towards the specific endpoint can be restored and the bridge will make sure it is transferred to the correct transport.

#### Events

Events require more effort to migrate from `NServiceBus.Router` to `NServiceBus.Transport.Bridge` due to subscriptions that are registered within a message broker.

A scenario could exist as shown in the graph below, where `Endpoint A` publishes an event and the event is sent to both the `NServiceBus.Router` and the `NServiceBus.Transport.Bridge`. As a result, `Endpoint B` could receive the same event twice.

Note that both events would have the same message identifier, which allows the [outbox](/nservicebus/outbox/) to de-duplicate the messages. Without the outbox, either the message handler must be [idempotent](/nservicebus/concepts/glossary.md#idempotence) or the event will be processed twice.

```mermaid
flowchart LR
  Br(Bridge)
  A[Endpoint A] ---> Br
  Br ---> B[Endpoint B]
  Ro[Router] ---> B
  A ---> Ro
  subgraph msmq
    A
  end
  subgraph sql
    B
  end
```

In this scenario, the following steps may be taken to migrate from `NServiceBus.Router` to `NServiceBus.Transport.Bridge`:

1. Stop both `Endpoint A` and the `Bridge`.
2. Configure the `Bridge` to register a publisher with `Endpoint B` for the event that `Endpoint A` publishes.
3. Remove the subscription from the message broker for the `Router`.
4. Add the subscription to the message broker for the `Bridge`.
5. Start the `Bridge`.
6. Start `Endpoint A`.

When the `Bridge` starts up, it will also create the subscription; it is not required to manually create the subscription in the message broker. However, be aware of when `Endpoint A` cannot be taken offline due to high availability, scaling out or service level agreements.

NOTE: If Endpoint A cannot be taken offline, the time between step 3 and step 4 determines how many events will be lost.

#### Additional messages

There may be additional messages, like request/response messages, which route a message back to the endpoint it originated from. These must be routed back using the `NServiceBus.Router` component. The result is that as long as there are messages like these to be processed, the `NServiceBus.Router` component must be active within the system alongside the bridge.

## Conclusion

Migrating from `NServiceBus.Router` to `NServiceBus.Transport.Bridge` is not difficult, but it requires careful consideration and analysis before `NServiceBus.Router` can be completely removed from a system.

gha_language: C#

gha_license_id: NOASSERTION


text:
# owl2-reasoners-benchmark

This is ta console java application that allows the speed evaluating OWL 2 reasoners on a specified ontologies. This application was implemented in the evaluating owl 2 reasoning process for the `ORE 2014` paper.

[![status](https://img.shields.io/badge/status-completed-inactive?style=flat-square)](BADGES_GUIDE.md#status) [![version](https://img.shields.io/badge/version-1.0.0-informational?style=flat-square)](BADGES_GUIDE.md#version) [![stable](https://img.shields.io/badge/stable-yes-important?style=flat-square)](BADGES_GUIDE.md#stable)  [![oss lifecycle](https://img.shields.io/badge/oss_lifecycle-archived-important?style=flat-square)](BADGES_GUIDE.md#oss-lifecycle) [![maintenance](https://img.shields.io/badge/maintenance-no-informational?style=flat-square)](BADGES_GUIDE.md#maintenance) [![latest release date](https://img.shields.io/badge/latest_release_date-June_25,_2014-informational?style=flat-square)](BADGES_GUIDE.md#release-date) [![last commit](https://img.shields.io/badge/last_commit-June_25,_2014-informational?style=flat-square)](BADGES_GUIDE.md#commit-date)

[![license](https://img.shields.io/badge/license-MIT-informational?style=flat-square)](LICENSE) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg?style=flat-square)](code_of_conduct.md)

---

## 📇 Table of Contents

- [About](#about)
- [Demo](#demo)
- [Features](#feature)
- [Getting Started](#getting-started)
- [Built With](#built-with)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [Versioning](#versioning)
- [Authors](#authors)
- [Licensing](#licensing)

##  📖 About

This is a console java application that allows the speed evaluating OWL 2 reasoners on a specified ontologies. This application was implemented in the evaluating owl 2 reasoning process for the `ORE 2014` paper.

### Motivation

During developing a model for representing the relational databases semantics in DL axioms and assetions, it was necessary to evaluate the reasoning speed of such a solution. This benchmark was developed and allowed to evaluate the reasoning speed of OWL 2 reasoners (such as TReasoner, Hermit, Fact++). The results of this evaluating were presented at `OWL Reasoner Evaluation Workshop 2014` in this article http://ceur-ws.org/Vol-1207/paper_8.pdf.

## 📸 Demo

These pictures demonstrate the benchmark results examples (time in ns).

- The results in `*.xls`:
![The results in xls](https://github.com/ololx/owl2-reasoners-benchmark/blob/assets/demo/owl2-reasoner-benchmark-demo-2.png?raw=true)

- The log output in `*.html`:
![The log in html](https://github.com/ololx/owl2-reasoners-benchmark/blob/assets/demo/owl2-reasoner-benchmark-demo-3.png?raw=true)

- The log in console/terminal:
![The log in console/terminal](https://github.com/ololx/owl2-reasoners-benchmark/blob/assets/demo/owl2-reasoner-benchmark-demo-1.png?raw=true)

## 🎚 Features

- Choose reasoners and run an estimate of the time spent on the selected resonators on a set of ontologies;

### To Do

- ~~For more information on an upcoming development, please read the todo list.~~ No plans.

### Changelog

- For more information on a releases, a features and a changes, please read the [changelog](CHANGELOG.md) notes.

## 🚦 Getting Started

These instructions allow to get a copy of this project and run it on a local machine.

### Installing

In order to install it is quite simple to clone or download this repository.

### Cloning

For the cloning this repository to a local machine, just use the follows link:

```http
https://github.com/ololx/owl2-reasoners-benchmark
```

### Using

To use it is necessary to:
1 - Build the project (via IDE tools or Ant).
2 - Configure the `OWL2ReasonersBenchmark`.
3 - Launch the `OWL2ReasonersBenchmark`.

### Configuring

It is possible to set test parameters (rezoners, folder with test data, folder for saving results, etc.) via the configuration file `cfg.ini`. The example of configurations is presented below:

```cfg
SEPARATOR = ;
RESULTS_DIR = E:
TEST_DIR = E:/q
REASONERS_LIST = HErmit;Treasoner
REASONING_LIST = CONSISTENT
TEST_ITERATION = 1
DELAY_BETWEEN_ITERATION = 17
```

### Launching

- Firstly, it is necessary to put ontologies in the directory defined as `TEST_DIR` in `cfg.ini`.
![The input dir with test data](https://github.com/ololx/owl2-reasoners-benchmark/blob/assets/demo/owl2-reasoner-benchmark-demo-input.png?raw=true)
- To execute this benchmark.

- After execution the benchmark results will be in the directory defined as `RESULTS_DIR` in `cfg.ini`.
![The output dir with results](https://github.com/ololx/owl2-reasoners-benchmark/blob/assets/demo/owl2-reasoner-benchmark-demo-output.png?raw=true)

## 🛠 Built With

- **[OWL API 3.4.10](https://github.com/owlcs/owlapi)** - the Java API for creating, manipulating and serialising OWL Ontologies.
- **[TREasoner](http://ceur-ws.org/Vol-1015/paper_2.pdf)** - the OWL DL Reasoner implemented in Java.
- **[FACT++ 1.6.2](https://www.w3.org/2001/sw/wiki/Fact)** - the OWL DL Reasoner implemented in C++.
- **[JFact](https://github.com/owlcs/jfact)** - the Java port of the FaCT++ OWL DL reasoner;.
- **[HermiT](https://github.com/phillord/hermit-reasoner)** - the OWL DL Reasoner implemented in Java.
- **[Pellet](https://github.com/stardog-union/pellet)** - the OWL DL Reasoner implemented in Java.
- **[MORe](https://www.cs.ox.ac.uk/isg/tools/MORe/)** - the OWL DL Reasoner implemented in Java.
- **[ELK](https://github.com/liveontologies/elk-reasoner)** - the OWL DL Reasoner implemented in Java.
- **[APACHE POI](https://poi.apache.org)** - the Java library for reading and writing Microsoft Office binary and OOXML file formats.
- **[Log4j](https://logging.apache.org/log4j/2.x/)** - the logging facade that may, of course, be used with the Log4j implementation, but may also be used in front of other logging implementations such as Logback.

## 🎉 Contributing

If you want to contribute this project - you are welcome and have fun.
Please visit the [contributing](CONTRIBUTING.md) section for details on this code of conduct, and the process for submitting pull requests.

## 📝 Code of Conduct

In order to ensure that all is welcoming, please review and abide by the [code of conduct](CODE_OF_CONDUCT.md).

## 🗒 Versioning

For the versioning is used [Semantic Versioning](http://semver.org/). For the versions available, see the [changelog](CHANGELOG.md) or the tags on this repository.

## © Authors

* **Alexander A. Kropotin** - *Initial work* - [ololx](https://github.com/ololx).

## 🔏 Licensing

This project is licensed under the MIT license - see the [lisence](LICENSE) document for details.

branch_name: refs/heads/main

gha_license_id: MIT


text:
# Why empty?

All required libraries for MPX go here.
This path is added to `LD_LIBRARY_PATH` in the `entropoint.py` file.
For legal reasons, these libraries are not stored in the repository.

gha_language: C


text:
# plsnap

Creates and manages Snapshots of schemas - without using DataPump, because sometimes that's just what you need.

Currently supports snapshoting and restoring of multischema PL/SQL apps containing

- tables
- indexes
- constraints
- views
- stored procedures - packages, functions, procedures
- triggers
- synonyms

User with **plsnap** deployed has to have really strong privileges - **DBA** role is the bestest. Otherwise you have to grant explicitly privileges on objects owned by `SYS`, as these cannot be granted even with `grant any object privilege` (read docs for detailed info)

# API

## createSnapshotDefinition

Creates **Snapshot Definition**.

### Params

- **definitionName** - unique definition name

## dropSnapshotDefinition

Drops **Snapshot Definition** and all **Snapshots** created with this definition.

- **definitionName** - definition name

## addSchema

Adds schema to **Snapshot Definition**

- **definitionName** - definition name
- **schemaName** - schema name

## dropSchema

Removes schema from **Snapshot Definition**

- **definitionName** - definition name
- **schemaName** - schema name

## createSnapshot

Creates **Snapshot** of schemas in **Snapshot Definition**

- **definitionName** - definition name
- **snapshotName** - unique snaphsot name

## dropSnapshot

Drops existing **Snapshot**

- **snapshotName** snapshot name

## restoreFromSnapshot

Restore from **Snapshot**

1. Drops all objects in schemas
2. Recreates them from **Snapshot**

- **snapshotName** - snapshot name

# Sample usage

```
prompt Create Snapshot Definition "Oracle Sample Schemas"
exec plsnap.createSnapshotDefinition(definitionName => 'Oracle Sample Schemas');

prompt Add SCOTT schema to Snapshot Definition
exec plsnap.addSchema(definitionName => 'Oracle Sample Schemas', schemaName => 'SCOTT');

prompt And create Snapshot "Before"
exec plsnap.createSnapshot(definitionName => 'Oracle Sample Schemas', snapshotName => 'Before');

prompt Before destroy
select count(*) from scott.dept;

prompt Destroy schema
drop table scott.dept cascade constraints purge;

prompt PANIC!!!
select count(*) from scott.dept;

prompt Restore
exec plsnap.restoreFromSnapshot(snapshotName => 'Before');

prompt Yay!
select count(*) from scott.dept;
```

# TODO

- add snapshot size info
- add some views for easier management
- add tests
- add some pretty outputs
- add debug calls
- implement other object types
    - materialzied views
    - ...
- implement usage from different schema - not implemented or tested

repository: s-oravec/plsnap

repo_name: s-oravec/plsnap


text:
## cuid

Collision-resistant hashes for the cloud, in Go.

The ```cuid`` package provides collision-resistant ids optimized for horizontal scaling and sequential lookup performance. This README file is just going to cover the basics and the Go-specific implementation details.

**Please refer to the [main project site](http://usecuid.org) for the full rationale behind CUIDs.**

## Sample CUID

ch72gsb320000udocl363eofy

# Installation

**HEAD:**

```go get github.com/lucsky/cuid```

**v1.0.0:**

```go get gopkg.in/lucsky/cuid.v1```

## Example usage

```Go
package main

import fmt
import "gopkg.in/lucsky/cuid.v1"

func main() {
    fmt.Println(cuid.New())
}
```

## Go package specific features

The Go cuid package provides APIs to specify a custom random source as well as a custom counter. A custom counter implementation could provide a centralized Redis base counter, for example.

## Contributors

- Luc Heinrich (lucsky, author)
- Thomas Hopkins (hopkinsth)

repository: grvcoelho/webhulk

gha_language: Go

repo_name: grvcoelho/webhulk


text:
---
title: ilo shell
date: 2020-04-13
menu: main
weight: 110
---

The `ilo shell` command can be used to run a single container either interactively (default) or in non-interactive mode (e.g. for CI builds). It can build an image, mount directories automatically, stop containers, remove images, and customize the build environment according to the needs of your project.

```console
# open shell for local builds in default image with default image command
[you@hostname project-dir]$ ilo shell
[root@container project-dir]#

# use custom image
[you@hostname project-dir]$ ilo shell maven:latest
[root@container project-dir]#

# use custom command
[you@hostname project-dir]$ ilo shell openjdk:11 jshell
[root@container project-dir]#

# run command non-interactive
[you@hostname project-dir]$ ilo shell --no-interactive openjdk:11 mvn verify
[you@hostname project-dir]$
```

`ilo shell` will delegate most of its work to one of the supported [runtimes](./runtimes). In order to override the default command of your image, specify the command you want to execute just after the image, like this:

```console
[you@hostname project-dir]$ ilo shell openjdk:11 /bin/bash
[root@container project-dir]#
```

In order to exit the container either use `exit` or hit `Ctrl + d`:

```console
[root@container project-dir]# exit
[you@hostname project-dir]$
```

Once you have exited the container, `ilo` will automatically stop and remove it. In order to remove the image as well, specify the `--remove-image` flag:

```console
[you@hostname project-dir]$ ilo shell --remove-image openjdk:11
[root@container project-dir]# exit
```

In order to pull an image first before opening a new shell, use the `--pull` flag like this:

```console
[you@hostname project-dir]$ ilo shell --pull openjdk:latest
[root@container project-dir]#
```

In case you want to use a local `Containerfile`/`Dockerfile`, use the `--containerfile`/`--dockerfile` flag like this:

```console
[you@hostname project-dir]$ ilo shell --containerfile your.containerfile your.image:latest
[root@container project-dir]#
```

The resulting image name will be `your.image:latest`. Take a look at all available [options](./options) or use `ilo shell --help` to get a list of all options, and their default values. In order to simplify handling of long command line options, consider using [argument files](../usage/argument-files).

repository: metio/ilo

gha_language: Java

repo_name: metio/ilo


text:
# How to create familiar's keys
In the Familiar shelter / gutter there is a menu that **generates a key**. Pressing 'X' when you try to store or retrieve a familiar on the shelter a small dialog appear with some random text. **Nobody knows the meaning**, there is no information on the Internet and probably is a **forgotten feature**. There are some [hidden image](http://gbatemp.net/threads/spanish-v1-0-released-ninokuni-shikkoku-no-madoushi-translation-project.310214/page-34#post-5176232) on the game, probably of the Demo version, with buttons to *Insert a key*, but they do not appear in the final game. As you can read in this document, the key **contains information about the familiar** and some random numbers. In my opinion, it was a final-not-implemented-feature **to share familiar globally**, sharing codes, without Internet connection, similar to save-keys when there wasn't save memories on video games or like *Pokémon Mystery Dungeon* to rescue another user.

1. [Copy stats from familiar](#copy-stats-from-familiar)
2. [Add random number](#add-random-number)
3. [Reverse](#reverse)
4. [Encrypt](#encrypt)
5. [Append CRC](#append-crc)
6. [Encrypt2](#encrypt2)
7. [Swap](#swap)
8. [Convert to text](#convert-to-text)
9. [Change of alphabet](#change-of-alphabet)

## Copy stats from familiar
Firstly and most important, the game copies familiar's stats. This is the purpose of the key and the last step when doing the reverse operation. The information to copy is the following. Beware it copies bits, not bytes.

| Field          | Bits  | Notes |
| -------------- |:-----:| ----- |
| Name           | 4 * 8 | Copy only the first 4 characters. |
| Level          | 7     | |
| Brand          | 3     | Bits 1-3 from 0x27. |
| Index          | 10    | |
| HP             | 7     | Divided by 8, less precision but higher values. |
| MP             | 7     | Divided by 8. |
| Attack         | 7     | Divided by 8. |
| Defense        | 7     | Divided by 8. |
| Magic Attack   | 7     | Divided by 8. |
| Magic Defense  | 7     | Divided by 8. |
| Ability        | 7     | Divided by 8. |

## Add random number
Next step is to add some random bits. The game implements a *pseudo-random generator* for 32-bits values. In this case, it updated the *pseudo-random* number and take 11 bits, skipping the first 16 bits, to write in our stream. That is:
```
random_number = update_random_number()
random_number >>= 16
stream.write_bits(random_number, 11)
```

The *pseudo-random number generator* is initialize with a 4-bytes pseudo-random number (TODO: figure out how). Each time it's used, the number is updated as follow. The constants values are set at the initialization (function `0x020D13A4`) and the three values are stored at `0x02143100`.
```
CONSTANT1 = 0x5D588B65
CONSTANT2 = 0x269EC3
new_random_number = random_number * CONSTANT1 + CONSTANT2
```

## Reverse
Reverse the current bytes so last byte is the first one.

## Encrypt
Encrypt the key with the `XOR` operator. The first operator will be like the key that it's updated each time the operation is applied. The second operator will be each byte of the current familiar key.

The encryption key is initialized with the first byte of the familiar key, this byte is not encrypted and remain the same thus. In this way, later doing the reverse operation we can know that value. After encrypting a byte, the key is updated moving its most significant bit to the less significant position and doing a `NOT` operation. The operation in python would be:

```python
FAMILIAR_KEY = [ ]  # 14 bytes key.
encrypt_key = FAMILIAR_KEY[0]

for i in range(1, len(FAMILIAR_KEY)):
    FAMILIAR_KEY[i] ^= encrypt_key
    encrypt_key = ((encrypt_key << 1) & 0xFF) | (encrypt_key >> 7)
    encrypt_key ^= 0xFF  # NOT operation, in this way no casting is needed.
```

## Append CRC
Next step is to generate some CRC-16 codes and mix them. The algorithm used is "CRC-16/GENIBUS" as described in this [CRC catalog](http://reveng.sourceforge.net/crc-catalogue) with this specification:
```
width=16 poly=0x1021 init=0xffff refin=false refout=false xorout=0xffff check=0xd64e
```

The first CRC is computed with the current 14-bytes length familra key. A second CRC value is calculated with the constant 9 bytes value:
```
21 6D EC 88 FF CC 85 EF A2
```
so it's always `0x00D3`. This constant is at `0x020CC1A4`. The bytes are copied in reverse and with a `NOT` operation.

Once both CRC are calculated, they are mixed doing the following `XOR` operation: `CRC1 XOR CRC2 XOR 0x62D3`. This value is appended at the end of the familiar key so we get a 16 bytes length key.

## Encrypt2
By using the CRC the game encrypt again the password. In this case it's involved a *psuedo random generator* different to the one previously used. The way it updates the 32-bits value is described below:
```
rnd = (rnd * 0x021FC436) + 1
```

Firstly, it's initialized adding `0x05888F27` to the CRC. Then, for each byte, the game first update the random number and by using the last byte do the `XOR` operation over a key value. Obviously the CRC is not encrypted so it's possible to initialize the key again to decrypt.
```python
rnd = 0x05888F27 + CRC
for i in range(len(FAMILIAR_KEY) - 2):
    rnd = (rnd * 0x021FC436) + 1      # Update random number
    encrypt_key = (rnd >> 24) & 0xFF  # Take last byte
    FAMILIAR_KEY[i] ^= encrypt_key    # Encrypt
```

## Swap
After encrypt the key, one the CRC byte is swap with a key value, in this way the full CRC-16 value is not at the end of the key, making more difficult to guess it. To do that, the previously used *random generator* is initialized with the constant `0x014A76E0` and updated, so the final *random* number would be `0x6DD89341`. The modulo operation is applied to this value and the length of the key without CRC, 14. The result, 11 (0xB), is the position where the first CRC value will be swapped.

```
rnd = 0x014A76E0              # Init random number
rnd = (rnd * 0x021FC436) + 1  # Update random number
idx = rnd % (len(FAMILIAR_KEY) - 2)  # Get index

# Swap
crc_pos = len(FAMILIAR_KEY) - 2
tmp = FAMILIAR_KEY[crc_pos]
FAMILIAR_KEY[crc_pos] = FAMILIAR_KEY[idx]
FAMILIAR_KEY[idx] = tmp
```

## Convert to text
The game convert the current 64-bits value to a string with a dictionary / alphabet. First it does the modulo operation to get the index of the char and then divide the value until it become 0. The *alphabet1* is used with length `0x3A` (58 chars) and 8-bits per char. It's at `0x0x020CC8E8`.
```python
ALPHABET1 = "0123456789abcdefghijkmnpqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"
```

The process in *Python* is the following (*Programs/script/Password.py*):
```python
text = ''
while data != 0:
    index = data % 0x3A
    text += ALPHABET1[index]
    data /= 0x3A
```

Once the key is in text format, the game checks if it can get back the value.
```
data_i = data_i-1 + (char_i_index * alphabet1_len^i)
```

In python (*Programs/scripts/Password.py*) it would be:
```python
ITERATION = 0xB
KEY = "" # 11 key-len here

data = 0
for i in range(ITERATION):
    idx = ALPHABET1.find(KEY[i])
    data = data + (idx * (len(ALPHABET1) ** i))
```

## Change of alphabet
The last operation is to mess the current key replacing each char with another. To do so, it's used the function `0x020C8BD0` with the following steps.

1. Check input is not null.
2. For each char:
    1. Get the index of char in the **alphabet 1**.
    2. Get the char in that index from the **alphabet 2**.
    3. Write the output char.
3. Write a null char at the end.

The *alphabet2* it's at `0x020CC924` with two bytes per char. The size is variable, until found a null char.
```
ALPHABET2 = "０１２３４５６７８９あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをん！？"
```

For the Spanish translation with the hack *Assembly/password/alphabet.asm* we replace the *alphabet 2* Japanese kanjis with ASCII chars and some UNICODE symbols like arrows and circles. The game continue to read two bytes to get a char, so if it's the index is in the ASCII part it replace one with two char.
A UNICODE char must start in an even position.

repository: Iemnur/Ninokuni

repo_name: Iemnur/Ninokuni


text:
# Personal Blog
This a personal blogging website where a writers can create and share their opinions and other users can read and comment on them

## Link

Link : [Tech Blog app](https://blog-koskey.herokuapp.com/)

## User Stories

User would like to:
- view the blog posts on the site
- comment on blog posts
- view the most recent posts
- receive an email alert when a new post is made by joining a subscription.
- see random quotes on the site

Writer would like to:
- sign in to the blog.
- create a blog from the application.
- delete comments that I find insulting or degrading.
- update or delete blogs I have created.

## Installation requirements:
-Python 3.8

-pip

-flask

-virtual enviroment

## Setup and Installation
- Clone or download and unzip the repository from github, https://github.com/p-koskey/personal-blog.

## Author
[Koskey Patience](https://github.com/p-koskey)

## License
This project is licensed under the MIT License.
Copyright(2020) Patience Koskey

repository: p-koskey/personal-blog

repo_name: p-koskey/personal-blog


text:
# serverless-offline-dotenv

Override environment variables configured in `serverless.yml` with any values
provided in a `.env` file located at the root of your project.

Both global and function-specific environment variables are overridden.

This plugin is intended for local development only, and is therefore only
invoked on `serverless offline start`.

## Installation

Install the plugin with NPM:

```bash
npm install --save-dev serverless-offline-dotenv
```

Add the plugin to your `serverless.yml` file:

```yaml
plugins:
    - serverless-offline-dotenv
    - serverless-offline
```

It is important that the `serverless-offline-dotenv` plugin is loaded before
`serverless-offline`.

## Creating a `.env` file

Create a file at the root of your project named `.env` containing the
environment variables that you want to override locally.

```
# /path/to/project/.env

DB_HOSTNAME=<IP_ADDRESS>
DB_USER=me
# Lines starting with a hash are treated as comments
DB_PASSWORD=secret
```

Your `.env` file may contain sensitive information so you should add it to your
`.gitignore` file.

You might want to provide a `.env.example` template to make setup easier for
other developers.

```
# /path/to/project/.env.example

DB_HOSTNAME=<IP_ADDRESS>
DB_USER=<your local database username here>
DB_PASSWORD=<your local database password here>
```

Developers can then create a `.env` file from the template by running
`cp .env{.example,}` and make the appropriate changes.

repository: azizur/serverless-offline-dotenv

repo_name: azizur/serverless-offline-dotenv


text:
---
title: Lead Developer/Tech Lead
categories: leadership development
---

### The Job

You will be a core member of a Program Team leading multiple Product Delivery teams of designers, researchers, developers, product and delivery managers who are working in an agile way to build world-class government digital services using modern open source tools and frameworks.

Reporting to the Snr. Program Delivery Manager you will form part of the Program Team, alongside the Service Design Lead, Product Management Lead, and a Delivery Manager with the authority to design and build digital government services, and do the hard work to radically improve the delivery of government information and services.

### Skills and Experience

- Experience building user-centric experiences for the web using HTML, CSS and Javascript
- Excellent development skills in one or more object oriented or functional programming languages.
- Familiarity with one or more modern web frameworks (MVC, MVVM, MVP)
- General experience working with a full stack development team with an deep understanding and passion in one or more areas (e.g., security, accessibility, i18n, l10n, backend integration, search, frameworks)
- Experience working in and contributing to open source projects and culture an enormous plus (contributions beyond code are highly valued).

### Responsibilities

In addition to being a part of the development process you will assist the program team:

- Supporting the Snr. Program Delivery Manager to lead the teams
- Hiring, leading, mentoring and monitoring the performance of developers in the teams
- Working with architecture and business leads to develop solutions that meet user needs and deliver business outcomes
- Setting the standards, defining the toolset and championing test driven development and a Devops approach to delivery
- Contributing to the Program’s engagement process whereby new ideas are assessed and prioritised for delivery by the teams


text:
# ApiClient_Arduino
A Simple RestClient for Arduino

## Description
The goal is to create a simple API Client. The API Client
simplifies communication with an API service by capsulation
the connection, request handling, and HTTP communtication conversion.


text:
---
layout: post
title: 'Simple classification app with CameraX, TFLite and Android TFLite support (Java)'
date: '2021-01-06'
categories: jekyll update
published: true
subtitle: >-
    How to use analyze method from CameraX altogether with the android tflite support library (Java)
use_math: true
---

# Introduction

I am novice to Android App development, however I have been developing neural network models for gesture recognition for microcontrollers for a while. I wanted then to try out to develop a simple classification app with Android.

In this blog post I will briefly describe the steps to build a simple application for classification using CameraX  and the Android TFLite support library, all with Java.

I have seen the massive shift that Google has taken towards Kotlin development, and it has been a little difficult for me to adapt and understand some of the code that I have stumbled upon, since  I was more interested in learning Java due to its broader scope of application. Anyway, most Kotlin code I've seen can be adapted to Java without great difficulty.

As a teaser, you can see the end of the demo here:

![](https://github.com/BCJuan/SimpleClassificationApp/raw/master/demo.gif)

The full code is at: [BCJuan/SimpleClassificationApp](https://github.com/BCJuan/SimpleClassificationApp).

The post will consist of two parts:

1. CameraX simple backbone
2. Classification procedure

## CameraX backbone

I have read that the CameraX API has [simplified the work of developers](https://developer.android.com/jetpack/androidx/releases/camera?hl=ru)  compared to Camera 2, but I do not know about that since I have not used Camera 2. What I can say is that using CameraX is not difficult. Let's see how we can do it.

### Layout

First, we define only two elements in a constrained layout: the camera preview, where the frames will be hold, and the text where the results from classification will be shown.

```
<androidx.constraintlayout.widget.ConstraintLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <androidx.camera.view.PreviewView
        android:id="@+id/viewFinder"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        tools:layout_editor_absoluteX="0dp"
        tools:layout_editor_absoluteY="133dp">
    </androidx.camera.view.PreviewView>

    <TextView
        android:id="@+id/tvResults"
        android:layout_width="match_parent"
        android:layout_height="100dp"
        android:background="#FFFFFF"
        android:foregroundTint="@color/white"
        android:textColor="#0C0C0C"
        android:textColorHint="#0E0C0C"
        android:visibility="visible"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintLeft_toLeftOf="parent"
        app:layout_constraintRight_toRightOf="parent"
        tools:visibility="visible" />
</androidx.constraintlayout.widget.ConstraintLayout>
```

### Camera Permissions and Libraries

We need permissions for the camera. First, we add to the `AndroidManifest.xml` the appropriate support:

```
<uses-feature android:name="android.hardware.camera.any" />
<uses-permission android:name="android.permission.CAMERA" />
```

Then, in the main class we add the definitions for the request code and required permissions:

```
private int REQUEST_CODE_PERMISSIONS = 1001;
private final String [] REQUIRED_PERMISSIONS = new String []{Manifest.permission.CAMERA};
```

Then, on the `onCreate` method we start the camera, but, of course, checking before if we have the permissions:

```
if (allPermissionsGranted()){
    startCamera();
}
else{
    ActivityCompat.requestPermissions(this, REQUIRED_PERMISSIONS,
            REQUEST_CODE_PERMISSIONS);
}
```

where we have the function `allPermissionsGranted`, which is just a checker of permissions, and the function `onRequestPermissionsResult`, which is activated after the user interaction with the permission UI and repeats the loop of permission check again:

```
private boolean allPermissionsGranted(){
    for(String permission: REQUIRED_PERMISSIONS){
        if(ContextCompat.checkSelfPermission(
                this, permission) != PackageManager.PERMISSION_GRANTED){
            return false;
        }
    }
    return true;
}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                                        @NonNull int[] grantResults) {
    if (requestCode == REQUEST_CODE_PERMISSIONS){
        if(allPermissionsGranted()){
            startCamera();
        }
        else{
            Toast.makeText(this, "Please, give access to camera",
                    Toast.LENGTH_SHORT).show();
            this.finish();
        }
    }
}
```
Also, we need to add the appropriate libraries to the `.gradle` file:

```
dependencies{
    ...
    implementation "androidx.camera:camera-camera2:$camerax_version"
    // CameraX Lifecycle Library
    implementation "androidx.camera:camera-lifecycle:$camerax_version"
    // CameraX View class
    implementation "androidx.camera:camera-view:1.0.0-alpha14"
    ...
}
```

### Camera

First, in the function `startCamera`, we instantiate a `ProcessCameraProvider`, which returns a `ListenableFuture` that will be linked to the lifecycle of parent (meaning we do not have to close and open the camera manually). After that, we add a listener with a runnable and the executor of the main thread. In the runnable we add the `ProcessCameraProvider` and proceed by binding the preview and other actions:

```
private void startCamera(){
    ListenableFuture<ProcessCameraProvider>
            cameraProviderFuture = ProcessCameraProvider.getInstance(this);
    cameraProviderFuture.addListener(
            new Runnable() {
                @Override
                public void run() {
                    try {
                        ProcessCameraProvider cameraProvider = cameraProviderFuture.get();
                        bindPreview(cameraProvider);
                    } catch (ExecutionException | InterruptedException e) { }
                }
            },
            ActivityCompat.getMainExecutor(this)
    );
}
```

In the `bindPreview` method we four different things:

+ Link surface preview (to link the camera to our preview were frames will be visualized)
```
Preview preview = new Preview.Builder().build();
preview.setSurfaceProvider(mPreviewView.createSurfaceProvider());
```

+ Establish camera selector and define its properties
```
CameraSelector cameraSelector = new CameraSelector.Builder().requireLensFacing(
        CameraSelector.LENS_FACING_BACK).build();
```

+ Establish Image analysis and related tasks, in this case, classification (explained later). If you want to test the app without classification (only showing the camera preview) you can delete the lines regarding __classifier__ and __tvResults__. In code:

```
ImageAnalysis imageAnalysis =
        new ImageAnalysis.Builder()
                .setBackpressureStrategy(ImageAnalysis.STRATEGY_KEEP_ONLY_LATEST)
                .build();

imageAnalysis.setAnalyzer(ActivityCompat.getMainExecutor(this),
        new ImageAnalysis.Analyzer() {
            @Override
            public void analyze(@NonNull ImageProxy image) {
                String result;
                result = classifier.classify(image);
                tvResults.setText(result);
                image.close();
            }
        });
```

+ Finally, unibind everything just in case, and bind the lifecycle
```
cameraProvider.unbindAll();
cameraProvider.bindToLifecycle(this, cameraSelector,
        preview, imageAnalysis);
```

With this we have everything set up with regards to the camera operability. As you may have seen it is really simple, and we do not use any further functionalities like `CameraCapture` with callbacks, for example. We are already set to classify with the analyze method, which will be run on every frame.

## Classification

We are going to use a quantized MobileNetV1 model reduced to a 1/4 of its size and using 128x128 images. See the [model link at TF Hub](https://tfhub.dev/tensorflow/lite-model/mobilenet_v1_0.25_128_quantized/1/metadata/1). It classifies ImageNet classes, so we are also going to need the labels.

To add the model you can follow the instructions at [Android quickstart guide](https://www.tensorflow.org/lite/guide/android) to add the model through ML Binding. This mainly means that you right-click on the Android left panel `res` and add a new file of the type `Other`->`Tensorflow Lite Model`. And that is it. In the case of the labels, you just need to add the `labels.txt` as an asset file by right-click in the android panel -> `New` -> `Assets folder` and creating there a file where the classes are stored.

As seen in the last section, in the image analysis we have called a `classifier.classify`. This comes from a class which holds everything realted to image processing and classification. Let's see:

```
public class Classifier {

    private Context context;
    Interpreter tflite;
    final String ASSOCIATED_AXIS_LABELS = "labels.txt";
    List<String> associatedAxisLabels = null;

    public Classifier(Context context)
    {
        this.context = context;

        try {
            associatedAxisLabels = FileUtil.loadLabels(context, ASSOCIATED_AXIS_LABELS);
        } catch (IOException e) {
            Log.e("tfliteSupport", "Error reading label file", e);
        }

        try{
            MappedByteBuffer tfliteModel
                    = FileUtil.loadMappedFile(context,
                    "mobilenet_v1_0.25_128_quantized_1_metadata_1.tflite");
            tflite = new Interpreter(tfliteModel);
        } catch (IOException e){
            Log.e("tfliteSupport", "Error reading model", e);
        }
    }
    ...
}
```

As you can see in the constructor of the class, first we load the labels intos a `List<String>` and then the model into an interpreter. Then the other important method is the classification:

```
public class Classifier {
    ...
    public String classify(ImageProxy image){
        @SuppressLint("UnsafeExperimentalUsageError")
        Image img = image.getImage();
        Bitmap bitmap = Utils.toBitmap(img);
        int rotation = Utils.getImageRotation(image);
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();

        int size = height > width ? width : height;
        ImageProcessor imageProcessor = new ImageProcessor.Builder()
                .add(new ResizeWithCropOrPadOp(size, size))
                .add(new ResizeOp(128, 128, ResizeOp.ResizeMethod.BILINEAR))
                .add(new Rot90Op(rotation))
                .build();
        TensorImage tensorImage = new TensorImage(DataType.UINT8);
        tensorImage.load(bitmap);
        tensorImage = imageProcessor.process(tensorImage);
        TensorBuffer probabilityBuffer =
                TensorBuffer.createFixedSize(new int[]{1, 1001}, DataType.UINT8);
        if(null != tflite) {
            tflite.run(tensorImage.getBuffer(), probabilityBuffer.getBuffer());
        }
        TensorProcessor probabilityProcessor =
                new TensorProcessor.Builder().add(new NormalizeOp(0, 255)).build();

        String result = " ";
        if (null != associatedAxisLabels) {
            // Map of labels and their corresponding probability
            TensorLabel labels = new TensorLabel(associatedAxisLabels,
                    probabilityProcessor.process(probabilityBuffer));

            // Create a map to access the result based on label
            Map<String, Float> floatMap = labels.getMapWithFloatValue();
            result = Utils.writeResults(floatMap);
        }
        return result;
    }
}
```

The analyze method returns an `ImageProxy` which first we convert to a Bitmap, and several infor about it.

```

Image img = image.getImage();
Bitmap bitmap = Utils.toBitmap(img);
int rotation = Utils.getImageRotation(image);
int width = bitmap.getWidth();
int height = bitmap.getHeight();
int size = height > width ? width : height;
```

You can find the `ImageProxy` to Bitmap conversion in `Utils.java`:

```
public static Bitmap toBitmap(Image image) {
    Image.Plane[] planes = image.getPlanes();
    ByteBuffer yBuffer = planes[0].getBuffer();
    ByteBuffer uBuffer = planes[1].getBuffer();
    ByteBuffer vBuffer = planes[2].getBuffer();

    int ySize = yBuffer.remaining();
    int uSize = uBuffer.remaining();
    int vSize = vBuffer.remaining();

    byte[] nv21 = new byte[ySize + uSize + vSize];
    //U and V are swapped
    yBuffer.get(nv21, 0, ySize);
    vBuffer.get(nv21, ySize, vSize);
    uBuffer.get(nv21, ySize + vSize, uSize);

    YuvImage yuvImage = new YuvImage(nv21, ImageFormat.NV21, image.getWidth(), image.getHeight(), null);
    ByteArrayOutputStream out = new ByteArrayOutputStream();
    yuvImage.compressToJpeg(new Rect(0, 0, yuvImage.getWidth(), yuvImage.getHeight()), 100, out);

    byte[] imageBytes = out.toByteArray();
    return BitmapFactory.decodeByteArray(imageBytes, 0, imageBytes.length);
}
```

Then what we do is to define the `ImageProcessor` that will hold the sequence of transforms to the input in order to be able to feed it to the model.

```
ImageProcessor imageProcessor = new ImageProcessor.Builder()
        .add(new ResizeWithCropOrPadOp(size, size))
        .add(new ResizeOp(128, 128, ResizeOp.ResizeMethod.BILINEAR))
        .add(new Rot90Op(rotation))
        .build();
```

In this case, we have croped the image to an square one to be able to resize it after preserving proportions and rotate if it is needed. Next, we create a `TensorImage` to hold the input image and load the Bitmap to it. Also, we create the vector of classes where the prediction of the model will be stored:

```
TensorImage tensorImage = new TensorImage(DataType.UINT8);
tensorImage.load(bitmap);
tensorImage = imageProcessor.process(tensorImage);
TensorBuffer probabilityBuffer =
        TensorBuffer.createFixedSize(new int[]{1, 1001}, DataType.UINT8);
```

Finally, we run the model, get the vector of probabilities and then normalize it:

```
if(null != tflite) {
    tflite.run(tensorImage.getBuffer(), probabilityBuffer.getBuffer());
}
TensorProcessor probabilityProcessor =
        new TensorProcessor.Builder().add(new NormalizeOp(0, 255)).build();
```
Finally, we only need to link the greatest values on the probability buffer to its classes and set it as text in the `TextView`
```
String result = " ";
if (null != associatedAxisLabels) {
    // Map of labels and their corresponding probability
    TensorLabel labels = new TensorLabel(associatedAxisLabels,
            probabilityProcessor.process(probabilityBuffer));

    // Create a map to access the result based on label
    Map<String, Float> floatMap = labels.getMapWithFloatValue();
    result = Utils.writeResults(floatMap);
}
return result;
```

# Conclusion

In this post I have shown how to build a simple Android app to classify objects. It makes use of CameraX Java API and TF Lite support library for androud, and show examples of some of the functionalities of both libraries. FOr example, we have seen the `Analyzer` method of CameraX and the `ImageProcessor` from TFLite Android Support Library, among other features.

Hope you like it. In next posts, we will try to build more complicated apps with purposes other than classification.

The full code is available at [BCJuan/SimpleClassificationApp](https://github.com/BCJuan/SimpleClassificationApp).

# References used to develop this app

+ [https://codelabs.developers.google.com/codelabs/camerax-getting-started/index.html?index=..%2F..index#1](https://codelabs.developers.google.com/codelabs/camerax-getting-started/index.html?index=..%2F..index#1)
+ [https://akhilbattula.medium.com/android-camerax-java-example-aeee884f9102](https://akhilbattula.medium.com/android-camerax-java-example-aeee884f9102)
+ [https://stackoverflow.com/questions/56772967/converting-imageproxy-to-bitmap](https://stackoverflow.com/questions/56772967/converting-imageproxy-to-bitmap)
+ [https://www.tensorflow.org/lite/guide/android](https://www.tensorflow.org/lite/guide/android)
+ [https://www.tensorflow.org/lite/inference_with_metadata/lite_support](https://www.tensorflow.org/lite/inference_with_metadata/lite_support)


text:
You can play it
[here](https://rsaihe.github.io/bullethell).

### Arrow Key Controls
* Arrow keys to move.
* Z to fire.
* X to slow down time.
* C to use a bomb to clear the screen of bullets.
* P to pause.

### WASD Controls
* WASD to move.
* B to fire.
* N to slow down time.
* M to use a bomb to clear the screen of bullets.
* P to pause.

#### Debugging controls
* F to toggle FPS display.
* G to toggle low graphics settings for slower computers.
* H to toggle displaying hitboxes.
* T to toggle black background.
* Y to toggle rendering stars.

repository: rsaihe/bullethell

repo_name: rsaihe/bullethell


text:
# **This is some text with GitHub flavored markdown**

#### *Markdown* is an easy way to style text the way you need it.

This link will take you to the phase-0-gps-1 repository on GitHub.

![Screenshot](GPS_1.1.png)


text:
---
layout: post
title: System.nanotime()
date: 2020-6-10
categories:
    - java
comments: true
permalink: java-nanotime.html
---

System.nanoTime()的返回值只和进程已运行的时间有关, 不受调系统时间影响.

**该方法只能用来测量时段而和系统时间无关。它的返回值是从某个固定但随意的时间点开始的（可能是未来的某个时间）。不同的JVM使用的起点可能不同**

```java
/**
* Returns the current value of the running Java Virtual Machine's
* high-resolution time source, in nanoseconds.
*
* <p>This method can only be used to measure elapsed time and is
* not related to any other notion of system or wall-clock time.
* The value returned represents nanoseconds since some fixed but
* arbitrary <i>origin</i> time (perhaps in the future, so values
* may be negative).  The same origin is used by all invocations of
* this method in an instance of a Java virtual machine; other
* virtual machine instances are likely to use a different origin.
*
* <p>This method provides nanosecond precision, but not necessarily
* nanosecond resolution (that is, how frequently the value changes)
* - no guarantees are made except that the resolution is at least as
* good as that of {@link #currentTimeMillis()}.
*
* <p>Differences in successive calls that span greater than
* approximately 292 years (2<sup>63</sup> nanoseconds) will not
* correctly compute elapsed time due to numerical overflow.
*
* <p>The values returned by this method become meaningful only when
* the difference between two such values, obtained within the same
* instance of a Java virtual machine, is computed.
*
* <p> For example, to measure how long some code takes to execute:
*  <pre> {@code
* long startTime = System.nanoTime();
* // ... the code being measured ...
* long estimatedTime = System.nanoTime() - startTime;}</pre>
*
* <p>To compare two nanoTime values
*  <pre> {@code
* long t0 = System.nanoTime();
* ...
* long t1 = System.nanoTime();}</pre>
*
* one should use {@code t1 - t0 < 0}, not {@code t1 < t0},
* because of the possibility of numerical overflow.
*
* @return the current value of the running Java Virtual Machine's
*         high-resolution time source, in nanoseconds
* @since 1.5
*/
public static native long nanoTime();
```

其中有一段描述是:

```java
*  <p>To compare two nanoTime values
*  <pre> {@code
* long t0 = System.nanoTime();
* ...
* long t1 = System.nanoTime();}</pre>
*
* one should use {@code t1 - t0 < 0}, not {@code t1 < t0},
* because of the possibility of numerical overflow.
```

**JDK表明比较两个nanoTime的时候，应该用t1 - t2 > 0的方式来比较，而不能用 t1 > t2的方式来比较，因为nanoTime在获取时有数值溢出的可能。**

> The Nano time is not a 'real' time, it is just a counter that increments starting from some unspecified number when some unspecified event occurs (maybe the computer is booted up).
>
> It will overflow, and become negative at some point. If your t0 is just before it overflows (i.e. very large positive), and your t1 is just after (very large negative number), then t1 < t0 (i.e. your conditions are wrong because t1 happened after t0).....
>
> But, if you say t1 - t0 < 0, well, the magic is that a for the same overflow (undeflow) reasons (very large negative subtract a very large positive will underflow), the result will be the number of nanoseconds that t1 was after t0..... and will be right.
>
> In this case, two wrongs really do make a right!

System.nanoTime()返回的数值实际是64位无符号数, 随着进程运行时间增长, 溢出后再从0开始, 赋值给long类型相当于当做补码数(有符号数)使用, 其值循环规律如下:

最小负数 -> 0 -> 最大正数 -> 最小负数 -> ...

假设有两次先后顺序未知的调用, 且两次调用时间间隔小于2^63ns (约200+year)
long t1 = System.nanoTime();
long t2 = System.nanoTime();

如果t1和t2都是正数或t1和t2都是负数, 则t1和t2的差不会超过2^63, 它们相减不会溢出, t1>t2 <=> t1-t2>0, 且较大的数一定是后一次调用返回的, 所以用相减比较和><运算符比较都可以 ;
如果t1和t2一正一负, 设t2是正数, 对比它们作为无符号数时的值, 可以知道负数t1才是后一次调用返回的, 所以由t2>t1得出t2是后一次调用是错误的. 另外我们假设了两次调用间隔小于2^63, t2-t1的值一定大于2^63 (放在long里面是负数), 所以有t2-t1<0, 此时用相减来判断仍然是正确的.


text:
Under development! Experimental stage. Agenda package adds processing time to the original cron.

For general cron functions, refer to [![GoDoc](http://godoc.org/github.com/robfig/cron?status.png)](http://godoc.org/github.com/robfig/cron)

# agenda
To download agenda
	go get github.com/Vinggui/agenda

Import it in your program as:

	import "github.com/Vinggui/agenda"

It requires Go 1.11 or later due to usage of Go Modules.

### Background - Cron spec format

There are two cron spec formats in common usage:

- The "standard" cron format, described on [the Cron wikipedia page] and used by
  the cron Linux system utility.

- The cron format used by [the Quartz Scheduler], commonly used for scheduled
  jobs in Java software

[the Cron wikipedia page]: https://en.wikipedia.org/wiki/Cron
[the Quartz Scheduler]: http://www.quartz-scheduler.org/documentation/quartz-2.x/tutorials/crontrigger.html

The original version of this package included an optional "seconds" field, which
made it incompatible with both of these formats. Now, the "standard" format is
the default format accepted, and the Quartz format is opt-in.

### Background - Agenda spec format

In additional, if user selects the agenda parser instead, you can do:

#### Select the days of the year (DoY). A list of MM/DD can be passed inside the []
	@doy [12/04 03/02] * *         <-- Default parser
	@doy [12/04 03/02] * * *       <-- Quartz format which includes the seconds
 Obs: the dates do not need to be sorted.

#### Select the *at* a specific date
	@at 2019-12-02T15:04:05Z
	@at 2020-02-29T15:04:05-03:00
 Obs: Command "at" is now using the RFC3339 format.
      Only one date can be passed

#### Add a delay to the schedule. Delay is give by a "+<time.ParseDuration>"
	+14m21s */10 * * * *                  <-- Default parser
	+14m21s */10 * * * * *                <-- Quartz format which includes the seconds
	+2h @doy [12/04 03/02] * * *
	+12s @at 2020-02-29T15:04:05-03:00

repository: Vinggui/agenda

repo_name: Vinggui/agenda


text:
---
layout: website
name: double-sweep
filter-act:
filter-type:
second-level-menu-active: movement
---

{% include second-menu-elements.html %}

      Catalog of Patterns: Structural Patterns / Foot
      and Arm Combinations: Pointing

Double sweep (sashi wake)

      All Point patterns involve raising the right arm and pointing the fan. The
      different names come from the motion, in which the performer’s arm leads
      to the pointing conclusion.

      The Double sweep (sashi wake) combines a left Overhand point, a
      Left turn, three steps forward, and a sweep of the right arm as the left
      one completes the downward motion of the Overhand point. In this example,
      it is performed in Martial mode, followed by a circling to the right with
      a fan still in pointing position.

          {% include video-no-background.html
          src="https://d3msn78fivoryj.cloudfront.net/Dance_sl/Kata-Han_sashi_wake_Front.mp4"
          %}

          {% include video-no-background.html
          src="https://d3msn78fivoryj.cloudfront.net/Dance_sl/Kata-Han_sashi_wake_Side.mp4"
          %}

repository: sul-cidr/noh

branch_name: refs/heads/develop

gha_language: HTML

repo_name: sul-cidr/noh


text:
# nuxt-module-auth0
[![npm (scoped with tag)](https://img.shields.io/npm/v/nuxt-module-auth0/latest.svg?style=flat-square)](https://npmjs.com/package/nuxt-module-auth0)
[![npm](https://img.shields.io/npm/dt/nuxt-module-auth0.svg?style=flat-square)](https://npmjs.com/package/nuxt-module-auth0)
[![CircleCI](https://img.shields.io/circleci/project/github/breadwallet/nuxt-module-auth0.svg?style=flat-square)](https://circleci.com/gh/breadwallet/nuxt-module-auth0)
[![Codecov](https://img.shields.io/codecov/c/github/breadwallet/nuxt-module-auth0.svg?style=flat-square)](https://codecov.io/gh/breadwallet/nuxt-module-auth0)
[![Dependencies](https://david-dm.org/breadwallet/nuxt-module-auth0/status.svg?style=flat-square)](https://david-dm.org/breadwallet/nuxt-module-auth0)
[![js-standard-style](https://img.shields.io/badge/code_style-standard-brightgreen.svg?style=flat-square)](http://standardjs.com)

> Module for integrating auth0.

[📖 **Release Notes**](./CHANGELOG.md)

## Features

Use auth0 for login/auth in the simplest possible way.  Hooks and configuration for progressive increases in complexity.

## Setup
- Add `nuxt-module-auth0` dependency using yarn or npm to your project
- Add `nuxt-module-auth0` to `modules` section of `nuxt.config.js`

- Set AUTH0_DOMAIN, AUTH0_CLIENT_ID, and AUTH0_CLIENT_SECRET environment variables (or set these via config arguments).

```js
{
  modules: [
    // Simple usage
    'nuxt-module-auth0',

    // With options
    ['nuxt-module-auth0', { /* module options */ }],
 ]
}
```

You will likely want to set a cookie secret - either by setting the
COOKIE_SECRET environment variable, or passing it in as an option
(`cookie.keys: [ 'active-secret','old-secret' ]`).  If you do neither,
it makes up a random cookie signing thing, which means that every time
the server restarts, all old sessions are invalidated.  Not a terrible
security default, but will certainly annoy some people.

## Usage

Once you have added this module (and restarted nuxt), you'll have two
new URLs you can hit:

- /auth0/login?then=<urlencoded-link>
- /auth0/logout

If you want a particular page/layout/etc to require authentication,
simply add middleware to it:

```
export default {
  middleware: ['admin-only'],
}
```

and add the middleware itself:

```
export default async function(ctx) {
  let user;

  if(process.server) {
    var session = ctx.req.session
    user = session && session.passport && session.passport.user

  } else {
    user = ctx.store.state.user
  }

  if(!user || user['https://brd.com/role'] != 'administrator') {
    ctx.redirect(`/please-login?as=administrator&then=${encodeURIComponent(ctx.route.path)}`);
  }
}

```

This particular example stores user data in the store, like so (this would be store/index.js):

```
export const state = () => ({
  user: null,
})

export const mutations = {
  user(state,val) {
    state.user = val;
  }
}

export const actions = {
  nuxtServerInit ({ commit }, { req }) {
    console.log("SESSION: ",req.session);
    if (req.session.passport && req.session.passport.user) {
      commit('user', req.session.passport.user)
    }
  }
}
```

It also depends on a `/pages/please-login.vue` file to handle redirected "not-authorized" users:

```
<template>
  <div>
    <p>
      Please log in!  You need the role of {{ $route.query.as }}.
    </p>
    <p>
      <a :href="`/auth0/login?then=${encodeURIComponent($route.query.then)}`">Log In</a>
    </p>
  </div>
</template>
<script>

export default {

}

</script>
```

The idea here is to minimize integration pain, and make it really easy
to keep track of how things are integrating.  We could in principle
add these files to the module itself, but they're basically guaranteed
to need changing, and often they'll have app-specific logic around them.

If you want to customize how the module adds cookie data, you can add
a callback.  By default, it stores everything from the JWT in the
cookie.  If you just want the highlights:

```
  modules: [
    ['nuxt-module-auth0',{
      callback: (accessToken,refreshToken,params,profile) => profile._json
    }],
  ],
```

Anything returned from the callback will be stored in the cookie, so
feel free to customize.

## RBAC

I want roles!  How do I get roles to work in Auth0?  Here's an example
rule you could add, which automatically provisions user accounts with
a certain email domain administrative access:

```
function (user, context, callback) {
  user.app_metadata = user.app_metadata || {};
  // You can add a Role based on what you want
  // In this case I check domain
  var addRolesToUser = function(user, cb) {
    if (user.email &&<EMAIL_ADDRESS>> -1) {
      cb(null, 'administrator');
    } else {
      cb(null, 'user');
    }
  };

  addRolesToUser(user, function(err, role) {
    if (err) {
      callback(err);
    } else {
      user.app_metadata.role = role;
      auth0.users.updateAppMetadata(user.user_id, user.app_metadata)
        .then(function(){
          context.idToken['https://example.com/role'] = user.app_metadata.role;
          callback(null, user, context);
        })
        .catch(function(err){
          callback(err);
        });
    }
  });
}
```

## Development

- Clone this repository
- Install dependnecies using `yarn install` or `npm install`
- Start development server using `npm run dev`

## License

[MIT License](./LICENSE)

Copyright (c) Daniel Staudigel