Class: Selenium::WebDriver::Credential
Relationships & Source Files | |
Inherits: | Object |
Defined in: | rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb |
Class Method Summary
Instance Attribute Summary
- #id readonly
- #private_key readonly
-
#resident_credential?
readonly
Alias for #resident_credential.
- #rp_id readonly
- #sign_count readonly
- #user_handle readonly
Instance Method Summary
- #resident_credential (also: #resident_credential?) readonly
- #as_json Internal use only Internal use only
Constructor Details
.new(id:, resident_credential:, rp_id:, private_key:, **opts) ⇒ Credential
# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 59
def initialize(id:, resident_credential:, rp_id:, private_key:, **opts) @id = id @resident_credential = resident_credential @rp_id = rp_id @user_handle = opts.delete(:user_handle) { nil } @private_key = private_key @sign_count = opts.delete(:sign_count) { 0 } raise ArgumentError, "Invalid arguments: #{opts.keys}" unless opts.empty? end
Class Method Details
.decode(base64)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 41
def decode(base64) Base64.urlsafe_decode64(base64).unpack('C*') end
.encode(byte_array)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 37
def encode(byte_array) Base64.urlsafe_encode64(byte_array&.pack('C*')) end
.from_json(opts)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 45
def from_json(opts) user_handle = opts['userHandle'] ? decode(opts['userHandle']) : nil new(id: decode(opts['credentialId']), resident_credential: opts['isResidentCredential'], rp_id: opts['rpId'], private_key: opts['privateKey'], sign_count: opts['signCount'], user_handle: user_handle) end
.non_resident(**opts)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 33
def non_resident(**opts) Credential.new(resident_credential: false, **opts) end
.resident(**opts)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 29
def resident(**opts) Credential.new(resident_credential: true, **opts) end
Instance Attribute Details
#id (readonly)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 56
attr_reader :id, :resident_credential, :rp_id, :user_handle, :private_key, :sign_count
#private_key (readonly)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 56
attr_reader :id, :resident_credential, :rp_id, :user_handle, :private_key, :sign_count
#resident_credential? (readonly)
Alias for #resident_credential.
# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 57
alias resident_credential? resident_credential
#rp_id (readonly)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 56
attr_reader :id, :resident_credential, :rp_id, :user_handle, :private_key, :sign_count
#sign_count (readonly)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 56
attr_reader :id, :resident_credential, :rp_id, :user_handle, :private_key, :sign_count
#user_handle (readonly)
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 56
attr_reader :id, :resident_credential, :rp_id, :user_handle, :private_key, :sign_count
Instance Method Details
#as_json
This method is for internal use only.
[ GitHub ]
# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 74
def as_json(*) credential_data = {'credentialId' => Credential.encode(id), 'isResidentCredential' => resident_credential?, 'rpId' => rp_id, 'privateKey' => Credential.encode(private_key), 'signCount' => sign_count} credential_data['userHandle'] = Credential.encode(user_handle) if user_handle credential_data end
#resident_credential (readonly) Also known as: #resident_credential?
[ GitHub ]# File 'rb/lib/selenium/webdriver/common/virtual_authenticator/credential.rb', line 56
attr_reader :id, :resident_credential, :rp_id, :user_handle, :private_key, :sign_count