client

package
v2.8.3 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package client provides a client for interacting with the Bloock SDK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthenticityClient added in v2.4.0

type AuthenticityClient struct {
	// contains filtered or unexported fields
}

AuthenticityClient represents a client for interacting with the Bloock Authenticity service.

func NewAuthenticityClient added in v2.4.0

func NewAuthenticityClient() AuthenticityClient

NewAuthenticityClient creates a new instance of the AuthenticityClient with default configuration.

func NewAuthenticityClientWithConfig added in v2.4.0

func NewAuthenticityClientWithConfig(configData *proto.ConfigData) AuthenticityClient

NewAuthenticityClientWithConfig creates a new instance of the AuthenticityClient with the provided configuration.

func (*AuthenticityClient) GenerateEcdsaKeys added in v2.4.0

func (c *AuthenticityClient) GenerateEcdsaKeys() (key.KeyPair, error)

GenerateEcdsaKeys generates ECDSA key pair for signing records. Deprecated: Will be deleted in future versions. Use KeyClient.newLocalKey function instead.

func (*AuthenticityClient) GetSignatures added in v2.4.0

func (c *AuthenticityClient) GetSignatures(r record.Record) ([]authenticity.Signature, error)

GetSignatures retrieves the signatures associated with a Bloock record.

func (*AuthenticityClient) Sign added in v2.4.0

Sign signs a Bloock record using the specified signer.

func (*AuthenticityClient) Verify added in v2.4.0

func (c *AuthenticityClient) Verify(r record.Record) (bool, error)

Verify verifies the authenticity of a Bloock record.

type AvailabilityClient added in v2.4.0

type AvailabilityClient struct {
	// contains filtered or unexported fields
}

AvailabilityClient represents a client for interacting with the Bloock Availability service.

func NewAvailabilityClient added in v2.4.0

func NewAvailabilityClient() AvailabilityClient

NewAvailabilityClient creates a new instance of the AvailabilityClient with default configuration.

func NewAvailabilityClientWithConfig added in v2.4.0

func NewAvailabilityClientWithConfig(configData *proto.ConfigData) AvailabilityClient

NewAvailabilityClientWithConfig creates a new instance of the AvailabilityClient with the provided configuration.

func (*AvailabilityClient) Publish added in v2.4.0

func (c *AvailabilityClient) Publish(r record.Record, publisher availability.Publisher) (string, error)

Publish publishes a Bloock record to the Availability service using the specified publisher.

func (*AvailabilityClient) Retrieve added in v2.4.0

func (c *AvailabilityClient) Retrieve(loader availability.Loader) (record.Record, error)

Retrieve retrieves a Bloock record from the Availability service using the specified loader.

type BloockClient added in v2.4.0

type BloockClient struct {
	AuthenticityClient AuthenticityClient
	AvailabilityClient AvailabilityClient
	EncryptionClient   EncryptionClient
	IdentityCoreClient IdentityCoreClient
	IdentityClient     IdentityClient
	IntegrityClient    IntegrityClient
	KeyClient          KeyClient
	RecordClient       RecordClient
	WebhookClient      WebhookClient
	// contains filtered or unexported fields
}

BloockClient represents a client for interacting with the Bloock SDK.

func NewBloockClient added in v2.4.0

func NewBloockClient(apiKey string, identityApiHost *string, forceEnv *string) BloockClient

NewBloockClient creates a new instance of the Bloock SDK client with the specified configuration.

type EncryptionClient added in v2.4.0

type EncryptionClient struct {
	// contains filtered or unexported fields
}

EncryptionClient represents a client for interacting with the Bloock Encryption service.

func NewEncryptionClient added in v2.4.0

func NewEncryptionClient() EncryptionClient

NewEncryptionClient creates a new instance of the EncryptionClient with default configuration.

func NewEncryptionClientWithConfig added in v2.4.0

func NewEncryptionClientWithConfig(configData *proto.ConfigData) EncryptionClient

NewEncryptionClientWithConfig creates a new instance of the EncryptionClient with the provided configuration.

func (*EncryptionClient) Decrypt added in v2.4.0

func (c *EncryptionClient) Decrypt(r record.Record, decrypter encryption.Encrypter) (record.Record, error)

