hpyhacking/peatio · error · APIv2::ExpiredAccessKeyError
2010
2010
Error message
The access key #{access_key} has expired. What it means
Error "The access key #{access_key} has expired." thrown in hpyhacking/peatio.
Source
Thrown at app/api/api_v2/auth/authenticator.rb:24
@request = request
@params = params
end
def authenticate!
check_token!
check_tonce!
check_signature!
token
end
def token
@token ||= APIToken.joins(:member).where(access_key: @params[:access_key]).first
end
def check_token!
raise InvalidAccessKeyError, @params[:access_key] unless token
raise DisabledAccessKeyError, @params[:access_key] if token.member.api_disabled
raise ExpiredAccessKeyError, @params[:access_key] if token.expired?
raise OutOfScopeError unless token.in_scopes?(route_scopes)
end
def check_signature!
if @params[:signature] != Utils.hmac_signature(token.secret_key, payload)
Rails.logger.warn "APIv2 auth failed: signature doesn't match. token: #{token.access_key} payload: #{payload}"
raise IncorrectSignatureError, @params[:signature]
end
end
def check_tonce!
key = "api_v2:tonce:#{token.access_key}:#{tonce}"
if Utils.cache.read(key)
Rails.logger.warn "APIv2 auth failed: used tonce. token: #{token.access_key} payload: #{payload} tonce: #{tonce}"
raise TonceUsedError.new(token.access_key, tonce)
end
Utils.cache.write key, tonce, 61 # forget after 61 seconds
View on GitHub (pinned to dab8641137)
Solutions
- Extend the expiry of the access key or issue a new access key and update the client to use it.
When it happens
Trigger: Thrown at app/api/api_v2/auth/authenticator.rb:24 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of hpyhacking/peatio@dab8641137 (2026-08-23).
Data as JSON: /api/errors/5fbbba468a023519.
Report an issue: GitHub.