Skip to content

Commit

Permalink
Address comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
beautifulentropy committed Nov 19, 2024
1 parent df73c0c commit 8f60447
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sa/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,15 +282,15 @@ type regModel struct {
// InitialIP is stored as sixteen binary bytes, regardless of whether it
// represents a v4 or v6 IP address.
//
// Deprecated: This field is no longer used and will be removed in a future.
// Deprecated: This field is no longer used and will be removed from the
// database schema in a future release. For now, it is still used inside
// registrationPBToModel, and therefore inside NewRegistration.
InitialIP []byte `db:"initialIp"`
CreatedAt time.Time `db:"createdAt"`
LockCol int64
Status string `db:"status"`
}

var defaultInitialIP = net.ParseIP("0.0.0.0").To16()

func registrationPbToModel(reg *corepb.Registration) (*regModel, error) {
// Even though we don't need to convert from JSON to an in-memory JSONWebKey
// for the sake of the `Key` field, we do need to do the conversion in order
Expand Down Expand Up @@ -328,7 +328,9 @@ func registrationPbToModel(reg *corepb.Registration) (*regModel, error) {
KeySHA256: sha,
Contact: string(jsonContact),
Agreement: reg.Agreement,
InitialIP: defaultInitialIP,
// Although deprecated, this column remains NOT NULL in the database, so
// a value must still be provided.
InitialIP: net.ParseIP("0.0.0.0").To16(),
CreatedAt: createdAt,
Status: reg.Status,
}, nil
Expand Down

0 comments on commit 8f60447

Please sign in to comment.