Decrypt decrypts a Bloock record using the specified decrypter.

func (*EncryptionClient) Encrypt added in v2.4.0

func (c *EncryptionClient) Encrypt(r record.Record, encrypter encryption.Encrypter) (record.Record, error)

Encrypt encrypts a Bloock record using the specified encrypter.

func (*EncryptionClient) GenerateRsaKeyPair added in v2.4.0

func (c *EncryptionClient) GenerateRsaKeyPair() (key.KeyPair, error)

GenerateRsaKeyPair generates an RSA key pair for encryption. Deprecated: Will be deleted in future versions. Use KeyClient.newLocalKey function instead.

func (*EncryptionClient) GetEncryptionAlg added in v2.4.0

func (c *EncryptionClient) GetEncryptionAlg(r record.Record) (encryption.EncryptionAlg, error)

GetEncryptionAlg retrieves the encryption algorithm used for a Bloock record.

type IdentityClient added in v2.5.0

type IdentityClient struct {
	// contains filtered or unexported fields
}

IdentityClient represents a client for interacting with the Bloock Identity service.

func NewIdentityClient added in v2.5.0

func NewIdentityClient() IdentityClient

NewIdentityClient creates a new instance of the IdentityClient with default configuration.

func NewIdentityClientWithConfig added in v2.5.0

func NewIdentityClientWithConfig(configData *proto.ConfigData) IdentityClient

NewIdentityClientWithConfig creates a new instance of the IdentityClient with the provided configuration.

func (*IdentityClient) BuildCredential added in v2.5.0

func (c *IdentityClient) BuildCredential(issuer identity.Issuer, schemaId, holderDid string, expiration int64, version int32) identity.CredentialBuilder

BuildCredential creates a new credential builder for defining a credential on the Bloock Identity service.

func (*IdentityClient) BuildSchema added in v2.5.0

func (c *IdentityClient) BuildSchema(displayName string, schemaType, version, description string) identity.SchemaBuilder

BuildSchema creates a new schema builder for defining a schema on the Bloock Identity service.

func (*IdentityClient) CreateHolder added in v2.8.0

func (c *IdentityClient) CreateHolder(holderKey key.Key, didMethod identity.DidMethod) (identity.Holder, error)

CreateHolder creates a new holder identity.

func (*IdentityClient) CreateIssuer added in v2.7.0

func (c *IdentityClient) CreateIssuer(issuerKey key.Key, publishInterval identity.PublishIntervalParams, didMethod identity.DidMethod, name, description, image string) (identity.Issuer, error)

CreateIssuer creates a new issuer identity on the Bloock Identity service.

func (*IdentityClient) CreateVerification added in v2.7.0

func (c *IdentityClient) CreateVerification(proofRequest string) (identity.VerificationReceipt, error)

CreateVerification creates a new verification session on the identity managed API provided.

func (*IdentityClient) ForcePublishIssuerState added in v2.8.0

func (c *IdentityClient) ForcePublishIssuerState(issuer identity.Issuer) (identity.IssuerStateReceipt, error)

ForcePublishIssuerState publishes the state of an issuer on the Bloock Identity service.

func (*IdentityClient) GetCredential added in v2.8.0

func (c *IdentityClient) GetCredential(credentialId string) (identity.Credential, error)

GetCredential retrieves the Verifiable Credential entity based on the credential ID (UUID). (ex: 1bf0c79e-55e6-4f14-aa9d-fb55619ba0cf)

func (*IdentityClient) GetCredentialOffer added in v2.8.0

func (c *IdentityClient) GetCredentialOffer(issuer identity.Issuer, credentialId string) (string, error)

GetCredentialOffer retrieves the json raw offer based on the credential ID (UUID). (ex: 1bf0c79e-55e6-4f14-aa9d-fb55619ba0cf)

func (*IdentityClient) GetCredentialProof added in v2.7.0

func (c *IdentityClient) GetCredentialProof(issuerDid string, credentialId string) (identity.CredentialProof, error)

GetCredentialProof retrieves the proof of a credential on the Bloock Identity service.

func (*IdentityClient) GetSchema added in v2.5.0

