Commit 1e108599 authored by Sietse Ringers's avatar Sietse Ringers
Browse files

Wip on issuance

parent 79c2f2e7
...@@ -20,6 +20,7 @@ type CredentialManager struct { ...@@ -20,6 +20,7 @@ type CredentialManager struct {
storagePath string storagePath string
attributes map[CredentialTypeIdentifier][]*AttributeList attributes map[CredentialTypeIdentifier][]*AttributeList
credentials map[CredentialTypeIdentifier]map[int]*Credential credentials map[CredentialTypeIdentifier]map[int]*Credential
issuance issuanceState
} }
func newCredentialManager() *CredentialManager { func newCredentialManager() *CredentialManager {
...@@ -301,3 +302,17 @@ func (cm *CredentialManager) Proofs(choice *DisclosureChoice, request SessionReq ...@@ -301,3 +302,17 @@ func (cm *CredentialManager) Proofs(choice *DisclosureChoice, request SessionReq
return gabi.BuildProofList(request.GetContext(), request.GetNonce(), builders, issig), nil return gabi.BuildProofList(request.GetContext(), request.GetNonce(), builders, issig), nil
} }
type issuanceState struct {
builders []*gabi.CredentialBuilder
nonce2 *big.Int
}
func (cm *CredentialManager) IssueCommitments(choice *DisclosureChoice, request SessionRequest) (gabi.IssueCommitmentMessage, error) {
cm.issuance = issuanceState{[]*gabi.CredentialBuilder{}, nil}
todisclose, err := cm.groupCredentials(choice)
if err != nil {
return nil, err
}
}
...@@ -86,7 +86,7 @@ func NewServiceProviderJwt(servername string, dr DisclosureRequest) *ServiceProv ...@@ -86,7 +86,7 @@ func NewServiceProviderJwt(servername string, dr DisclosureRequest) *ServiceProv
} }
} }
func NewSignatureServerJwt(servername string, dr SignatureRequest) *SignatureServerJwt { func NewSignatureServerJwt(servername string, sr SignatureRequest) *SignatureServerJwt {
now := Timestamp(time.Now()) now := Timestamp(time.Now())
return &SignatureServerJwt{ return &SignatureServerJwt{
ServerJwt: ServerJwt{ ServerJwt: ServerJwt{
...@@ -94,10 +94,30 @@ func NewSignatureServerJwt(servername string, dr SignatureRequest) *SignatureSer ...@@ -94,10 +94,30 @@ func NewSignatureServerJwt(servername string, dr SignatureRequest) *SignatureSer
IssuedAt: &now, IssuedAt: &now,
Type: "signature_request", Type: "signature_request",
}, },
Request: SignatureServerRequest{Request: dr}, Request: SignatureServerRequest{Request: sr},
} }
} }
func NewIdentityProviderJwt(servername string, ir IssuanceRequest) *IdentityProviderJwt {
now := Timestamp(time.Now())
return &IdentityProviderJwt{
ServerJwt: ServerJwt{
ServerName: servername,
IssuedAt: &now,
Type: "signature_request",
},
Request: IdentityProviderRequest{Request: ir},
}
}
func (ir *IssuanceRequest) GetContext() *big.Int {
return ir.Context
}
func (ir *IssuanceRequest) GetNonce() *big.Int {
return ir.Nonce
}
func (dr *DisclosureRequest) GetContext() *big.Int { func (dr *DisclosureRequest) GetContext() *big.Int {
return dr.Context return dr.Context
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment