Skip to content

Latest commit

 

History

History
27 lines (22 loc) · 739 Bytes

README.md

File metadata and controls

27 lines (22 loc) · 739 Bytes

yc-lockbox-struct

Library to populate struct fields from Yandex.Cloud Lockbox Secret Payload.

How to use

  1. Define struct:
    type testSecret struct {
        Text   string `secretKey:"testText"`
        Binary []byte `secretKey:"testFile"`
    }
  2. Request secret payload and extract secrets to variable:
    payload, err := sdk.LockboxPayload().Payload().Get(ctx, &lockbox.GetPayloadRequest{SecretId: "mysecretid"})
    if err != nil {
        log.Fatalf("Unable to get secret: %v", err)
    }
    
    secret := testSecret{}
    if err := yc_lockbox_unpack.UnpackPayload(payload, &secret); err != nil {
        log.Fatalf("Unable to unpack secret: %v", err)
    }