func (c *IdentityClient) GetSchema(id string) (identity.Schema, error)

GetSchema retrieves a schema from the Bloock Identity service based on the schema ID (ex: Qma1t4uzbnB93E4rasNdu5UWMDh5qg3wMkPm68cnEyfnoM).

func (*IdentityClient) GetVerificationStatus added in v2.7.0

func (c *IdentityClient) GetVerificationStatus(sessionID int64) (bool, error)

GetVerificationStatus retrieves the status of a verification session on the identity managed API provided.

func (*IdentityClient) ImportIssuer added in v2.8.0

func (c *IdentityClient) ImportIssuer(issuerKey key.Key, didMethod identity.DidMethod) (identity.Issuer, error)

ImportIssuer retrieves the issuer based on the issuer key and DID method.

func (*IdentityClient) RevokeCredential added in v2.5.0

func (c *IdentityClient) RevokeCredential(credential identity.Credential, issuer identity.Issuer) (bool, error)

RevokeCredential revokes a credential on the Bloock Identity service.

func (*IdentityClient) WaitVerification added in v2.7.0

func (c *IdentityClient) WaitVerification(sessionID int64, params identity.VerificationParams) (bool, error)

WaitVerification waits for the completion of a verification session on the identity managed API provided.

type IdentityCoreClient added in v2.8.0

type IdentityCoreClient struct {
	// contains filtered or unexported fields
}

IdentityCoreClient represents a client for interacting with the Bloock Identity service.

func NewIdentityCoreClient added in v2.8.0

func NewIdentityCoreClient() IdentityCoreClient

NewIdentityCoreClient creates a new instance of the IdentityCoreClient with default configuration.

func NewIdentityCoreClientWithConfig added in v2.8.0

func NewIdentityCoreClientWithConfig(configData *proto.ConfigData) IdentityCoreClient

NewIdentityCoreClientWithConfig creates a new instance of the IdentityCoreClient with the provided configuration.

func (*IdentityCoreClient) BuildCredential added in v2.8.0

func (c *IdentityCoreClient) BuildCredential(issuer identity.Issuer, schemaId, holderDid string, expiration int64, version int32) identity.CredentialCoreBuilder

BuildCredential creates a new credential builder for defining a credential on the Bloock Identity service.

type IntegrityClient added in v2.4.0

type IntegrityClient struct {
	// contains filtered or unexported fields
}

IntegrityClient provides functionality to interact with the Bloock Integrity service.

func NewIntegrityClient added in v2.4.0

func NewIntegrityClient() IntegrityClient

NewIntegrityClient creates a new IntegrityClient with default configuration.

func NewIntegrityClientWithConfig added in v2.4.0

func NewIntegrityClientWithConfig(configData *proto.ConfigData) IntegrityClient

NewIntegrityClientWithConfig creates a new IntegrityClient with the given configuration.

func (*IntegrityClient) GetAnchor added in v2.4.0

func (c *IntegrityClient) GetAnchor(anchorID int64) (integrity.Anchor, error)

GetAnchor retrieves an anchor by its ID from the Bloock Integrity service.

func (*IntegrityClient) GetProof added in v2.4.0

func (c *IntegrityClient) GetProof(records []record.Record) (integrity.Proof, error)

GetProof retrieves a proof for a set of records from the Bloock Integrity service.

func (*IntegrityClient) SendRecords added in v2.4.0

func (c *IntegrityClient) SendRecords(records []record.Record) ([]integrity.RecordReceipt, error)

SendRecords sends records to the Bloock Integrity service for certification.

func (*IntegrityClient) ValidateRoot added in v2.4.0

func (c *IntegrityClient) ValidateRoot(root string, params integrity.NetworkParams) (uint64, error)

ValidateRoot validates the integrity of a merkle root proof on blockchain.

func (*IntegrityClient) VerifyProof added in v2.4.0

func (c *IntegrityClient) VerifyProof(proof integrity.Proof) (string, error)

VerifyProof verifies the integrity of a proof.

func (*IntegrityClient) VerifyRecords added in v2.4.0

func (c *IntegrityClient) VerifyRecords(records []record.Record, params integrity.NetworkParams) (uint64, error)

