aboutsummaryrefslogtreecommitdiffstats
path: root/spec
Commit message (Collapse)AuthorAgeFilesLines
...
* | util.datamapper: Simplify test schemaKim Alvefur2022-12-201-12/+12
| | | | | | | | | | Don't need the function, more compact to just reference the same reference table.
* | util.hashring: Support associating arbitrary data with nodesMatthew Wild2022-12-021-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In this API, a 'node' is always a simple text string. Sometimes the caller may have a more complex structure representing a node, but the hash ring is really only concerned with the node's name. This API change allows :add_nodes() to take a table of `node_name = value` pairs, as well as the simple array of node names previously accepted. The 'value' of the selected node is returned as a new second result from :get_node(). If no value is passed when a node is added, it defaults to `true` (as before, but this was never previously exposed).
* | util.hashring: tests: don't randomize order - they are written in a ↵Matthew Wild2022-12-021-0/+1
| | | | | | | | sequential style
* | Merge 0.12->trunkMatthew Wild2022-11-041-0/+8
|\|
| * util.json: Accept empty arrays with whitespace (fixes #1782)Matthew Wild2022-11-041-0/+8
| |
* | util.smqueue: Improve testsKim Alvefur2022-10-191-0/+3
| | | | | | | | Result of mutation testing. One mutant remaining.
* | util.jsonpointer: Improve testsKim Alvefur2022-10-191-0/+2
| | | | | | | | | | | | | | | | | | Result of mutation testing Remaining mutants are mostly relating to the math.type() fallback. Another case being that array[#array+1] == array[#array+2] and thus doesn't matter.
* | util.cache: Add some missing test casesMatthew Wild2022-10-131-0/+52
| | | | | | | | Found via mutation testing.
* | util.jid: Add test for invalid domain but valid UTF-8 (thanks jonas)Matthew Wild2022-10-111-0/+1
| |
* | util.jid: Add missing test casesMatthew Wild2022-10-111-0/+40
| | | | | | | | (98% mutant score, single remaining mutant is a string.sub equivalent)
* | util.dbuffer: Add a bunch of missing test casesMatthew Wild2022-10-111-2/+70
| | | | | | | | Found via mutation testing.
* | Merge 0.12->trunkKim Alvefur2022-10-091-7/+13
|\|
| * util.jsonschema: Ignore test case for JavaScript specific detailKim Alvefur2022-10-091-0/+1
| | | | | | | | Also touching on how arrays are indistinguishable from tables in Lua
| * util.jsonschema: Ignore some further test cases for URI referencesKim Alvefur2022-10-091-0/+5
| | | | | | | | Full-URI references are not implemented
| * util.jsonschema: Sort test cases to skipKim Alvefur2022-10-091-7/+7
| | | | | | | | Piped trough `sort -g`
* | util.datetime: Add some missing test casesMatthew Wild2022-10-081-0/+15
| | | | | | | | You guessed it, mutation testing.
* | util.roles: Fix tests to use autogenerated role idMatthew Wild2022-10-081-1/+1
| |
* | util.roles: Add some more missing test casesMatthew Wild2022-10-081-0/+18
| | | | | | | | Found via mutation testing.
* | util.promise: Fix field name in failing test (introduced in 2639e0e1c378)Matthew Wild2022-10-071-1/+1
| |
* | util.promise: Add some missing test cases (found through mutation testing)Matthew Wild2022-10-071-0/+25
| |
* | util.promise: Remove some redundant checks, add tests confirming redundancyMatthew Wild2022-10-071-0/+21
| | | | | | | | | | | | | | | | | | This lines don't appear to do anything useful, and all tests pass when they are removed. Discovered via mutation testing. I added extra tests to exercise this code, because I wasn't certain that there were no side-effects caused by removal. Everything appears to be fine, thanks to the "pending" check at the start of promise_settle().
* | util.roles: Add testsMatthew Wild2022-10-071-0/+116
| |
* | util.iterators: join: Work even with only a single iterator in the chainMatthew Wild2022-10-061-0/+8
| |
* | util.crypto: Fix testsKim Alvefur2022-09-301-3/+3
| | | | | | | | | | | | Found this number in a hat. Sleepy time. Good night.
* | util.jwt: Add support for ES512 (+ tests)Matthew Wild2022-09-292-3/+65
| |
* | util.paseto: Drop custom wrappers around key objectsMatthew Wild2022-07-111-1/+1
| | | | | | | | | | | | | | | | | | | | The PASETO spec recommends - no, *requires* - that implementations enforce type safety for keys, and e.g. do not pass them around as arbitrary byte strings. Typed wrapper objects are recommended. I originally followed this advice when starting the lib. However, key wrapping and type safety is now also a feature of util.crypto. All we're doing is duplicating it unnecessarily with this additional wrapper code.
* | util.paseto: Add tests based on official PASETO test vectorsMatthew Wild2022-07-111-0/+118
| | | | | | | | | | Unfortunately there are only a few relevant ones, but they did help catch some bugs.
* | util.jwt: All the algorithms (+ all the tests!)Matthew Wild2022-07-021-19/+86
| | | | | | | | Except 'none'. Not implementing that one.
* | util.crypto: tests: fix some tests that didn't do much (thanks luacheck!)Matthew Wild2022-07-021-3/+2
| |
* | util.jwt: Overhaul of tests to use declarative approachMatthew Wild2022-07-022-115/+199
| | | | | | | | | | Now we can consistently apply the same tests to every algorithm, instead of duplicating code.
* | spec: Move test crypto keys to a shared file for clarity and easy maintenanceMatthew Wild2022-07-023-125/+82
| |
* | util.jwt: Add support for RSA-based algorithms (RS256, PS256)Matthew Wild2022-07-021-0/+170
| |
* | util.jwt: Add support/tests for ES256 via improved API and using util.cryptoMatthew Wild2022-07-011-0/+50
| | | | | | | | | | | | | | | | | | | | | | In many cases code will be either signing or verifying. With asymmetric algorithms it's clearer and more efficient to just state that once, instead of passing keys (and possibly other parameters) with every sign/verify call. This also allows earlier validation of the key used. The previous (HS256-only) sign/verify methods continue to be exposed for backwards-compatibility.
* | util.crypto: New wrapper for some operations in OpenSSL's libcryptoMatthew Wild2022-06-241-0/+196
| | | | | | | | | | Specifically, ED25519 key generation/import/export, sign/verify operations, and AES encrypt/decrypt.
* | util.stanza: Add add_error() to simplify adding error tags to existing stanzasMatthew Wild2022-08-291-0/+14
| | | | | | | | | | Some fiddling is required now in error_reply() to ensure the cursor is in the same place as before this change (a lot of code apparently uses that feature).
* | util.stanza: Add method for extracting a single attribute valueKim Alvefur2022-08-171-1/+1
| | | | | | | | | | | | | | | | | | Sometimes you only care about a single attribute, but the child tag itself may be optional, leading to needing `tag and tag.attr.foo` or `stanza:find("tag@foo")`. The `:find()` method is fairly complex, so avoiding it for this kind of simpler use case is a win.
* | mod_mam: Store archives with sub-second precision timestampsKim Alvefur2022-08-142-8/+8
| | | | | | | | | | | | | | | | | | | | | | Changes sub-second part of example timestamp to .5 in order to avoid floating point issues. Some clients use timestamps when ordering messages which can lead to messages having the same timestamp ending up in the wrong order. It would be better to preserve the order messages are sent in, which is the order they were stored in.
* | util.datetime: Add support for sub-second precision timestampsKim Alvefur2022-08-141-0/+13
| | | | | | | | | | | | Lua since 5.3 raises a fuss when time functions are handed a number with a fractional part and the underlying C functions are all based on integer seconds without support for more precision.
* | util.datetime: Fix argument order in testsKim Alvefur2022-08-141-6/+6
| | | | | | | | The expected value goes first.
* | various: Update IETF RFC URLs for tools.ietf.org transitionKim Alvefur2022-08-051-1/+1
| | | | | | | | | | | | See https://www.ietf.org/blog/finalizing-ietf-tools-transition/ Already done in various other places.
* | Merge 0.12->trunkKim Alvefur2022-07-291-0/+17
|\|
| * storage tests: Add test for the archive:summary APIKim Alvefur2022-07-221-0/+17
| | | | | | | | | | Passes with memory, internal, sqlite Fails with postgres as in #1766
* | Merge 0.12->trunkKim Alvefur2022-07-271-0/+27
|\|
| * mod_bookmarks: Reduce error about not having bookmarks to debug (thanks tom)Kim Alvefur2022-07-261-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is happens if the account is new and doesn't have any bookmarks yet, which is not a problem. Rarely seen since most clients currently use the older version of XEP-0084 stored in XEP-0049 rather than in PEP, but at least one (Converse.js )does. One scenario in which this would show up often is with Converse.js as a guest chat using anonymous authentication, where all "accounts" would always be new and not have any bookmarks. This scenario probably does not need to have mod_bookmarks at all, but if enabled globally it would likely become loaded onto the VirtualHost unless explicitly disabled.
* | compat: Remove handling of Lua 5.1 location of 'unpack' functionKim Alvefur2022-07-111-1/+1
| |
* | Merge 0.12->trunkKim Alvefur2022-07-082-3/+107
|\|
| * util.datamapper: Improve handling of schemas with non-obvious "type"Kim Alvefur2022-07-081-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | The JSON Schema specification says that schemas are objects or booleans, and that the 'type' property is optional and can be an array. This module previously allowed bare type names as schemas and did not really handle booleans. It now handles missing 'type' properties and boolean 'true' as a schema. Objects and arrays are guessed based on the presence of 'properties' or 'items' field.
| * util.jsonschema: Fix validation to not assume presence of "type" fieldKim Alvefur2022-07-081-0/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MattJ reported a curious issue where validation did not work as expected. Primarily that the "type" field was expected to be mandatory, and thus leaving it out would result in no checks being performed. This was likely caused by misreading during initial development. Spent some time testing against https://github.com/json-schema-org/JSON-Schema-Test-Suite.git and discovered a multitude of issues, far too many to bother splitting into separate commits. More than half of them fail. Many because of features not implemented, which have been marked NYI. For example, some require deep comparisons e.g. when objects or arrays are present in enums fields. Some because of quirks with how Lua differs from JavaScript, e.g. no distinct array or object types. Tests involving fractional floating point numbers. We're definitely not going to follow references to remote resources. Or deal with UTF-16 sillyness. One test asserted that 1.0 is an integer, where Lua 5.3+ will disagree.
* | tests: Remove special-casing of Lua 5.1Kim Alvefur2022-07-022-24/+22
| | | | | | | | Part of #1600
* | util.hashes: Add SHA3 bindingsKim Alvefur2020-09-101-0/+15
| |