Top Level Namespace

Defined Under Namespace

Modules: Siwe

Constant Summary collapse

DOMAIN =
%r{(?<domain>[^/?#]+)}.freeze
SIWE_DOMAIN =
%r{^#{DOMAIN.source} wants you to sign in with your Ethereum account:}.freeze
SIWE_ADDRESS =
%r{\n(?<address>0x[a-zA-Z0-9]{40})\n\n}.freeze
SIWE_STATEMENT =
%r{((?<statement>[^\n]+)\n)?}.freeze
RFC3986 =
%r{(([^:?#]+):)?(([^?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?}.freeze
SIWE_URI_LINE =
%r{\nURI: (?<uri>#{RFC3986.source}?)}.freeze
SIWE_VERSION =
%r{\nVersion: (?<version>1)}.freeze
SIWE_CHAIN_ID =
%r{\nChain ID: (?<chain_id>[0-9]+)}.freeze
SIWE_NONCE =
%r{\nNonce: (?<nonce>[a-zA-Z0-9]{8,})}.freeze
SIWE_DATETIME =
%r{([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))}.freeze
SIWE_ISSUED_AT =
%r{\nIssued At: (?<issued_at>#{SIWE_DATETIME.source})}.freeze
SIWE_EXPIRATION_TIME =
%r{(\nExpiration Time: (?<expiration_time>#{SIWE_DATETIME.source}))?}.freeze
SIWE_NOT_BEFORE =
%r{(\nNot Before: (?<not_before>#{SIWE_DATETIME.source}))?}.freeze
SIWE_REQUEST_ID =
%r{(\nRequest ID: (?<request_id>[-._~!$&'()*+,;=:@%a-zA-Z0-9]*))?}.freeze
SIWE_RESOURCES =
%r{(\nResources:(?<resources>(\n- #{RFC3986.source}?)+))?$}.freeze
SIWE_MESSAGE =
Regexp.new(SIWE_DOMAIN.source + SIWE_ADDRESS.source + SIWE_STATEMENT.source + SIWE_URI_LINE.source +
SIWE_VERSION.source + SIWE_CHAIN_ID.source + SIWE_NONCE.source + SIWE_ISSUED_AT.source +
SIWE_EXPIRATION_TIME.source + SIWE_NOT_BEFORE.source + SIWE_REQUEST_ID.source +
SIWE_RESOURCES.source)