de_henne_ has quit [Remote host closed the connection]
de_henne has joined #stellar-dev
<stellar-slack>
<buhrmi> "understand the rationale" implies that there exists such a thing
<stellar-slack>
<graydon> 3 reasons: XDR has a canonical bit-level encoding, is an internet standard, and supports disjoint unions (sum types).
<stellar-slack>
<graydon> I'm not sure about the pattern you're noting. I mean I see it I just don't know why it's an empty union rather than an enum itself. possibly just for uniformity with the treatment of other (non-empty) result-code-keyed unions.
<stellar-slack>
<graydon> discriminant unions do not always save memory; the representation in memory is up to the programming language. the important thing they do is exclude cases. in an encoding without disjoint unions, you have to put all fields for all variants in a structure and guess (or leave to documentation) which combinations of fields can meaningfully be active simultaneously, and what the combinations mean. with disjoint
<stellar-slack>
cases explicitly, excluding the illegal ones.
<stellar-slack>
<sacarlson> it still needs at least one more added item that would be to verify an incomeing signature to be valid before publishing it to the server.
pixelb has joined #stellar-dev
<stellar-slack>
<sacarlson> with my experiments with sig = key_pair.sign("hello world") and keypair.verify(sig,"hello world") I get the basics of signature verification. but how can I use this to verify that a transaction was signed by a keypair? wanted function verify_signature(envelope_b64, account_address) or just verify_signature(envelope_b64)
<stellar-slack>
<dzham> well, you *would* need the public key… verify_signature() would just take the hash of the txenv, and use that as the signed message
<stellar-slack>
<sacarlson> I can experiment with that and see what comes of it
<stellar-slack>
<sacarlson> what i'm presently expermenting with is pulling the tx and signature from the envelope to try to find what is needed to verify them sigs = envelope.signatures sig = sigs[0].signature
<stellar-slack>
<sacarlson> I'm not sure but it looks that this Digest::SHA256.digest(string) wants a string as input
<stellar-slack>
<sacarlson> the tx is a complicated structure
<stellar-slack>
<sacarlson> I have tools that can pull the pulblic key from the tx and even convert it to an address and then to a keypair with no secret seed. but I fail to go any farther
<stellar-slack>
<sacarlson> I would need to know what method of converting the tx into a string is required to do the SHA256 fucntion on