Skip to content

Commit ff172a7

Browse files
committed
fix remoteEncryptionKey
1 parent 60e59c7 commit ff172a7

1 file changed

Lines changed: 15 additions & 15 deletions

File tree

libsql.go

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ type config struct {
4444
authToken *string
4545
readYourWrites *bool
4646
encryptionKey *string
47-
remoteEncrytionKey *string
47+
remoteEncryptionKey *string
4848
syncInterval *time.Duration
4949
}
5050

@@ -101,13 +101,13 @@ func WithEncryption(key string) Option {
101101

102102
func WithRemoteEncryption(key string) Option {
103103
return option(func(o *config) error {
104-
if o.remoteEncrytionKey != nil {
105-
return fmt.Errorf("encryption key already set")
104+
if o.remoteEncryptionKey != nil {
105+
return fmt.Errorf("remote encryption key already set")
106106
}
107107
if key == "" {
108-
return fmt.Errorf("encryption key must not be empty")
108+
return fmt.Errorf("remote encryption key must not be empty")
109109
}
110-
o.encryptionKey = &key
110+
o.remoteEncryptionKey = &key
111111
return nil
112112
})
113113
}
@@ -145,15 +145,15 @@ func NewEmbeddedReplicaConnector(dbPath string, primaryUrl string, opts ...Optio
145145
if config.encryptionKey != nil {
146146
encryptionKey = *config.encryptionKey
147147
}
148-
remoteEncrytionKey := ""
149-
if config.remoteEncrytionKey != nil {
150-
encryptionKey = *config.encryptionKey
148+
remoteEncryptionKey := ""
149+
if config.remoteEncryptionKey != nil {
150+
remoteEncryptionKey = *config.remoteEncryptionKey
151151
}
152152
syncInterval := time.Duration(0)
153153
if config.syncInterval != nil {
154154
syncInterval = *config.syncInterval
155155
}
156-
return openSyncConnector(dbPath, primaryUrl, authToken, readYourWrites, encryptionKey, remoteEncrytionKey, syncInterval, false)
156+
return openSyncConnector(dbPath, primaryUrl, authToken, readYourWrites, encryptionKey, remoteEncryptionKey, syncInterval, false)
157157
}
158158

159159
func NewSyncedDatabaseConnector(dbPath string, primaryUrl string, opts ...Option) (*Connector, error) {
@@ -179,15 +179,15 @@ func NewSyncedDatabaseConnector(dbPath string, primaryUrl string, opts ...Option
179179
if config.encryptionKey != nil {
180180
encryptionKey = *config.encryptionKey
181181
}
182-
remoteEncrytionKey := ""
183-
if config.remoteEncrytionKey != nil {
184-
encryptionKey = *config.encryptionKey
182+
remoteEncryptionKey := ""
183+
if config.remoteEncryptionKey != nil {
184+
remoteEncryptionKey = *config.remoteEncryptionKey
185185
}
186186
syncInterval := time.Duration(0)
187187
if config.syncInterval != nil {
188188
syncInterval = *config.syncInterval
189189
}
190-
return openSyncConnector(dbPath, primaryUrl, authToken, readYourWrites, encryptionKey, remoteEncrytionKey, syncInterval, true)
190+
return openSyncConnector(dbPath, primaryUrl, authToken, readYourWrites, encryptionKey, remoteEncryptionKey, syncInterval, true)
191191
}
192192

193193
type driver struct{}
@@ -387,8 +387,8 @@ func libsqlOpenWithSync(dbPath, primaryUrl, authToken string, readYourWrites boo
387387

388388
var remoteEncrytionKeyNativeString *C.char
389389
if remoteEncrytionKey != "" {
390-
encrytionKeyNativeString = C.CString(encryptionKey)
391-
defer C.free(unsafe.Pointer(encrytionKeyNativeString))
390+
remoteEncrytionKeyNativeString = C.CString(remoteEncrytionKey)
391+
defer C.free(unsafe.Pointer(remoteEncrytionKeyNativeString))
392392
}
393393

394394
config := C.libsql_config{

0 commit comments

Comments
 (0)