Sha256: e33debf17f313ca8fa010cb20b04860f85a621a4a3bd032d4e627da543992708
Contents?: true
Size: 1 KB
Versions: 1
Compression:
Stored size: 1 KB
Contents
require "httparty" module NuID::SDK::API class Auth include HTTParty base_uri "https://auth.nuid.io" attr_reader :api_key def initialize(api_key) @api_key = api_key self.class.headers({ "X-API-Key" => @api_key, "Accept" => "application/json" }) end def challenge_get(credential) _post("/challenge", {"nuid/credential" => credential}) end def challenge_verify(challenge_jwt, proof) _post("/challenge/verify", { "nuid.credential.challenge/jwt" => challenge_jwt, "nuid.credential/proof" => proof }) end def credential_create(verified_credential) _post("/credential", {"nuid.credential/verified" => verified_credential}) end def credential_get(nuid) self.class.get("/credential/#{nuid}") end private def _post(path, body) self.class.post(path, { headers: {"Content-Type" => "application/json"}, body: body.to_json }) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nuid-sdk-0.1.0 | lib/nuid/sdk/api/auth.rb |