diff --git a/.gitignore b/.gitignore index 82c3e53..4046747 100644 --- a/.gitignore +++ b/.gitignore @@ -55,6 +55,13 @@ Cartfile.resolved Carthage/Build +# Go Mobile Build results and dependency sources +go/bin/ +go/dist/ +go/pkg/ +go/src/* +!go/src/gopenpgpwrapper + # fastlane # # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the diff --git a/go/dist/Gopenpgpwrapper.framework/Gopenpgpwrapper b/go/dist/Gopenpgpwrapper.framework/Gopenpgpwrapper deleted file mode 100644 index e2eea6a..0000000 Binary files a/go/dist/Gopenpgpwrapper.framework/Gopenpgpwrapper and /dev/null differ diff --git a/go/dist/Gopenpgpwrapper.framework/Headers/Gopenpgpwrapper.h b/go/dist/Gopenpgpwrapper.framework/Headers/Gopenpgpwrapper.h deleted file mode 100644 index ab2d6f7..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Headers/Gopenpgpwrapper.h +++ /dev/null @@ -1,13 +0,0 @@ - -// Objective-C API for talking to the following Go packages -// -// github.com/ZortacDev/GopenPGPWrapper/go/gopenpgpwrapper -// -// File is generated by gomobile bind. Do not edit. -#ifndef __Gopenpgpwrapper_FRAMEWORK_H__ -#define __Gopenpgpwrapper_FRAMEWORK_H__ - -#include "Gopenpgpwrapper.objc.h" -#include "Universe.objc.h" - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Headers/Gopenpgpwrapper.objc.h b/go/dist/Gopenpgpwrapper.framework/Headers/Gopenpgpwrapper.objc.h deleted file mode 100644 index e3cd9bb..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Headers/Gopenpgpwrapper.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to github.com/ZortacDev/GopenPGPWrapper/go/gopenpgpwrapper Go package. -// gobind -lang=objc github.com/ZortacDev/GopenPGPWrapper/go/gopenpgpwrapper -// -// File is generated by gobind. Do not edit. - -#ifndef __Gopenpgpwrapper_H__ -#define __Gopenpgpwrapper_H__ - -@import Foundation; -#include "ref.h" -#include "Universe.objc.h" - - -@class GopenpgpwrapperKey; - -@interface GopenpgpwrapperKey : NSObject { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (nonnull instancetype)init; -- (NSData* _Nullable)decrypt:(NSData* _Nullable)ciphertext passphrase:(NSString* _Nullable)passphrase; -- (NSData* _Nullable)encrypt:(NSData* _Nullable)plaintext armor:(BOOL)armor; -- (NSString* _Nonnull)getKeyID; -@end - -FOUNDATION_EXPORT GopenpgpwrapperKey* _Nullable GopenpgpwrapperReadKey(NSData* _Nullable data); - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Headers/Universe.objc.h b/go/dist/Gopenpgpwrapper.framework/Headers/Universe.objc.h deleted file mode 100644 index 019e750..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Headers/Universe.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to Go package. -// gobind -lang=objc -// -// File is generated by gobind. Do not edit. - -#ifndef __Universe_H__ -#define __Universe_H__ - -@import Foundation; -#include "ref.h" - -@protocol Universeerror; -@class Universeerror; - -@protocol Universeerror -- (NSString* _Nonnull)error; -@end - -@class Universeerror; - -@interface Universeerror : NSError { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (NSString* _Nonnull)error; -@end - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Headers/ref.h b/go/dist/Gopenpgpwrapper.framework/Headers/ref.h deleted file mode 100644 index b8036a4..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Headers/ref.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef __GO_REF_HDR__ -#define __GO_REF_HDR__ - -#include - -// GoSeqRef is an object tagged with an integer for passing back and -// forth across the language boundary. A GoSeqRef may represent either -// an instance of a Go object, or an Objective-C object passed to Go. -// The explicit allocation of a GoSeqRef is used to pin a Go object -// when it is passed to Objective-C. The Go seq package maintains a -// reference to the Go object in a map keyed by the refnum along with -// a reference count. When the reference count reaches zero, the Go -// seq package will clear the corresponding entry in the map. -@interface GoSeqRef : NSObject { -} -@property(readonly) int32_t refnum; -@property(strong) id obj; // NULL when representing a Go object. - -// new GoSeqRef object to proxy a Go object. The refnum must be -// provided from Go side. -- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; - -- (int32_t)incNum; - -@end - -@protocol goSeqRefInterface --(GoSeqRef*) _ref; -@end - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Modules/module.modulemap b/go/dist/Gopenpgpwrapper.framework/Modules/module.modulemap deleted file mode 100644 index b388a7d..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Modules/module.modulemap +++ /dev/null @@ -1,8 +0,0 @@ -framework module "Gopenpgpwrapper" { - header "ref.h" - header "Gopenpgpwrapper.objc.h" - header "Universe.objc.h" - header "Gopenpgpwrapper.h" - - export * -} \ No newline at end of file diff --git a/go/dist/Gopenpgpwrapper.framework/Resources/Info.plist b/go/dist/Gopenpgpwrapper.framework/Resources/Info.plist deleted file mode 100644 index 0d1a4b8..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Resources/Info.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/A/Gopenpgpwrapper b/go/dist/Gopenpgpwrapper.framework/Versions/A/Gopenpgpwrapper deleted file mode 100644 index e2eea6a..0000000 Binary files a/go/dist/Gopenpgpwrapper.framework/Versions/A/Gopenpgpwrapper and /dev/null differ diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/Gopenpgpwrapper.h b/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/Gopenpgpwrapper.h deleted file mode 100644 index ab2d6f7..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/Gopenpgpwrapper.h +++ /dev/null @@ -1,13 +0,0 @@ - -// Objective-C API for talking to the following Go packages -// -// github.com/ZortacDev/GopenPGPWrapper/go/gopenpgpwrapper -// -// File is generated by gomobile bind. Do not edit. -#ifndef __Gopenpgpwrapper_FRAMEWORK_H__ -#define __Gopenpgpwrapper_FRAMEWORK_H__ - -#include "Gopenpgpwrapper.objc.h" -#include "Universe.objc.h" - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/Gopenpgpwrapper.objc.h b/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/Gopenpgpwrapper.objc.h deleted file mode 100644 index e3cd9bb..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/Gopenpgpwrapper.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to github.com/ZortacDev/GopenPGPWrapper/go/gopenpgpwrapper Go package. -// gobind -lang=objc github.com/ZortacDev/GopenPGPWrapper/go/gopenpgpwrapper -// -// File is generated by gobind. Do not edit. - -#ifndef __Gopenpgpwrapper_H__ -#define __Gopenpgpwrapper_H__ - -@import Foundation; -#include "ref.h" -#include "Universe.objc.h" - - -@class GopenpgpwrapperKey; - -@interface GopenpgpwrapperKey : NSObject { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (nonnull instancetype)init; -- (NSData* _Nullable)decrypt:(NSData* _Nullable)ciphertext passphrase:(NSString* _Nullable)passphrase; -- (NSData* _Nullable)encrypt:(NSData* _Nullable)plaintext armor:(BOOL)armor; -- (NSString* _Nonnull)getKeyID; -@end - -FOUNDATION_EXPORT GopenpgpwrapperKey* _Nullable GopenpgpwrapperReadKey(NSData* _Nullable data); - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/Universe.objc.h b/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/Universe.objc.h deleted file mode 100644 index 019e750..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/Universe.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to Go package. -// gobind -lang=objc -// -// File is generated by gobind. Do not edit. - -#ifndef __Universe_H__ -#define __Universe_H__ - -@import Foundation; -#include "ref.h" - -@protocol Universeerror; -@class Universeerror; - -@protocol Universeerror -- (NSString* _Nonnull)error; -@end - -@class Universeerror; - -@interface Universeerror : NSError { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (NSString* _Nonnull)error; -@end - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/ref.h b/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/ref.h deleted file mode 100644 index b8036a4..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/A/Headers/ref.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef __GO_REF_HDR__ -#define __GO_REF_HDR__ - -#include - -// GoSeqRef is an object tagged with an integer for passing back and -// forth across the language boundary. A GoSeqRef may represent either -// an instance of a Go object, or an Objective-C object passed to Go. -// The explicit allocation of a GoSeqRef is used to pin a Go object -// when it is passed to Objective-C. The Go seq package maintains a -// reference to the Go object in a map keyed by the refnum along with -// a reference count. When the reference count reaches zero, the Go -// seq package will clear the corresponding entry in the map. -@interface GoSeqRef : NSObject { -} -@property(readonly) int32_t refnum; -@property(strong) id obj; // NULL when representing a Go object. - -// new GoSeqRef object to proxy a Go object. The refnum must be -// provided from Go side. -- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; - -- (int32_t)incNum; - -@end - -@protocol goSeqRefInterface --(GoSeqRef*) _ref; -@end - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/A/Modules/module.modulemap b/go/dist/Gopenpgpwrapper.framework/Versions/A/Modules/module.modulemap deleted file mode 100644 index b388a7d..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/A/Modules/module.modulemap +++ /dev/null @@ -1,8 +0,0 @@ -framework module "Gopenpgpwrapper" { - header "ref.h" - header "Gopenpgpwrapper.objc.h" - header "Universe.objc.h" - header "Gopenpgpwrapper.h" - - export * -} \ No newline at end of file diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/A/Resources/Info.plist b/go/dist/Gopenpgpwrapper.framework/Versions/A/Resources/Info.plist deleted file mode 100644 index 0d1a4b8..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/A/Resources/Info.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Gopenpgpwrapper b/go/dist/Gopenpgpwrapper.framework/Versions/Current/Gopenpgpwrapper deleted file mode 100644 index e2eea6a..0000000 Binary files a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Gopenpgpwrapper and /dev/null differ diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/Gopenpgpwrapper.h b/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/Gopenpgpwrapper.h deleted file mode 100644 index ab2d6f7..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/Gopenpgpwrapper.h +++ /dev/null @@ -1,13 +0,0 @@ - -// Objective-C API for talking to the following Go packages -// -// github.com/ZortacDev/GopenPGPWrapper/go/gopenpgpwrapper -// -// File is generated by gomobile bind. Do not edit. -#ifndef __Gopenpgpwrapper_FRAMEWORK_H__ -#define __Gopenpgpwrapper_FRAMEWORK_H__ - -#include "Gopenpgpwrapper.objc.h" -#include "Universe.objc.h" - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/Gopenpgpwrapper.objc.h b/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/Gopenpgpwrapper.objc.h deleted file mode 100644 index e3cd9bb..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/Gopenpgpwrapper.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to github.com/ZortacDev/GopenPGPWrapper/go/gopenpgpwrapper Go package. -// gobind -lang=objc github.com/ZortacDev/GopenPGPWrapper/go/gopenpgpwrapper -// -// File is generated by gobind. Do not edit. - -#ifndef __Gopenpgpwrapper_H__ -#define __Gopenpgpwrapper_H__ - -@import Foundation; -#include "ref.h" -#include "Universe.objc.h" - - -@class GopenpgpwrapperKey; - -@interface GopenpgpwrapperKey : NSObject { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (nonnull instancetype)init; -- (NSData* _Nullable)decrypt:(NSData* _Nullable)ciphertext passphrase:(NSString* _Nullable)passphrase; -- (NSData* _Nullable)encrypt:(NSData* _Nullable)plaintext armor:(BOOL)armor; -- (NSString* _Nonnull)getKeyID; -@end - -FOUNDATION_EXPORT GopenpgpwrapperKey* _Nullable GopenpgpwrapperReadKey(NSData* _Nullable data); - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/Universe.objc.h b/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/Universe.objc.h deleted file mode 100644 index 019e750..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/Universe.objc.h +++ /dev/null @@ -1,29 +0,0 @@ -// Objective-C API for talking to Go package. -// gobind -lang=objc -// -// File is generated by gobind. Do not edit. - -#ifndef __Universe_H__ -#define __Universe_H__ - -@import Foundation; -#include "ref.h" - -@protocol Universeerror; -@class Universeerror; - -@protocol Universeerror -- (NSString* _Nonnull)error; -@end - -@class Universeerror; - -@interface Universeerror : NSError { -} -@property(strong, readonly) _Nonnull id _ref; - -- (nonnull instancetype)initWithRef:(_Nonnull id)ref; -- (NSString* _Nonnull)error; -@end - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/ref.h b/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/ref.h deleted file mode 100644 index b8036a4..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Headers/ref.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -#ifndef __GO_REF_HDR__ -#define __GO_REF_HDR__ - -#include - -// GoSeqRef is an object tagged with an integer for passing back and -// forth across the language boundary. A GoSeqRef may represent either -// an instance of a Go object, or an Objective-C object passed to Go. -// The explicit allocation of a GoSeqRef is used to pin a Go object -// when it is passed to Objective-C. The Go seq package maintains a -// reference to the Go object in a map keyed by the refnum along with -// a reference count. When the reference count reaches zero, the Go -// seq package will clear the corresponding entry in the map. -@interface GoSeqRef : NSObject { -} -@property(readonly) int32_t refnum; -@property(strong) id obj; // NULL when representing a Go object. - -// new GoSeqRef object to proxy a Go object. The refnum must be -// provided from Go side. -- (instancetype)initWithRefnum:(int32_t)refnum obj:(id)obj; - -- (int32_t)incNum; - -@end - -@protocol goSeqRefInterface --(GoSeqRef*) _ref; -@end - -#endif diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Modules/module.modulemap b/go/dist/Gopenpgpwrapper.framework/Versions/Current/Modules/module.modulemap deleted file mode 100644 index b388a7d..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Modules/module.modulemap +++ /dev/null @@ -1,8 +0,0 @@ -framework module "Gopenpgpwrapper" { - header "ref.h" - header "Gopenpgpwrapper.objc.h" - header "Universe.objc.h" - header "Gopenpgpwrapper.h" - - export * -} \ No newline at end of file diff --git a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Resources/Info.plist b/go/dist/Gopenpgpwrapper.framework/Versions/Current/Resources/Info.plist deleted file mode 100644 index 0d1a4b8..0000000 --- a/go/dist/Gopenpgpwrapper.framework/Versions/Current/Resources/Info.plist +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/go/src/gopenpgpwrapper.go b/go/src/gopenpgpwrapper/gopenpgpwrapper.go similarity index 96% rename from go/src/gopenpgpwrapper.go rename to go/src/gopenpgpwrapper/gopenpgpwrapper.go index 1524bfb..9c7999a 100644 --- a/go/src/gopenpgpwrapper.go +++ b/go/src/gopenpgpwrapper/gopenpgpwrapper.go @@ -1,4 +1,4 @@ -package gopenpgpwrapper // import "gopenpgpwrapper" +package gopenpgpwrapper import ( "bytes" diff --git a/gopenpgp_build.sh b/gopenpgp_build.sh new file mode 100755 index 0000000..74a5023 --- /dev/null +++ b/gopenpgp_build.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +OLDGOPATH=$GOPATH + +export GOPATH=$(pwd)/go + +go get -u golang.org/x/mobile/cmd/gomobile +go install golang.org/x/mobile/cmd/gobind +go get golang.org/x/mobile + +go get -u github.com/ProtonMail/gopenpgp + +cd $GOPATH/src/github.com/ProtonMail/gopenpgp + +git fetch && git fetch --tags + +git checkout v0 + +GO111MODULE=on go mod vendor + +git checkout v1.0.0 + +cd $GOPATH +mkdir dist + +$GOPATH/bin/gomobile bind -target ios -o dist/Gopenpgpwrapper.framework gopenpgpwrapper + +export GOPATH=$OLDGOPATH