Socket
Socket
Sign inDemoInstall

ims-lti

Package Overview
Dependencies
5
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.0 to 2.1.1

lib/extensions/outcomes.js

2

lib/consumer.js

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {

@@ -3,0 +3,0 @@ var Consumer, exports;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {

@@ -3,0 +3,0 @@ var ConsumerError, ExtensionError, NonceError, OutcomeResponseError, ParameterError, SignatureError, StoreError,

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {
var ContentExtension, FILE_RETURN_TYPE, IFRAME_RETURN_TYPE, IMAGE_URL_RETURN_TYPE, LTI_LAUNCH_URL_RETURN_TYPE, OEMBED_RETURN_TYPE, URL_RETURN_TYPE, errors, optional_url_property_setter, url;
var ContentExtension, FILE_RETURN_TYPE, IFRAME_RETURN_TYPE, IMAGE_URL_RETURN_TYPE, LTI_LAUNCH_URL_RETURN_TYPE, OEMBED_RETURN_TYPE, URL_RETURN_TYPE, errors, optional_url_property_setter, parse_url, url;

@@ -21,2 +21,9 @@ url = require('url');

parse_url = function(raw_url) {
var return_url;
return_url = url.parse(raw_url, true);
delete return_url.path;
return return_url;
};
optional_url_property_setter = function(return_url) {

@@ -48,3 +55,3 @@ return function(property, value) {

this._validate_return_type(FILE_RETURN_TYPE);
return_url = url.parse(this.return_url, true);
return_url = parse_url(this.return_url, true);
set_if_exists = optional_url_property_setter(return_url);

@@ -61,3 +68,3 @@ return_url.query.return_type = FILE_RETURN_TYPE;

this._validate_return_type(IFRAME_RETURN_TYPE);
return_url = url.parse(this.return_url, true);
return_url = parse_url(this.return_url, true);
set_if_exists = optional_url_property_setter(return_url);

@@ -75,3 +82,3 @@ return_url.query.return_type = IFRAME_RETURN_TYPE;

this._validate_return_type(IMAGE_URL_RETURN_TYPE);
return_url = url.parse(this.return_url, true);
return_url = parse_url(this.return_url, true);
set_if_exists = optional_url_property_setter(return_url);

@@ -89,3 +96,3 @@ return_url.query.return_type = IMAGE_URL_RETURN_TYPE;

this._validate_return_type(LTI_LAUNCH_URL_RETURN_TYPE);
return_url = url.parse(this.return_url, true);
return_url = parse_url(this.return_url, true);
set_if_exists = optional_url_property_setter(return_url);

@@ -102,3 +109,3 @@ return_url.query.return_type = LTI_LAUNCH_URL_RETURN_TYPE;

this._validate_return_type(OEMBED_RETURN_TYPE);
return_url = url.parse(this.return_url, true);
return_url = parse_url(this.return_url, true);
set_if_exists = optional_url_property_setter(return_url);

@@ -114,3 +121,3 @@ return_url.query.return_type = OEMBED_RETURN_TYPE;

this._validate_return_type(URL_RETURN_TYPE);
return_url = url.parse(this.return_url, true);
return_url = parse_url(this.return_url, true);
set_if_exists = optional_url_property_setter(return_url);

@@ -117,0 +124,0 @@ return_url.query.return_type = URL_RETURN_TYPE;

@@ -1,5 +0,7 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {
exports.Content = require('./content');
exports.Outcomes = require('./outcomes');
}).call(this);

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {

@@ -3,0 +3,0 @@ var HMAC_SHA1, crypto, exports, url, utils, _clean_request_body;

@@ -1,5 +0,7 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {
var exports;
var exports, extensions;
extensions = require('./extensions');
exports = module.exports = {

@@ -9,3 +11,3 @@ version: '0.0.0',

Consumer: require('./consumer'),
OutcomeService: require('./outcome-service'),
OutcomeService: extensions.Outcomes.OutcomesService,
Errors: require('./errors'),

@@ -17,3 +19,3 @@ Stores: {

},
Extensions: require('./extensions'),
Extensions: extensions,
supported_versions: ['LTI-1p0']

@@ -20,0 +22,0 @@ };

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {

@@ -3,0 +3,0 @@ var EXPIRE_IN_SEC, MemoryNonceStore, NonceStore, exports,

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {

@@ -3,0 +3,0 @@ var NonceStore, exports,

@@ -1,4 +0,4 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {
var HMAC_SHA1, MemoryNonceStore, OutcomeService, Provider, errors, exports, extensions,
var HMAC_SHA1, MemoryNonceStore, Provider, errors, exports, extensions,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };

@@ -10,4 +10,2 @@

OutcomeService = require('./outcome-service');
errors = require('./errors');

@@ -112,7 +110,2 @@

this.launch_request = this.body.lti_message_type === 'basic-lti-launch-request';
if (this.body.lis_outcome_service_url && this.body.lis_result_sourcedid) {
this.outcome_service = new OutcomeService(this.body.lis_outcome_service_url, this.body.lis_result_sourcedid, this);
} else {
this.outcome_service = false;
}
this.username = this.body.lis_person_name_given || this.body.lis_person_name_family || this.body.lis_person_name_full || '';

@@ -119,0 +112,0 @@ this.userId = this.body.user_id;

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {

@@ -22,4 +22,3 @@ var EXPIRE_IN_SEC, NonceStore, RedisNonceStore, exports,

RedisNonceStore.prototype.isNew = function(nonce, timestamp, next) {
var currentTime, freshTimestamp,
_this = this;
var currentTime, freshTimestamp;
if (next == null) {

@@ -39,9 +38,11 @@ next = function() {};

}
return this.redis.get(nonce, function(err, seen) {
if (seen) {
return next(new Error('Nonce already seen'), false);
}
_this.setUsed(nonce, timestamp);
return next(null, true);
});
return this.redis.get(nonce, (function(_this) {
return function(err, seen) {
if (seen) {
return next(new Error('Nonce already seen'), false);
}
_this.setUsed(nonce, timestamp);
return next(null, true);
};
})(this));
};

@@ -48,0 +49,0 @@

@@ -1,2 +0,2 @@

// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.8.0
(function() {

@@ -3,0 +3,0 @@ exports.special_encode = function(string) {

{
"name": "ims-lti",
"version": "2.1.0",
"version": "2.1.1",
"description": "Module for building an LTI Tool Provider and accept LTI launch requests",

@@ -9,9 +9,12 @@ "author": {

},
"contributors": [{
"name": "Owen Smith",
"email": "owen@omsmith.ca"
}, {
"name": "David Kosub",
"email": "dave@davidkosub.com"
}],
"contributors": [
{
"name": "Owen Smith",
"email": "owen@omsmith.ca"
},
{
"name": "David Kosub",
"email": "dave@davidkosub.com"
}
],
"license": "MIT",

@@ -40,11 +43,11 @@ "keywords": [

"devDependencies": {
"redis": "0.8.3",
"should": "1.2.2",
"coffee-script": "~1.6.2",
"coffee-coverage": "~0.4.2",
"mocha": "~1.15.1",
"coffee-coverage": "^0.4.4",
"coffee-script": "^1.8.0",
"coveralls": "^2.11.2",
"mocha": "^2.1.0",
"mocha-lcov-reporter": "0.0.1",
"mocha-multi": "~0.4.0",
"coveralls": "~2.10.0"
"mocha-multi": "^0.6.0",
"redis": "^0.12.1",
"should": "^4.6.1"
}
}

@@ -86,3 +86,3 @@ # ims-lti

### Outcomes
### Outcomes Extension

@@ -98,2 +98,6 @@ The outcomes feature is part of the LTI 1.1 specification and is new to ims-lti 1.0. All of the behind-the-scenes work necessary to get the ball rolling with it is already implemented for you, all you need to do is submit grades.

# Check if the outcome service supports the result data extension using the
# text format. Available formats include text and url.
console.log provider.outcome_service.supports_result_data('text')
# Replace accepts a value between 0 and 1.

@@ -108,4 +112,41 @@ provider.outcome_service.send_replace_result .5, (err, result) ->

console.log result # True or false
provider.outcome_service.send_replace_result_with_text .5, 'Hello, world!', (err, result) ->
console.log result # True or false
provider.outcome_service.send_replace_result_with_url .5, 'https://google.com', (err, result) ->
console.log result # True or false
```
### Content Extension
The content extension is an extension supported by most LMS platforms. It provides LTI providers a way to send content back to the LMS in the form of urls, images, files, oembeds, iframes, and even lti launch urls.
```coffeescript
provider = new lti.Provider consumer_key, consumer_secret
provider.valid_request req, (err, is_valid) ->
#check if the request is valid and if the content extension is loaded.
if (!is_valid || !provider.ext_content) return false
provider.ext_content.has_return_type 'file' # Does the consumer support files
provider.ext_content.has_file_extension 'jpg' # Does the consumer support jpg
# All send requests take a response object as the first parameter. How the
# response object is manipulated can be overrided by replacing
# lti.Extensions.Content.redirector with your own function that accepts two
# parameters, the response object and the url to redirect to.
provider.ext_content.send_file res, file_url, text, content_mime_type
provider.ext_content.send_iframe res, iframe_url, title_attribute, width, height
provider.ext_content.send_image_url res, image_url, text, width, height
provider.ext_content.send_lti_launch_url res, launch_url, title_attribute, text
provider.ext_content.send_oembed res, oembed_url, endpoint
provider.ext_content.send_url res, hyperlink_url, text, title_attribute, target_attribute
```
## Running Tests

@@ -112,0 +153,0 @@ To run the test suite first installing the dependencies:

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc