-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirecrypt.go
41 lines (37 loc) · 1.21 KB
/
firecrypt.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"github.com/gltchitm/firecrypt/crypt"
"github.com/gltchitm/firecrypt/native"
"github.com/gltchitm/firecrypt/profile"
)
func main() {
native.StartFirecrypt(func(name string, detail []string) interface{} {
if name == "get-profiles" {
return profile.GetProfiles()
} else if name == "acquire-profile-lock" {
return profile.AcquireProfileLock(detail[0])
} else if name == "release-profile-lock" {
profile.ReleaseProfileLock()
} else if name == "set-password" {
crypt.SetPassword(detail[0], detail[1])
} else if name == "lock-profile" {
crypt.LockProfile(detail[0])
} else if name == "get-profile-migration-status" {
migrationStatus := crypt.GetProfileMigrationStatus(detail[0])
if migrationStatus == crypt.ProfileMigrationStatusSupported {
return "supported"
} else if migrationStatus == crypt.ProfileMigrationStatusMigratable {
return "migratable"
} else {
return "unsupported"
}
} else if name == "migrate-profile" {
return crypt.MigrateProfile(detail[0], detail[1])
} else if name == "unlock-profile" {
return crypt.UnlockProfile(detail[0], detail[1])
} else if name == "launch-profile" {
profile.LaunchProfile(detail[0])
}
return nil
})
}