This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ICGIncognia getInstallationId:^(NSString *installationId) { | |
if (installationId != nil) { | |
// NSURLRequest | |
[request setValue:installationId forHTTPHeaderField:@"Incognia-Installation-ID"]; | |
} | |
// Send the request with the installationId to your backend server | |
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# sessions_controller.rb | |
class SessionsController < ApplicationController | |
def create | |
@login_form = LoginForm.new(params) | |
if @user = @login_form.submit | |
sign_in @user | |
redirect_to @user, notice: "Welcome!" | |
else | |
render action: :new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# login_form.rb | |
class LoginForm < BaseForm | |
attr_accessor :email, :password, :incognia_installation_id | |
validates :email, :password, presence: true | |
validate :device_risk | |
# Other validations... | |
def submit | |
return nil if invalid? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'faraday' | |
require 'json' | |
module Incognia | |
class Api | |
include Singleton | |
API_HOST = 'https://api.us.incognia.com/api/'.freeze | |
def register_login(installation_id:, account_id:) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"evidence": { | |
"account_integrity": {...}, | |
"addresses": [...], | |
"device_behavior_reputation": "allowed", | |
"device_fraud_reputation": "allowed", | |
"device_integrity": { | |
"emulator": false, | |
"from_official_store": true, | |
"gps_spoofing": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kotlin | |
Incognia.setUserId(context, <userId>) | |
Java | |
Incognia.setUserId(context, <userId>); | |
Swift | |
ICGIncognia.setUserId(<userId>) | |
Objective-C |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// components/Task.js | |
import CardContent from "@mui/material/CardContent"; | |
import Typography from "@mui/material/Typography"; | |
import CardActions from "@mui/material/CardActions"; | |
import Button from "@mui/material/Button"; | |
import Card from "@mui/material/Card"; | |
export default function Task(props) { | |
return ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pages/index.js | |
import Card from "@mui/material/Card"; | |
import CardContent from "@mui/material/CardContent"; | |
import Button from "@mui/material/Button"; | |
import Typography from "@mui/material/Typography"; | |
import {Box, Container, Grid} from "@mui/material"; | |
import Task from "../components/Task"; | |
import * as React from "react"; | |
import {useEffect, useState} from "react"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// pages/add.js | |
import * as React from "react"; | |
import {useState} from "react"; | |
import {Box, Container, FormControlLabel, FormGroup, Switch, TextField} from "@mui/material"; | |
import Typography from "@mui/material/Typography"; | |
import Button from "@mui/material/Button"; | |
import CardContent from "@mui/material/CardContent"; | |
import Card from "@mui/material/Card"; | |
import Link from "next/link"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// store/storage.js | |
import {create} from "zustand"; | |
import {persist} from "zustand/middleware"; | |
const useGlobalStore = create( | |
persist( | |
(set, get) => ({ | |
tasks: [], | |
addTask: (params) => { |