amber-client

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2023 License: BSD-3-Clause

README

Intel Project Amber Go Client Library - API V1

This is the beta version of Go Library for integrating with Intel Project Amber V1 API.

Download

Download the latest version of the library with the following commands:

go get github.com/arvind5/amber-client/go-client

Go Requirement

Use go1.19 or newer. Follow https://go.dev/doc/install for installation of Go.

Unit Tests

To run the tests, run cd go-client && go test ./...

See the example test in go-client/token_test.go for an example of a test.

Usage

Create a new Project Amber client, then use the exposed services to access different parts of the Project Amber API.

import amberclient "github.com/arvind5/amber-client/go-client"

cfg := amberclient.Config{
        // Replace AMBER_URL with real Amber URL
        BaseUrl: "AMBER_URL",
        // Replace AMBER_API_URL with real Amber Attestation API URL
        ApiUrl: "AMBER_API_URL",
        // Provide TLS config
        TlsCfg: &tls.Config{},
        // Replace AMBER_API_KEY with your real key
        ApiKey: "AMBER_API_KEY",
}

client, err := amberclient.New(&cfg)
To get a Amber signed nonce
nonce, err := client.GetNonce()
if err != nil {
    fmt.Printf("Something bad happened: %s\n\n", err)
    return err
}
To get a Amber signed token with Nonce and Evidence
token, err := client.GetToken(nonce, policyIds, evidence)
if err != nil {
    fmt.Printf("Something bad happened: %s\n\n", err)
    return err
}
To verify a Amber signed token
parsedToken, err := client.VerifyToken(string(token))
if err != nil {
    fmt.Printf("Something bad happened: %s\n\n", err)
    return err
}
To download Amber token signing certificates
jwks, err := client.GetAmberCertificates()
if err != nil {
    fmt.Printf("Something bad happened: %s\n\n", err)
    return err
}
To collect Amber signed token with Adapter

To create adapter refer go-sgx or go-tdx:

token, err := client.CollectToken(adapter, policyIds)
if err != nil {
    return err
}

License

This library is distributed under the BSD-style license found in the LICENSE file.

Directories

Path Synopsis
* Copyright (c) 2023 Intel Corporation * All rights reserved.
* Copyright (c) 2023 Intel Corporation * All rights reserved.
* Copyright (c) 2022 Intel Corporation * All rights reserved.
* Copyright (c) 2022 Intel Corporation * All rights reserved.
* Copyright (c) 2022 Intel Corporation * All rights reserved.
* Copyright (c) 2022 Intel Corporation * All rights reserved.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL