Project

silkey-sdk

0.0
No commit activity in last 3 years
No release in over 3 years
Silkey SDK for Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.0
~> 0.13
~> 13.0
~> 6.2, >= 6.2.1
~> 3.10
~> 1.3
~> 0.9.25

Runtime

~> 0.4.12
~> 2.2.2
~> 1.0
 Project Readme

Silkey SDK for Ruby

Silkey Logo

GitHub version Gem Version

Integration

Configuration

Silkey::Configuration.setup do |config|
  # for local development, use local provider url eg 'http://localhost:8545'
  # for testing, we recommend using infura.io:
  # - for sandbox: https://rinkeby.infura.io/v3/:id 
  # - for production: https://mainnet.infura.io/v3/:id 
  config.client_url =  'http://localhost:8545'
  config.registry_contract_address =  '--silky-registry-contract-address--'
  config.enable_logs = false
end

List of Silkey smart contract addresses.

Sign In with Silkey

Making request

Parameter Required Type Desc
ssoSignature yes string Domain owner signature
ssoTimestamp yes number Time of signing SSO request
ssoRedirectUrl yes string Where to redirect user with token after sign in
ssoCancelUrl yes string Where to redirect user on error
ssoRedirectMethod no GET/POST How to redirect user after sign in, default is POST
ssoRefId no string Any value, you may use it to identify request
ssoScope no string Scope of data to return in a token payload: id (default) returns only user address, email returns address + email
params = { ssoRedirectUrl: 'https://your-website', ssoRefId: '12ab' }
sso_params = Silkey::SDK.generate_sso_request_params(private_key, params)

On request callback page

Callback will be done via POST (default) or GET, based on ssoRedirectMethod.

Callback params contains:

  • sso parameters that were used to make SSO call
  • token.

token - get if from request params

ssoRequestParams - get if from request params (it can be send via POST or GET, based on ssoRedirectMethod)

silkey_eth_address = Silkey::SDK.fetch_silkey_eth_address
Silkey::SDK.token_payload_verifier(token, silkey_eth_address)

Recommendations and Migration

See recommendation and migration sections on main SDK package.

License

The gem is available as open source under the terms of the MIT License.