{"id":18982339,"url":"https://github.com/defactosoftware/lti","last_synced_at":"2025-04-19T20:05:38.096Z","repository":{"id":28080579,"uuid":"114408912","full_name":"DefactoSoftware/lti","owner":"DefactoSoftware","description":"Launch and receive LTI requests","archived":false,"fork":false,"pushed_at":"2023-04-12T09:38:40.000Z","size":111,"stargazers_count":15,"open_issues_count":6,"forks_count":3,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-10-19T20:54:46.143Z","etag":null,"topics":["elixir","lti","phoenix"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DefactoSoftware.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-15T20:31:53.000Z","updated_at":"2023-09-01T10:53:04.000Z","dependencies_parsed_at":"2023-02-10T09:01:34.448Z","dependency_job_id":null,"html_url":"https://github.com/DefactoSoftware/lti","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefactoSoftware%2Flti","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefactoSoftware%2Flti/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefactoSoftware%2Flti/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DefactoSoftware%2Flti/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DefactoSoftware","download_url":"https://codeload.github.com/DefactoSoftware/lti/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223713507,"owners_count":17190498,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["elixir","lti","phoenix"],"created_at":"2024-11-08T16:13:10.523Z","updated_at":"2024-11-08T16:13:11.279Z","avatar_url":"https://github.com/DefactoSoftware.png","language":"Elixir","readme":"# LTI for elixir\n\nA package to easily launch LTI modules.\n\n## Installation\n\nadd\n\n```ex\ndef deps do\n  [\n    {:lti, \"~\u003e 0.1.5\"}\n  ]\nend\n```\n\n## Usage LTI Launch\n\n```eex\n# in the template\n\u003c%\ncredentials = LTI.credentials(your_given_consumer_key, your_given_consumer_secret, your_lti_url)\noauth_params = LTI.oauth_params(credentials)\nlaunch_params = launch_params(@current_user)\n%\u003e\n\n\u003cform id=\"ltiLaunchForm\" name=\"ltiLaunchForm\" method=\"POST\" action=\"\u003c%= your_lti_url %\u003e\"\u003e\n  \u003c%= for ({key, value} \u003c- LTI.launch_data(oauth_params, launch_params)) do %\u003e\n    \u003cinput type=\"hidden\" name=\"\u003c%= key %\u003e\" value=\"\u003c%= value %\u003e\"\u003e\n  \u003c% end %\u003e\n  \u003cinput type=\"hidden\" name=\"oauth_signature\" value=\"\u003c%= LTI.signature(credentials, oauth_params, launch_params) %\u003e\"\u003e\n\t\u003cbutton type=\"submit\"\u003eLaunch\u003c/button\u003e\n  \u003cbr\u003e\n\u003c/form\u003e\n```\n\n```ex\n  # in the view\n\n  def launch_params(user) do\n    %LTI.LaunchParams{\n      user_id: \"292832126\",\n      roles: the_role_of_the_user,\n      launch_presentation_locale: users_language,\n      launch_presentation_return_url: callback_url_for_results,\n      resource_link_id: resource_link_id_of_your_module,\n      resource_link_title: \"onno schuit\",\n      resource_link_description: \"A weekly blog.\",\n      lis_person_contact_email_primary: user.email,\n      lis_person_name_family: \"Public\",\n      lis_person_name_full: Accounts.full_name(user),\n      lis_person_name_given: \"Given\",\n      lis_person_sourcedid: your_person_source_id,\n      lti_message_type: \"basic-lti-launch-request\",\n      lti_version: \"LTI-1p0\",\n      context_id: context_id_of_your_module,\n      context_title: title_of_the_module,\n      context_label: label_of_the_module,\n      tool_consumer_instance_guid: tool_consumer_instance_guid,\n      tool_consumer_instance_description: \"some description of yours instance\",\n      submit: \"Launch\"\n    }\n  end\n```\n\n## Usage LTI Receive\nVerify the received signature by passing the url, oauth header and secret.\nThis function will either return an :ok tuple together with the verified signature or\nan :error tuple with a list with one or more of the error atoms (:unmatching_signatures, :incorrect_version, :duplicated_parameters, :missing_required_parameters or :unsupported_parameters)\nBy default, the HTTP method is POST.\n\n```ex\n  {:ok, signature} =\n      LTIResult.signature(\n        \"https://example.com\",\n        \"OAuth oauth_consumer_key=\\\"key1234\\\",oauth_signature_method=\\\"HMAC-SHA1\\\",oauth_timestamp=\\\"1525076552\\\",oauth_nonce=\\\"123\\\",oauth_version=\\\"1.0\\\",oauth_signature=\\\"iyyQNRQyXTlpLJPJns3ireWjQxo%3D\\\"\",\n        \"random_secret\"\n      )\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefactosoftware%2Flti","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdefactosoftware%2Flti","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdefactosoftware%2Flti/lists"}