Module: U2fhost

Defined in:
lib/u2fhost/version.rb,
lib/u2fhost.rb,
ext/u2fhost/u2fhost.c

Overview

Copyright 2020 Xaptum,Inc

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Classes: ERROR

Constant Summary collapse

VERSION =
"1.0.0"

Class Method Summary collapse

Class Method Details

.call_ext_blockObject

Raises:



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/u2fhost.rb', line 38

def self.call_ext_block
  ## call extenstion
  hash = yield

  ## parse return value from the calling extenstion
  ## raise exception if error response
  raise U2fhost::ERROR, hash[:error] if hash[:error]

  ## return response
  hash[:response]
end

.ext_register(rb_challenge, rb_origin) ⇒ Object

register



127
128
129
# File 'ext/u2fhost/u2fhost.c', line 127

static VALUE ext_register(VALUE self, VALUE rb_challenge, VALUE rb_origin) {
  return do_u2f_action(self, rb_challenge, rb_origin, REGISTER);
}

.ext_sign(rb_challenge, rb_origin) ⇒ Object

sign



132
133
134
# File 'ext/u2fhost/u2fhost.c', line 132

static VALUE ext_sign(VALUE self, VALUE rb_challenge, VALUE rb_origin) {
  return do_u2f_action(self, rb_challenge, rb_origin, SIGN);
}

.register(challenge, origin) ⇒ Object

register API



27
28
29
30
# File 'lib/u2fhost.rb', line 27

def self.register(challenge, origin)
  ## call extenstion
  call_ext_block { ext_register(challenge, origin) }
end

.sign(challenge, origin) ⇒ Object

sign API



33
34
35
36
# File 'lib/u2fhost.rb', line 33

def self.sign(challenge, origin)
  ## call extenstion
  call_ext_block { ext_sign(challenge, origin) }
end