Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Natália Condê nataliaconde

🏠
Working from home
  • SJC - SP, BR
View GitHub Profile
View setUserId.txt
Kotlin
Incognia.setUserId(context, <userId>)
Java
Incognia.setUserId(context, <userId>);
Swift
ICGIncognia.setUserId(<userId>)
Objective-C
View response.json
{
"evidence": {
"account_integrity": {...},
"addresses": [...],
"device_behavior_reputation": "allowed",
"device_fraud_reputation": "allowed",
"device_integrity": {
"emulator": false,
"from_official_store": true,
"gps_spoofing": false,
View api.rb
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:)
@nataliaconde
nataliaconde / login_form.rb
Last active Jun 28, 2021
authentication logic
View login_form.rb
# 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?
@nataliaconde
nataliaconde / sessions_controller.rb
Last active Jun 28, 2021
Ruby controller/handler
View sessions_controller.rb
# 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
@nataliaconde
nataliaconde / Incognia
Created Jun 16, 2021
Incognia Objective-C
View Incognia
[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
}];
View Incognia.java
Incognia.getInstallationId(context, new IncogniaListener<String>() {
@Override
public void onResult(final Result<String> result) {
if (result.isSuccessful()) {
String installationId = result.getResult();
// HttpURLConnection
httpUrlConnection.setRequestProperty("Incognia-Installation-ID", installationId);
}
View Incognia-Kotlin.kt
Incognia.getInstallationId(context) { result ->
if (result.isSuccessful) {
val installationId = result.result
// HttpURLConnection
httpUrlConnection.setRequestProperty("Incognia-Installation-ID", installationId)
}
// Send the request with the installationId to your backend server
}
@nataliaconde
nataliaconde / distance.js
Created Aug 11, 2020
Building the External API Cal
View distance.js
var request = require('request');
const apiKey = process.env.ZIPCODE_API_KEY || "hkCt1nW1wF1rppaEmoor7T9G4ta7R5wFSu8l1dokNz8y53gGZHDneWWVosbEYirC";
const zipCodeURL = 'https://www.zipcodeapi.com/rest/';
var distance = {
find: function(req, res, next) {
@nataliaconde
nataliaconde / controller.js
Created Aug 11, 2020
Create Controller Logic
View controller.js
'use strict';
var properties = required('../package.json');
var distance = require('../service/distance');
var controllers = {
about: function(req,res){
var aboutInfo = { name:properties.name, version: properties.version }
res.json(aboutInfo);
},
get_distance: function(req, res){