VerifyRecords verifies the integrity of a set of records.

func (*IntegrityClient) WaitAnchor added in v2.4.0

func (c *IntegrityClient) WaitAnchor(anchorID int64, params integrity.AnchorParams) (integrity.Anchor, error)

WaitAnchor waits for the completion of an anchor on the Bloock Integrity service.

type KeyClient added in v2.5.0

type KeyClient struct {
	// contains filtered or unexported fields
}

KeyClient provides functionality to interact with the Bloock Key service.

func NewKeyClient added in v2.5.0

func NewKeyClient() KeyClient

NewKeyClient creates a new KeyClient with default configuration.

func NewKeyClientWithConfig added in v2.5.0

func NewKeyClientWithConfig(configData *proto.ConfigData) KeyClient

NewKeyClientWithConfig creates a new KeyClient with the given configuration.

func (*KeyClient) ImportManagedCertificate added in v2.7.0

func (c *KeyClient) ImportManagedCertificate(_type keyEntity.CertificateType, certificate []byte, params keyEntity.ImportCertificateParams) (keyEntity.ManagedCertificate, error)

ImportManagedCertificate imports a managed certificate with the specified parameters.

Supported types: .pem, .pfx.

func (*KeyClient) LoadLocalCertificate added in v2.7.0

func (c *KeyClient) LoadLocalCertificate(pkcs12 []byte, password string) (keyEntity.LocalCertificate, error)

LoadLocalCertificate loads a local certificate from a PKCS12 file.

func (*KeyClient) LoadLocalKey added in v2.5.0

func (c *KeyClient) LoadLocalKey(keyType keyEntity.KeyType, key string) (keyEntity.LocalKey, error)

LoadLocalKey loads a local key of the specified type from a public key string.

func (*KeyClient) LoadManagedCertificate added in v2.7.0

func (c *KeyClient) LoadManagedCertificate(id string) (keyEntity.ManagedCertificate, error)

LoadManagedCertificate loads a managed certificate by its ID (ex: ceef5b02-af17-43d8-ae7b-31d9bdf8027f).

func (*KeyClient) LoadManagedKey added in v2.5.0

func (c *KeyClient) LoadManagedKey(id string) (keyEntity.ManagedKey, error)

LoadManagedKey loads a managed key by its ID (ex: 51d22546-68f1-4340-b94b-2a80e60b8933).

func (*KeyClient) NewLocalCertificate added in v2.7.0

func (c *KeyClient) NewLocalCertificate(params keyEntity.LocalCertificateParams) (keyEntity.LocalCertificate, error)

NewLocalCertificate generates a new local certificate with the specified parameters.

func (*KeyClient) NewLocalKey added in v2.5.0

func (c *KeyClient) NewLocalKey(keyType keyEntity.KeyType) (keyEntity.LocalKey, error)

NewLocalKey generates a new local key of the specified type.

func (*KeyClient) NewManagedCertificate added in v2.7.0

func (c *KeyClient) NewManagedCertificate(params keyEntity.ManagedCertificateParams) (keyEntity.ManagedCertificate, error)

NewManagedCertificate generates a new managed certificate with the specified parameters.

func (*KeyClient) NewManagedKey added in v2.5.0

func (c *KeyClient) NewManagedKey(params keyEntity.ManagedKeyParams) (keyEntity.ManagedKey, error)

NewManagedKey generates a new managed key with the specified parameters.

func (*KeyClient) RecoverTotpAccessControl added in v2.8.0

func (c *KeyClient) RecoverTotpAccessControl(key keyEntity.Managed, code string) (keyEntity.TotpAccessControlReceipt, error)

RecoverTotpAccessControl recovers TOTP-based access control for the given managed key or managed certificate using a recovery code.

func (*KeyClient) SetupSecretAccessControl added in v2.8.0

func (c *KeyClient) SetupSecretAccessControl(key keyEntity.Managed, secret string, email string) error

SetupSecretAccessControl sets up secret-based access control for the given managed key or managed certificate.

func (*KeyClient) SetupTotpAccessControl added in v2.8.0

