Skip to content

Instantly share code, notes, and snippets.

View claytn's full-sized avatar
🌺

Clayton Marshall claytn

🌺
View GitHub Profile

SFOX API DOUBLE-LAYER AUTHENTICATION

API double-layer authentication is a feature inside SFOX Custody that lets users of the SFOX API improve security of their account using public/private key cryptography. Users will upload their public key to SFOX and upon each subsequent API request the user will need to provide a new header containing information signed by their private key.

Creating a public/private key pair (RSA 2048 bit)

# Generate private key and store in a file named private-key.pem
openssl genrsa -out private-key.pem 2048

Keybase proof

I hereby claim:

  • I am claytn on github.
  • I am claytn (https://keybase.io/claytn) on keybase.
  • I have a public key ASAGer1LbFGcKEypC7akpA4KNsx2kd7buXnZQ-WdGTyAxwo

To claim this, I am signing this object:

const pipe = (...fns) => (input) => {
return fns.reduce((acc, f) => {
return f(acc)
}, input)
}
// referring to the earlier example
const loudGreeting = pipe(greet, capitalize, exclaim)(name)
console.log(loudGreeting) // HELLO, CHARLES!!!
const name = "charles"
const greet = name => `Hello, ${name}`
const capitalize = str => str.toUpperCase()
const exclaim = str => `${str}!!!`
const loudGreeting = exclaim(capitalize(greet(name)))
const name = "charles"
const greet = name => `Hello, ${name}`
const capitalize = str => str.toUpperCase()
const exclaim = str => `${str}!!!`
const loudGreeting = name
|> greet
const doubled_num = double(num)
console.log(doubled_num) // 10
@claytn
claytn / pipeline_example_1.js
Created January 6, 2020 23:38
pipeline_example_1
const double = x => x * 2
const num = 5
const doubled_num = num |> double
console.log(doubled_num) // 10