{"action":"created","issue":{"url":"https://api.github.com/repos/libp2p/go-libp2p/issues/227","repository_url":"https://api.github.com/repos/libp2p/go-libp2p","labels_url":"https://api.github.com/repos/libp2p/go-libp2p/issues/227/labels{/name}","comments_url":"https://api.github.com/repos/libp2p/go-libp2p/issues/227/comments","events_url":"https://api.github.com/repos/libp2p/go-libp2p/issues/227/events","html_url":"https://github.com/libp2p/go-libp2p/issues/227","id":255980403,"number":227,"title":"Quick question about Ed25519 with the libp2p-host example ","user":{"login":"ssikdar1","id":3411882,"avatar_url":"https://avatars3.githubusercontent.com/u/3411882?v=4","gravatar_id":"","url":"https://api.github.com/users/ssikdar1","html_url":"https://github.com/ssikdar1","followers_url":"https://api.github.com/users/ssikdar1/followers","following_url":"https://api.github.com/users/ssikdar1/following{/other_user}","gists_url":"https://api.github.com/users/ssikdar1/gists{/gist_id}","starred_url":"https://api.github.com/users/ssikdar1/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ssikdar1/subscriptions","organizations_url":"https://api.github.com/users/ssikdar1/orgs","repos_url":"https://api.github.com/users/ssikdar1/repos","events_url":"https://api.github.com/users/ssikdar1/events{/privacy}","received_events_url":"https://api.github.com/users/ssikdar1/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-09-07T15:34:39Z","updated_at":"2017-09-07T15:47:33Z","closed_at":null,"author_association":"NONE","body":"Looking at the example here: https://github.com/libp2p/go-libp2p/blob/master/examples/libp2p-host/host.go\r\n\r\n\t// Generate an identity keypair using go's cryptographic randomness source\r\n\tpriv, pub, err := crypto.GenerateEd25519Key(rand.Reader)\r\n\r\nand then later when creating the Peer ID: \r\n\r\n\t// A peers ID is the hash of its public key\r\n\tpid, err := peer.IDFromPublicKey(pub)\r\n\r\nHowever in the go docs for go-libp2p-peer\r\n\r\nThere is also a function to create a peer corresponding to Ed25519:\r\nhttps://godoc.org/github.com/libp2p/go-libp2p-peer#IDFromEd25519PublicKey \r\n\r\nfunc IDFromEd25519PublicKey\r\nfunc IDFromEd25519PublicKey(pk ic.PubKey) (ID, error)\r\nIDFromEd25519PublicKey returns the Peer ID corresponding to Id25519 pk\r\n\r\nShould the example use this function since its using crypto.GenerateEd25519Key to generate the public key?\r\n\r\nOr do you you use IDFromEd25519PublicKey when you generate a priv, pub pair with a function different from crypto.GenerateEd25519Key(rand.Reader)?\r\n\r\nOr does it not matter what you use?\r\n"},"comment":{"url":"https://api.github.com/repos/libp2p/go-libp2p/issues/comments/327840891","html_url":"https://github.com/libp2p/go-libp2p/issues/227#issuecomment-327840891","issue_url":"https://api.github.com/repos/libp2p/go-libp2p/issues/227","id":327840891,"user":{"login":"whyrusleeping","id":1243164,"avatar_url":"https://avatars0.githubusercontent.com/u/1243164?v=4","gravatar_id":"","url":"https://api.github.com/users/whyrusleeping","html_url":"https://github.com/whyrusleeping","followers_url":"https://api.github.com/users/whyrusleeping/followers","following_url":"https://api.github.com/users/whyrusleeping/following{/other_user}","gists_url":"https://api.github.com/users/whyrusleeping/gists{/gist_id}","starred_url":"https://api.github.com/users/whyrusleeping/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whyrusleeping/subscriptions","organizations_url":"https://api.github.com/users/whyrusleeping/orgs","repos_url":"https://api.github.com/users/whyrusleeping/repos","events_url":"https://api.github.com/users/whyrusleeping/events{/privacy}","received_events_url":"https://api.github.com/users/whyrusleeping/received_events","type":"User","site_admin":false},"created_at":"2017-09-07T15:47:33Z","updated_at":"2017-09-07T15:47:33Z","author_association":"CONTRIBUTOR","body":"We're currently working on this distinction. The `IDFromPublicKey` puts the public key in a tagged struct, hashes it, and sets the peer ID to that hash. `IDFrom Ed25519PublicKey` embeds the public key in the peer ID, so that if you have the nodes peer ID, you have their public key as well. For now, I would recommend using `IDFromPublicKey`. `IDFromEd25519PublicKey` is experimental and not yet fully supported.\r\n\r\ncc @JustinDrake "}}
{"actor":{"display_login":"whyrusleeping"}}