func (c *KeyClient) SetupTotpAccessControl(key keyEntity.Managed) (keyEntity.TotpAccessControlReceipt, error)

SetupTotpAccessControl sets up TOTP-based access control for the given managed key or managed certificate.

type RecordBuilder added in v2.4.0

type RecordBuilder struct {
	// contains filtered or unexported fields
}

RecordBuilder assists in constructing records with various configurations.

func (RecordBuilder) Build added in v2.4.0

func (b RecordBuilder) Build() (record.Record, error)

Build constructs a record based on the RecordBuilder's configuration.

func (RecordBuilder) GetDetails added in v2.7.0

func (b RecordBuilder) GetDetails() (record.RecordDetails, error)

GetDetails retrieves details about other Bloock services (Integrity, Authenticity, Encryption, Availability) configured in the RecordBuilder.

func (RecordBuilder) WithDecrypter added in v2.4.0

func (b RecordBuilder) WithDecrypter(decrypter encryption.Encrypter) RecordBuilder

WithDecrypter sets the decrypter for the RecordBuilder.

func (RecordBuilder) WithEncrypter added in v2.4.0

func (b RecordBuilder) WithEncrypter(encrypter encryption.Encrypter) RecordBuilder

WithEncrypter sets the encrypter for the RecordBuilder.

func (RecordBuilder) WithSigner added in v2.4.0

func (b RecordBuilder) WithSigner(signer authenticity.Signer) RecordBuilder

WithSigner sets the signer for the RecordBuilder.

type RecordClient added in v2.4.0

type RecordClient struct {
	// contains filtered or unexported fields
}

RecordClient provides functionality for creating records using various data sources and to interact with the Bloock Record service.

func NewRecordClient added in v2.4.0

func NewRecordClient() RecordClient

NewRecordClient creates a new RecordClient with default configuration.

func NewRecordClientWithConfig added in v2.4.0

func NewRecordClientWithConfig(configData *proto.ConfigData) RecordClient

NewRecordClientWithConfig creates a new RecordClient with the provided configuration.

func (RecordClient) FromBytes added in v2.4.0

func (c RecordClient) FromBytes(bytes []byte) RecordBuilder

FromBytes creates a RecordBuilder from a byte slice payload.

func (RecordClient) FromFile added in v2.4.0

func (c RecordClient) FromFile(file_bytes []byte) RecordBuilder

FromFile creates a RecordBuilder from a byte slice representing a file.

func (RecordClient) FromHex added in v2.4.0

func (c RecordClient) FromHex(hex string) RecordBuilder

FromHex creates a RecordBuilder from a hexadecimal string payload.

func (RecordClient) FromJSON added in v2.4.0

func (c RecordClient) FromJSON(json string) RecordBuilder

FromJSON creates a RecordBuilder from a JSON string payload.

func (RecordClient) FromLoader added in v2.4.0

func (c RecordClient) FromLoader(loader availability.Loader) RecordBuilder

FromLoader creates a RecordBuilder from a data loader.

func (RecordClient) FromRecord added in v2.4.0

func (c RecordClient) FromRecord(record record.Record) RecordBuilder

FromRecord creates a RecordBuilder from an existing record.

func (RecordClient) FromString added in v2.4.0

func (c RecordClient) FromString(str string) RecordBuilder

FromString creates a RecordBuilder from a string payload.

type WebhookClient added in v2.4.0

type WebhookClient struct {
	// contains filtered or unexported fields
}

WebhookClient provides functionality for interacting with Bloock webhooks.

func NewWebhookClient added in v2.4.0

func NewWebhookClient() WebhookClient

NewWebhookClient creates a new WebhookClient with default configuration.

func NewWebhookClientWithConfig added in v2.4.0

func NewWebhookClientWithConfig(configData *proto.ConfigData) WebhookClient

NewWebhookClientWithConfig creates a new WebhookClient with the provided configuration.

func (*WebhookClient) VerifyWebhookSignature added in v2.4.0

func (c *WebhookClient) VerifyWebhookSignature(payload []byte, header string, secretKey string, enforceTolerance bool) (bool, error)

VerifyWebhookSignature verifies the signature of a webhook payload using the provided parameters.

Jump to

Keyboard shortcuts

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