Update per Dans' Comments
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
a19204caf4
commit
a0e58b8736
|
@ -16,6 +16,7 @@ type TokenApplication struct {
|
||||||
|
|
||||||
// HasTokensCapability is granted once the client has obtained signed tokens
|
// HasTokensCapability is granted once the client has obtained signed tokens
|
||||||
const HasTokensCapability = tapir.Capability("HasTokensCapability")
|
const HasTokensCapability = tapir.Capability("HasTokensCapability")
|
||||||
|
const numTokens = 10
|
||||||
|
|
||||||
// NewInstance should always return a new instantiation of the application.
|
// NewInstance should always return a new instantiation of the application.
|
||||||
func (tokenapp *TokenApplication) NewInstance() tapir.Application {
|
func (tokenapp *TokenApplication) NewInstance() tapir.Application {
|
||||||
|
@ -29,7 +30,7 @@ func (tokenapp *TokenApplication) Init(connection tapir.Connection) {
|
||||||
tokenapp.Transcript().NewProtocol("token-app")
|
tokenapp.Transcript().NewProtocol("token-app")
|
||||||
log.Debugf(tokenapp.Transcript().OutputTranscriptToAudit())
|
log.Debugf(tokenapp.Transcript().OutputTranscriptToAudit())
|
||||||
if connection.IsOutbound() {
|
if connection.IsOutbound() {
|
||||||
tokens, blinded := privacypass.GenerateBlindedTokenBatch(10)
|
tokens, blinded := privacypass.GenerateBlindedTokenBatch(numTokens)
|
||||||
data, _ := json.Marshal(blinded)
|
data, _ := json.Marshal(blinded)
|
||||||
connection.Send(data)
|
connection.Send(data)
|
||||||
var signedBatch privacypass.SignedBatchWithProof
|
var signedBatch privacypass.SignedBatchWithProof
|
||||||
|
@ -47,15 +48,17 @@ func (tokenapp *TokenApplication) Init(connection tapir.Connection) {
|
||||||
// If the connection closes without the HasTokensCapability then the error can be handled by whatever client needs it
|
// If the connection closes without the HasTokensCapability then the error can be handled by whatever client needs it
|
||||||
log.Debugf("Failed to verify signed token batch")
|
log.Debugf("Failed to verify signed token batch")
|
||||||
}
|
}
|
||||||
} else {
|
return
|
||||||
var blinded []privacypass.BlindedToken
|
}
|
||||||
err := json.Unmarshal(connection.Expect(), &blinded)
|
|
||||||
if err == nil {
|
// We are the server
|
||||||
batchProof := tokenapp.TokenService.SignBlindedTokenBatch(blinded, tokenapp.Transcript())
|
var blinded []privacypass.BlindedToken
|
||||||
log.Debugf(tokenapp.Transcript().OutputTranscriptToAudit())
|
err := json.Unmarshal(connection.Expect(), &blinded)
|
||||||
data, _ := json.Marshal(batchProof)
|
if err == nil {
|
||||||
connection.Send(data)
|
batchProof := tokenapp.TokenService.SignBlindedTokenBatch(blinded, tokenapp.Transcript())
|
||||||
return
|
log.Debugf(tokenapp.Transcript().OutputTranscriptToAudit())
|
||||||
}
|
data, _ := json.Marshal(batchProof)
|
||||||
|
connection.Send(data)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue