I hereby claim:
- I am sahrizvi on github.
- I am sahrizvi (https://keybase.io/sahrizvi) on keybase.
- I have a public key ASCd1-KMrcuNu3PU5b8CVlf4D05JQwP-d1oESZMuT-NSeQo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#!/usr/bin/env elixir | |
defmodule Committer do | |
defstruct [:name, :email] | |
def list(repo) do | |
repo | |
|> from_repo | |
|> Stream.unfold(fn str -> | |
case String.split(str, "\n", parts: 2, trim: true) do |
#!/bin/sh | |
set -eu | |
JANUS_REV=tags/v0.2.2 #master | |
CONTAINER=false # if true, delete more for smaller image | |
JANUS_REPO=meetecho/janus-gateway | |
PREFIX=/opt/janus-gateway | |
SRCDIR=$HOME/src |
defmodule Persistence.Merchant do | |
@moduledoc """ | |
""" | |
use Persistence.Definition, :service | |
alias Persistence.Account.User | |
alias Persistence.Merchant.Shop | |
alias Persistence.Relation.ShopUser | |
def create(:shop, params, %User{} = user) when is_map(params) do |
Thanks for watching my talk, Domain-Driven Desire at Øredev 2016. Here's a list of resources that inspired me, and will hopefully inspire you:
def loop(socket) do | |
case socket |> Socket.Web.recv! do | |
{:text, data} -> | |
# process data | |
loop(socket) | |
{:ping, _ } -> | |
socket |> Socket.Web.send!({:pong, ""}) | |
end | |
end |
Thanks to @potatosalad for his comment explaning this | |
Short Answer | |
A cryptographically secure randomly generated 16 byte (or 128 bit) symmetric oct key for use with signature algorithm HS256 should be sufficient for many HTTP bearer authentication use cases. | |
## Generate a 128-bit oct JWK | |
JOSE.JWK.generate_key({:oct, 16}) |> JOSE.JWK.to_map |> elem(1) | |
# %{"k" => "5Fn8i7r5cRWZW_yyr9Flkg", "kty" => "oct"} | |
## Configure Guardian to use HS256 and our generated JWK |
# within channel | |
def handle_in("new_msg", %{"uid" => uid, "body" => body}, socket) do | |
... | |
broadcast_from! socket, "new_msg", %{uid: uid, body: body} | |
MyApp.Endpoint.broadcast_from! self(), "rooms:superadmin", | |
"new_msg", %{uid: uid, body: body} | |
{:noreply, socket} | |
end | |
# within controller |