Fix
This commit is contained in:
parent
c531beadb7
commit
dc25c926ba
5 changed files with 33 additions and 13 deletions
|
@ -5,6 +5,7 @@ defmodule Nulla.HTTPSignatureTest do
|
|||
import Nulla.Fixtures.Data
|
||||
alias Nulla.HTTPSignature
|
||||
alias Nulla.Snowflake
|
||||
alias Nulla.Models.User
|
||||
alias Nulla.Models.Actor
|
||||
|
||||
setup do
|
||||
|
@ -15,6 +16,7 @@ defmodule Nulla.HTTPSignatureTest do
|
|||
test "make_headers/3 creates valid signature headers and verify/2 validates them" do
|
||||
actor = Actor.get_actor(preferredUsername: "test")
|
||||
target_actor = Actor.get_actor(preferredUsername: "test2")
|
||||
user = User.get_user(id: actor.id)
|
||||
|
||||
follow_activity = %{
|
||||
"@context" => "https://www.w3.org/ns/activitystreams",
|
||||
|
@ -25,7 +27,14 @@ defmodule Nulla.HTTPSignatureTest do
|
|||
}
|
||||
|
||||
body = Jason.encode!(follow_activity)
|
||||
headers = HTTPSignature.make_headers(body, target_actor.inbox, actor)
|
||||
|
||||
headers =
|
||||
HTTPSignature.make_headers(
|
||||
body,
|
||||
target_actor.inbox,
|
||||
actor.publicKey["id"],
|
||||
user.privateKeyPem
|
||||
)
|
||||
|
||||
conn =
|
||||
conn(:post, "/users/test2/inbox", body)
|
||||
|
|
|
@ -48,7 +48,8 @@ defmodule Nulla.Fixtures.Data do
|
|||
actor_url: actor.url,
|
||||
content: "Hello World from Nulla!",
|
||||
language: "en",
|
||||
actor_id: actor.id
|
||||
actor_id: actor.id,
|
||||
visibility: "public"
|
||||
})
|
||||
|
||||
{publicKeyPem, privateKeyPem} = KeyGen.gen()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue