Comments (2)
I see. So the key was wrong (it's 33 bytes), but expected behaviour of Eddy.PubKey.from_bin
would be to return an {:error, useful_term}
tuple, not raise as it's doing. Is that about right?
from eddy.
I think the expected behaviour is to return an error tuple, yes. The behaviour is inconsistent:
iex(67)> Eddy.PubKey.from_bin("1234567890123456789012345678901")
{:error, {:decode_error, "invalid point length"}}
iex(68)> Eddy.PubKey.from_bin("12345678901234567890123456789012")
{:ok,
%Eddy.PubKey{
point: %Eddy.Point{
x: 15210286179116880499108877439899788040423458621963594945337907680618980329860,
y: 22702550761799267355187145649125784605216755694630776232256222584591002841649
}
}}
iex(69)> Eddy.PubKey.from_bin("123456789012345678901234567890123")
** (FunctionClauseError) no function clause matching in Eddy.Serializable.Encoder.Eddy.Point.normalize_y/1
The following arguments were given to Eddy.Serializable.Encoder.Eddy.Point.normalize_y/1:
# 1
"123456789012345678901234567890123"
Attempted function clauses (showing 1 out of 1):
defp normalize_y(<<bytes::binary-size(31), last>>)
(eddy 1.0.0) lib/eddy/point.ex:120: Eddy.Serializable.Encoder.Eddy.Point.normalize_y/1
(eddy 1.0.0) lib/eddy/point.ex:99: Eddy.Serializable.Encoder.Eddy.Point.parse/2
(eddy 1.0.0) lib/eddy/pub_key.ex:27: Eddy.Serializable.Encoder.Eddy.PubKey.parse/2
(eddy 1.0.0) lib/eddy/pub_key.ex:24: Eddy.PubKey.from_bin/2
iex:69: (file)
Like I said, this was completely my fault, but i was still a little surprised since it validates under length, but blows up on over length. Just thought I'd let you know! Cheers
from eddy.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from eddy.