diff --git a/.formatter.exs b/.formatter.exs new file mode 100644 index 0000000..d304ff3 --- /dev/null +++ b/.formatter.exs @@ -0,0 +1,3 @@ +[ + inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"] +] diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..ad865f8 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,26 @@ +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: monthly + groups: + actions-minor: + update-types: + - minor + - patch + + - package-ecosystem: mix + directory: / + schedule: + interval: monthly + groups: + elixir-development: + dependency-type: development + update-types: + - minor + - patch + elixir-production: + dependency-type: production + update-types: + - patch diff --git a/.github/workflows/elixir.yml b/.github/workflows/elixir.yml new file mode 100644 index 0000000..2d13d7f --- /dev/null +++ b/.github/workflows/elixir.yml @@ -0,0 +1,71 @@ +name: Elixir CI + +on: + pull_request: + push: + branches: + - main + workflow_dispatch: + +jobs: + elixir-ci: + name: Elixir ${{ matrix.elixir }} (OTP ${{ matrix.otp }}) + + env: + LANG: en_US.UTF-8 + LC_CTYPE: en_US.UTF-8 + + strategy: + fail-fast: true + matrix: + include: + - elixir: '1.15' + otp: '26' + os: ubuntu-22.04 + check_formatted: true + warnings_as_errors: true + - elixir: '1.16' + otp: '26' + os: ubuntu-22.04 + - elixir: '1.17' + otp: '27' + os: ubuntu-22.04 + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + + - uses: erlef/setup-elixir@v1 + id: install + with: + otp-version: ${{ matrix.otp }} + elixir-version: ${{ matrix.elixir }} + + - uses: actions/cache@v4 + with: + key: builds@elixir-${{ steps.install.outputs.elixir-version }}-otp-${{ steps.install.outputs.otp-version }}-mix-${{ hashFiles('mix.lock') }} + path: | + deps + _build + + - run: mix 'do' deps.get, deps.compile + + - run: mix format --check-formatted + if: matrix.check_formatted + + - run: mix compile --warnings-as-errors + if: matrix.warnings_as_errors + + - run: mix compile + if: ${{ !matrix.warnings_as_errors }} + + - run: mix test + + - uses: actions/cache@v4 + with: + key: plts@elixir-${{ steps.install.outputs.elixir-version }}-otp-${{ steps.install.outputs.otp-version }}-mix-${{ hashFiles('mix.lock') }} + path: | + priv/plts + restore-keys: | + plts@elixir-${{ steps.install.outputs.elixir-version }}-otp-${{ steps.install.outputs.otp-version }}-mix- diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ef810ba..0000000 --- a/.travis.yml +++ /dev/null @@ -1,10 +0,0 @@ -sudo: false -language: elixir -elixir: - - 1.2.6 - - 1.3.1 - - 1.4.0 -otp_release: - - 18.3 - - 19.0 -script: mix test --no-start diff --git a/config/config.exs b/config/config.exs deleted file mode 100644 index 6dfa82f..0000000 --- a/config/config.exs +++ /dev/null @@ -1,24 +0,0 @@ -# This file is responsible for configuring your application -# and its dependencies with the aid of the Mix.Config module. -use Mix.Config - -# This configuration is loaded before any dependency and is restricted -# to this project. If another project depends on this project, this -# file won't be loaded nor affect the parent project. For this reason, -# if you want to provide default values for your application for third- -# party users, it should be done in your mix.exs file. - -# Sample configuration: -# -# config :logger, :console, -# level: :info, -# format: "$date $time [$level] $metadata$message\n", -# metadata: [:user_id] - -# It is also possible to import configuration files, relative to this -# directory. For example, you can emulate configuration per environment -# by uncommenting the line below and defining dev.exs, test.exs and such. -# Configuration from the imported file will override the ones defined -# here (which is why it is important to import them last). -# -# import_config "#{Mix.env}.exs" diff --git a/doc/404.html b/doc/404.html deleted file mode 100644 index b089da6..0000000 --- a/doc/404.html +++ /dev/null @@ -1,88 +0,0 @@ - - - - - - - - 404 – secure_random v0.5.0 - - - - - - -
- - - -
-
- - -

Page not found

- -

Sorry, but the page you were trying to get to, does not exist. You -may want to try searching this site using the sidebar or using our -API Reference page to find what -you were looking for.

- - -
-
-
- - - - diff --git a/doc/SecureRandom.html b/doc/SecureRandom.html deleted file mode 100644 index 4a7ecb2..0000000 --- a/doc/SecureRandom.html +++ /dev/null @@ -1,291 +0,0 @@ - - - - - - - - SecureRandom – secure_random v0.5.0 - - - - - - -
- - - -
-
- - -

- secure_random v0.5.0 - SecureRandom - - -

- - -
-

Takes my favorite hits from Ruby’s SecureRandom and brings em to elixir. -Mostly a convienance wrapper around Erlangs Crypto library, converting -Crypto.strong_rand_bytes/1 into a string.

-

Examples

-
iex> SecureRandom.base64
-"xhTcitKZI8YiLGzUNLD+HQ=="
-
-iex> SecureRandom.urlsafe_base64(4)
-"pLSVJw"
-
-iex> SecureRandom.uuid
-"a18e8302-c417-076d-196a-71dfbd5b1e03"
- -
- - - -
-

- - - - Summary -

- - - -
-

- Functions -

-
- - -

Returns random Base64 encoded string

-
- -
-
- - -

Generates a random hexadecimal string

-
- -
-
- - -

Returns random bytes

-
- -
-
- - -

Returns random urlsafe Base64 encoded string

-
- -
-
-
- uuid() -
- -

Returns UUID v4 string. I have lifted most of this straight from Ecto’s implementation

-
- -
- -
- - - - - - -
- - - - - -
-

- - - - Functions -

-
-
- - - - base64(n \\ 16) - -
- -
-

Returns random Base64 encoded string.

-

Examples

-
iex> SecureRandom.base64
-"rm/JfqH8Y+Jd7m5SHTHJoA=="
-
-iex> SecureRandom.base64(8)
-"2yDtUyQ5Xws="
- -
-
-
-
- - - - hex(n \\ 16) - -
- -
-

Generates a random hexadecimal string.

-

The argument n specifies the length, in bytes, of the random number to be generated. The length of the resulting hexadecimal string is twice n.

-

If n is not specified, 16 is assumed. It may be larger in future.

-

The result may contain 0-9 and a-f.

-

Examples

-
iex> SecureRandom.hex(6)
-"34fb5655a231"
- -
-
-
-
- - - - random_bytes(n \\ 16) - -
- -
-

Returns random bytes.

-

Examples

-
iex> SecureRandom.random_bytes
-<<202, 104, 227, 197, 25, 7, 132, 73, 92, 186, 242, 13, 170, 115, 135, 7>>
-
-iex> SecureRandom.random_bytes(8)
-<<231, 123, 252, 174, 156, 112, 15, 29>>
- -
-
-
-
- - - - urlsafe_base64(n \\ 16) - -
- -
-

Returns random urlsafe Base64 encoded string.

-

Examples

-
iex> SecureRandom.urlsafe_base64
-"xYQcVfWuq6THMY_ZVmG0mA"
-
-iex> SecureRandom.urlsafe_base64(8)
-"8cN__l-6wNw"
- -
-
-
-
- - - - uuid() - -
- -
-

Returns UUID v4 string. I have lifted most of this straight from Ecto’s implementation.

-

Examples

-

iex> SecureRandom.uuid - “e1d87f6e-fbd5-6801-9528-a1d568c1fd02”

- -
-
- -
- - - - - - -
-
-
- - - - diff --git a/doc/api-reference.html b/doc/api-reference.html deleted file mode 100644 index 32de51b..0000000 --- a/doc/api-reference.html +++ /dev/null @@ -1,114 +0,0 @@ - - - - - - - - API Reference – secure_random v0.5.0 - - - - - - -
- - - -
-
- -

- secure_random v0.5.0 - API Reference -

- - - - -
-

Modules

-
-
- - -

Takes my favorite hits from Ruby’s SecureRandom and brings em to elixir. -Mostly a convienance wrapper around Erlangs Crypto library, converting -Crypto.strong_rand_bytes/1 into a string

-
- -
- -
-
- - - - - - -
-
-
- - - - diff --git a/doc/dist/app-918614602f.js b/doc/dist/app-918614602f.js deleted file mode 100644 index a10d1ba..0000000 --- a/doc/dist/app-918614602f.js +++ /dev/null @@ -1,6 +0,0 @@ -!function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return e[r].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}(function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(typeof e[t]){case"function":break;case"object":e[t]=function(t){var n=t.slice(1),r=e[t[0]];return function(e,t,i){r.apply(this,[e,t,i].concat(n))}}(e[t]);break;default:e[t]=e[e[t]]}return e}([function(e,t,n){"use strict";var r=n(1)["default"],i=n(2),a=r(i),o=n(3),s=r(o),l=n(4),c=n(95),u=n(96);window.$=a["default"],a["default"](function(){s["default"].configure({tabReplace:" ",languages:[]}),u.initialize(),c.initialize(),l.initialize(),s["default"].initHighlighting()})},function(e,t){"use strict";t["default"]=function(e){return e&&e.__esModule?e:{"default":e}},t.__esModule=!0},function(e,t,n){var r,i;!function(t,n){"object"==typeof e&&"object"==typeof e.exports?e.exports=t.document?n(t,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return n(e)}:n(t)}("undefined"!=typeof window?window:this,function(n,a){function o(e){var t="length"in e&&e.length,n=re.type(e);return"function"===n||re.isWindow(e)?!1:1===e.nodeType&&t?!0:"array"===n||0===t||"number"==typeof t&&t>0&&t-1 in e}function s(e,t,n){if(re.isFunction(t))return re.grep(e,function(e,r){return!!t.call(e,r,e)!==n});if(t.nodeType)return re.grep(e,function(e){return e===t!==n});if("string"==typeof t){if(fe.test(t))return re.filter(t,e,n);t=re.filter(t,e)}return re.grep(e,function(e){return V.call(t,e)>=0!==n})}function l(e,t){for(;(e=e[t])&&1!==e.nodeType;);return e}function c(e){var t=ye[e]={};return re.each(e.match(ve)||[],function(e,n){t[n]=!0}),t}function u(){te.removeEventListener("DOMContentLoaded",u,!1),n.removeEventListener("load",u,!1),re.ready()}function f(){Object.defineProperty(this.cache={},0,{get:function(){return{}}}),this.expando=re.expando+f.uid++}function d(e,t,n){var r;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(ke,"-$1").toLowerCase(),n=e.getAttribute(r),"string"==typeof n){try{n="true"===n?!0:"false"===n?!1:"null"===n?null:+n+""===n?+n:Ee.test(n)?re.parseJSON(n):n}catch(i){}we.set(e,t,n)}else n=void 0;return n}function p(){return!0}function h(){return!1}function g(){try{return te.activeElement}catch(e){}}function m(e,t){return re.nodeName(e,"table")&&re.nodeName(11!==t.nodeType?t:t.firstChild,"tr")?e.getElementsByTagName("tbody")[0]||e.appendChild(e.ownerDocument.createElement("tbody")):e}function v(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function y(e){var t=Be.exec(e.type);return t?e.type=t[1]:e.removeAttribute("type"),e}function b(e,t){for(var n=0,r=e.length;r>n;n++)_e.set(e[n],"globalEval",!t||_e.get(t[n],"globalEval"))}function x(e,t){var n,r,i,a,o,s,l,c;if(1===t.nodeType){if(_e.hasData(e)&&(a=_e.access(e),o=_e.set(t,a),c=a.events)){delete o.handle,o.events={};for(i in c)for(n=0,r=c[i].length;r>n;n++)re.event.add(t,i,c[i][n])}we.hasData(e)&&(s=we.access(e),l=re.extend({},s),we.set(t,l))}}function _(e,t){var n=e.getElementsByTagName?e.getElementsByTagName(t||"*"):e.querySelectorAll?e.querySelectorAll(t||"*"):[];return void 0===t||t&&re.nodeName(e,t)?re.merge([e],n):n}function w(e,t){var n=t.nodeName.toLowerCase();"input"===n&&Se.test(e.type)?t.checked=e.checked:("input"===n||"textarea"===n)&&(t.defaultValue=e.defaultValue)}function E(e,t){var r,i=re(t.createElement(e)).appendTo(t.body),a=n.getDefaultComputedStyle&&(r=n.getDefaultComputedStyle(i[0]))?r.display:re.css(i[0],"display");return i.detach(),a}function k(e){var t=te,n=We[e];return n||(n=E(e,t),"none"!==n&&n||(ze=(ze||re("