Skip to content

Commit 8692349

Browse files
committed
disable string option for h2
Signed-off-by: sal rashid <salrashid123@gmail.com>
1 parent d9c2e24 commit 8692349

2 files changed

Lines changed: 3 additions & 19 deletions

File tree

import.go

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -133,18 +133,7 @@ func (s *RemoteWrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*w
133133
s.encryptedSessionName = opts.withSessionEncryptionName
134134
}
135135

136-
switch {
137-
case os.Getenv(EnvParentKeyH2) != "" && !opts.Options.WithDisallowEnvVars:
138-
v := os.Getenv(EnvParentKeyH2)
139-
if v == "true" {
140-
s.parentKeyH2 = true
141-
}
142-
case opts.withParentKeyH2 != "":
143-
if opts.withParentKeyH2 == "true" {
144-
s.parentKeyH2 = true
145-
}
146-
}
147-
136+
s.parentKeyH2 = opts.withParentKeyH2
148137
s.debug = opts.withDebug
149138

150139
// Map that holds non-sensitive configuration info to return
@@ -156,9 +145,6 @@ func (s *RemoteWrapper) SetConfig(_ context.Context, opt ...wrapping.Option) (*w
156145
wrapConfig.Metadata[USER_AUTH] = s.userAuth
157146
wrapConfig.Metadata[HIERARCHY_AUTH] = s.hierarchyAuth
158147
wrapConfig.Metadata[KEY_NAME] = s.keyName
159-
if s.parentKeyH2 {
160-
wrapConfig.Metadata[PARENT_KEY_H2] = "true"
161-
}
162148
wrapConfig.Metadata[SESSION_ENCRYPTION_NAME] = s.encryptedSessionName
163149
return wrapConfig, nil
164150
}

options.go

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,6 @@ func getOpts(opt ...wrapping.Option) (*options, error) {
5555
opts.withHierarchyAuth = v
5656
case KEY_NAME:
5757
opts.withKeyName = v
58-
case PARENT_KEY_H2:
59-
opts.withParentKeyH2 = v
6058
case ENCRYPTING_PUBLIC_KEY:
6159
opts.withEncryptingPublicKey = v
6260
case SESSION_ENCRYPTION_NAME:
@@ -93,7 +91,7 @@ type options struct {
9391
withKeyName string
9492
withEncryptingPublicKey string
9593
withSessionEncryptionName string
96-
withParentKeyH2 string
94+
withParentKeyH2 bool
9795
withDebug bool
9896
}
9997

@@ -195,7 +193,7 @@ func WithSessionEncryptionName(with string) wrapping.Option {
195193
func WithParentKeyH2(with bool) wrapping.Option {
196194
return func() interface{} {
197195
return OptionFunc(func(o *options) error {
198-
o.withParentKeyH2 = "true"
196+
o.withParentKeyH2 = with
199197
return nil
200198
})
201199
}

0 commit comments

Comments
 (0)