| // Copyright 2015 The Vanadium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| func ConvertBlessingsToHandle(blessings security.Blessings, handle BlessingsHandle) *JsBlessings { |
| encoded, err := EncodePublicKey(blessings.PublicKey()) |
| func EncodePublicKey(key security.PublicKey) (string, error) { |
| bytes, err := key.MarshalBinary() |
| return base64.StdEncoding.EncodeToString(bytes), nil |
| func DecodePublicKey(key string) (security.PublicKey, error) { |
| b, err := base64.StdEncoding.DecodeString(key) |
| return security.UnmarshalPublicKey(b) |