Module: MeiliSearch::TenantToken
- Included in:
- Client
- Defined in:
- lib/meilisearch/error.rb,
lib/meilisearch/tenant_token.rb
Defined Under Namespace
Classes: ExpireOrInvalidSignature, InvalidApiKey, InvalidSearchRules
Constant Summary collapse
- HEADER =
{ typ: 'JWT', alg: 'HS256' }.freeze
Instance Method Summary collapse
Instance Method Details
#generate_tenant_token(api_key_uid, search_rules, api_key: nil, expires_at: nil) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/meilisearch/tenant_token.rb', line 10 def generate_tenant_token(api_key_uid, search_rules, api_key: nil, expires_at: nil) signature = retrieve_valid_key!(api_key, @api_key) expiration = validate_expires_at!(expires_at) rules = validate_search_rules!(search_rules) unsigned_data = build_payload(expiration, rules, api_key_uid) combine(unsigned_data, to_base64(sign_data(signature, unsigned_data))) end |