use serialized_public_key because a conflict with the diaspora code

This commit is contained in:
Benjamin Neff 2015-07-04 19:46:27 +02:00
parent 1836023a2b
commit 7370a32c65
6 changed files with 29 additions and 30 deletions

View file

@ -43,7 +43,7 @@ module DiasporaFederation
# +guid+: the guid
# "0123456789abcdef"
#
# +public_key+: the public key of the person (DER-encoded PKCS#1 key)
# +serialized_public_key+: the public key of the person (DER-encoded PKCS#1 key)
# "-----BEGIN PUBLIC KEY-----
# ABCDEF==
# -----END PUBLIC KEY-----"
@ -115,7 +115,7 @@ module DiasporaFederation
configuration_error "missing server_uri" unless @server_uri.respond_to? :host
validate_class(@person_class, "person_class", %i(
find_local_by_diaspora_handle find_local_by_guid
diaspora_handle nickname guid public_key searchable
diaspora_handle nickname guid serialized_public_key searchable
alias_url hcard_url seed_url profile_url atom_url salmon_url
photo_large_url photo_medium_url photo_small_url
full_name first_name last_name

View file

@ -18,17 +18,17 @@ module DiasporaFederation
# html_string = HCard.from_person(person).to_html
#
# The person object should have the following attributes (with examples)
# guid: "0123456789abcdef",
# nickname: "user",
# full_name: "User Name",
# seed_url: "https://server.example/",
# photo_large_url: "https://server.example/uploads/l.jpg",
# photo_medium_url: "https://server.example/uploads/m.jpg",
# photo_small_url: "https://server.example/uploads/s.jpg",
# public_key: "-----BEGIN PUBLIC KEY-----\nABCDEF==\n-----END PUBLIC KEY-----",
# searchable: true,
# first_name: "User",
# last_name: "Name"
# guid: "0123456789abcdef",
# nickname: "user",
# full_name: "User Name",
# seed_url: "https://server.example/",
# photo_large_url: "https://server.example/uploads/l.jpg",
# photo_medium_url: "https://server.example/uploads/m.jpg",
# photo_small_url: "https://server.example/uploads/s.jpg",
# serialized_public_key: "-----BEGIN PUBLIC KEY-----\nABCDEF==\n-----END PUBLIC KEY-----",
# searchable: true,
# first_name: "User",
# last_name: "Name"
#
# @example Create a HCard instance from an hCard document
# hc = HCard.from_html(html_string)
@ -161,7 +161,7 @@ module DiasporaFederation
@photo_large_url = person.photo_large_url
@photo_medium_url = person.photo_medium_url
@photo_small_url = person.photo_small_url
@public_key = person.public_key
@public_key = person.serialized_public_key
@searchable = person.searchable
# TODO: remove me! ###################

View file

@ -13,15 +13,15 @@ module DiasporaFederation
# xml_string = WebFinger.from_person(person).to_xml
#
# The person object should have the following attributes (with examples)
# diaspora_handle: "user@server.example"
# alias_url: "https://server.example/people/0123456789abcdef"
# hcard_url: "https://server.example/hcard/users/0123456789abcdef"
# seed_url: "https://server.example/"
# profile_url: "https://server.example/u/user"
# atom_url: "https://server.example/public/user.atom"
# salmon_url: "https://server.example/receive/users/0123456789abcdef"
# guid: "0123456789abcdef"
# public_key: "-----BEGIN PUBLIC KEY-----\nABCDEF==\n-----END PUBLIC KEY-----"
# diaspora_handle: "user@server.example"
# alias_url: "https://server.example/people/0123456789abcdef"
# hcard_url: "https://server.example/hcard/users/0123456789abcdef"
# seed_url: "https://server.example/"
# profile_url: "https://server.example/u/user"
# atom_url: "https://server.example/public/user.atom"
# salmon_url: "https://server.example/receive/users/0123456789abcdef"
# guid: "0123456789abcdef"
# serialized_public_key: "-----BEGIN PUBLIC KEY-----\nABCDEF==\n-----END PUBLIC KEY-----"
#
# @example Creating a WebFinger instance from an xml document
# wf = WebFinger.from_xml(xml_string)
@ -150,7 +150,7 @@ module DiasporaFederation
# TODO: remove me! #########
@guid = person.guid
@public_key = person.public_key
@public_key = person.serialized_public_key
#############################
}
wf

View file

@ -43,7 +43,7 @@ module DiasporaFederation
<dl class="entity_key">
<dt>Key</dt>
<dd>
<pre class="key">#{person.public_key}</pre>
<pre class="key">#{person.serialized_public_key}</pre>
</dd>
</dl>
<dl class="entity_first_name">
@ -114,7 +114,7 @@ HTML
expect(hcard.photo_large_url).to eq(person.photo_large_url)
expect(hcard.photo_medium_url).to eq(person.photo_medium_url)
expect(hcard.photo_small_url).to eq(person.photo_small_url)
expect(hcard.public_key).to eq(person.public_key)
expect(hcard.public_key).to eq(person.serialized_public_key)
expect(hcard.searchable).to eq(person.searchable)
expect(hcard.first_name).to eq(person.first_name)

View file

@ -2,7 +2,7 @@ module DiasporaFederation
describe WebFinger::WebFinger do
let(:person) { FactoryGirl.create(:person) }
let(:acct) { "acct:#{person.diaspora_handle}" }
let(:public_key_base64) { Base64.strict_encode64(person.public_key) }
let(:public_key_base64) { Base64.strict_encode64(person.serialized_public_key) }
let(:xml) {
<<-XML
@ -48,7 +48,7 @@ XML
expect(wf.salmon_url).to eq(person.salmon_url)
expect(wf.guid).to eq(person.guid)
expect(wf.public_key).to eq(person.public_key)
expect(wf.public_key).to eq(person.serialized_public_key)
end
it "reads old-style XML" do
@ -79,7 +79,7 @@ XML
expect(wf.salmon_url).to eq(person.salmon_url)
expect(wf.guid).to eq(person.guid)
expect(wf.public_key).to eq(person.public_key)
expect(wf.public_key).to eq(person.serialized_public_key)
end
it "fails if the document is empty" do

View file

@ -8,7 +8,6 @@ class Person < ActiveRecord::Base
def salmon_url; "#{url}receive/users/#{guid}" end
alias_attribute :seed_url, :url
alias_attribute :public_key, :serialized_public_key
def nickname; diaspora_handle.split("@")[0] end
def photo_large_url; "#{url}assets/user/default.png" end