🏄♂️
This file contains hidden or 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
{ | |
"access_token":"xxxxxx.xxxxxx.xxxxxx-xxxxx-xxxxx-xxxxx", | |
"refresh_token":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", | |
"expires_in":"1800", | |
"token_type":"Bearer", | |
"xero_tenant_id":"xxxxxx-xxxx-xxxx-xxxx-xxxxxxxx" | |
} |
This file contains hidden or 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 'securerandom' | |
TOKEN = 'VALID_OAUTH_10A_ACCESS_TOKEN' | |
CONSUMER_KEY = 'YOUR_CONSUMER_KEY' | |
SCOPES = 'accounting.transactions offline_access' | |
OAUTH2_CLIENT_ID = 'YOUR_OAUTH20_CLIENT_ID' | |
OAUTH2_CLIENT_SECRET = 'YOUR_OAUTH20_CLIENT_SECRET' | |
SIGNATURE_METHOD = 'RSA-SHA1' | |
ENDPOINT = 'https://api.xero.com/oauth/migrate' |
This file contains hidden or 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 'uri' | |
require 'json' | |
require 'net/http' | |
uri = URI.parse(ENDPOINT) | |
http = Net::HTTP.new(uri.host, uri.port) | |
http.use_ssl = true | |
headers = {'Content-Type' =>'application/json', 'Authorization': authorization_header} | |
request = Net::HTTP::Post.new(uri.request_uri, headers) |
This file contains hidden or 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 'uri' | |
signature_base_string = "POST&" + # Uppercase HTTP method | |
"#{URI.encode_www_form_component(ENDPOINT)}&" + # Base URI | |
URI.encode_www_form_component(base_params).to_s # OAuth parameter string |
This file contains hidden or 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 'uri' | |
require 'base64' | |
require 'openssl' | |
require 'digest/sha1' | |
signing_key = File.read('./privatekey.pem') | |
rsa_key = OpenSSL::PKey::RSA.new signing_key | |
digest = OpenSSL::Digest::SHA1.new | |
signature = rsa_key.sign(digest, signature_base_string) |
This file contains hidden or 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
base_params = "oauth_consumer_key=#{CONSUMER_KEY}" + | |
"&oauth_nonce=#{NONCE}" + | |
"&oauth_signature_method=#{SIGNATURE_METHOD}" + | |
"&oauth_timestamp=#{TIMESTAMP}" + | |
"&oauth_token=#{TOKEN}" + | |
"&oauth_version=1.0" + | |
"&tenantType=ORGANISATION" |
This file contains hidden or 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
{ | |
"_type":"export", | |
"__export_format":4, | |
"__export_date":"2020-02-03T22:17:29.587Z", | |
"__export_source":"insomnia.desktop.app:v7.0.6", | |
"resources":[ | |
{ | |
"_id":"req_1a56b9b120a94264b79018d1ecee95f3", | |
"authentication":{ | |
"accessTokenUrl":"https://identity.xero.com/connect/token", |
This file contains hidden or 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
/* Can compare deploying a smart contract to tightly versioning an API. | |
Once a smart contract is distrubted & added to ETH it can never be removed. | |
Updates to a smart contract, require a re-deployment. | |
*/ | |
pragma solidity ^ 0.4 .19; | |
contract FaceBlock { | |
// We declare high level variables & types used throughout contract | |
mapping(address => uint256) private addressToIndex; |