Skip to content

Commit

Permalink
v2.8.7-beta.2
Browse files Browse the repository at this point in the history
  • Loading branch information
edutomesco committed Apr 17, 2024
1 parent b8b96fc commit 515b12a
Show file tree
Hide file tree
Showing 33 changed files with 53 additions and 38 deletions.
37 changes: 26 additions & 11 deletions client/identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,26 @@

package client

/*func TestIdentity(t *testing.T) {
/*import (
"encoding/base64"
"encoding/json"
"fmt"
"os"
"strings"
"testing"
"time"
"github.com/bloock/bloock-sdk-go/v2/entity/identity"
"github.com/bloock/bloock-sdk-go/v2/entity/key"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
func TestIdentity(t *testing.T) {
credentialJson := "{\"@context\":[\"https://www.w3.org/2018/credentials/v1\",\"https://schema.iden3.io/core/jsonld/iden3proofs.jsonld\",\"https://api.bloock.dev/hosting/v1/ipfs/QmYMYpSQsFbqXgSRK8KFDGMopD2CUke5yd4m7XFuVAZTat\"],\"id\":\"https://clientHost.com/v1/did:polygonid:polygon:amoy:2qLjqgeBQPHf9F6omWx2nrzV5F4PicWAWpGXNkxFp6/claims/2ff36890-2fc1-4bba-b489-bdd7685e9555\",\"type\":[\"VerifiableCredential\",\"DrivingLicense\"],\"issuanceDate\":\"2023-08-21T10:21:42.402140Z\",\"expirationDate\":\"2099-08-08T06:02:22Z\",\"credentialSubject\":{\"birth_date\":921950325,\"country\":\"Spain\",\"first_surname\":\"Tomas\",\"id\":\"did:polygonid:polygon:amoy:2qGg7TzmcoU4Jg3E86wXp4WJcyGUTuafPZxVRxpYQr\",\"license_type\":1,\"name\":\"Eduard\",\"nif\":\"54688188M\",\"second_surname\":\"Escoruela\",\"type\":\"DrivingLicense\"},\"credentialStatus\":{\"id\":\"https://api.bloock.dev/identity/v1/did:polygonid:polygon:amoy:2qLjqgeBQPHf9F6omWx2nrzV5F4PicWAWpGXNkxFp6/claims/revocation/status/3553270275\",\"revocationNonce\":3553270275,\"type\":\"SparseMerkleTreeProof\"},\"issuer\":\"did:polygonid:polygon:amoy:2qLjqgeBQPHf9F6omWx2nrzV5F4PicWAWpGXNkxFp6\",\"credentialSchema\":{\"id\":\"https://api.bloock.dev/hosting/v1/ipfs/QmWkPu699EF334ixBGEK7rDDurQfu2SYBXU39bSozu1i5h\",\"type\":\"JsonSchema2023\"},\"proof\":[{\"coreClaim\":\"e055485e9b8410b3cd71cb3ba3a0b7652a00000000000000000000000000000002125caf312e33a0b0c82d57fdd240b7261d58901a346261c5ce5621136c0b0056d1a9bf4e9d10b44fdd5b0f6b740b21dcd6675e770bf882249b8083471858190000000000000000000000000000000000000000000000000000000000000000039acad300000000ee30c6f30000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"issuerData\":{\"authCoreClaim\":\"cca3371a6cb1b715004407e325bd993c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000fbd3b6b8c8e24e08bb982c7d4990e594747e5c24d98ac4ec969e50e437c1eb08407c9e5acc278a1641c82488f7518432a5937973d4ddfe551e32f9f7ba4c4a2e0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000\",\"credentialStatus\":{\"id\":\"https://api.bloock.dev/identity/v1/did%3Apolygonid%3Apolygon%3Aamoy%3A2qLjqgeBQPHf9F6omWx2nrzV5F4PicWAWpGXNkxFp6/claims/revocation/status/0\",\"revocationNonce\":0,\"type\":\"SparseMerkleTreeProof\"},\"id\":\"did:polygonid:polygon:amoy:2qLjqgeBQPHf9F6omWx2nrzV5F4PicWAWpGXNkxFp6\",\"mtp\":{\"existence\":true,\"siblings\":[]},\"state\":{\"claimsTreeRoot\":\"0da5ac49846ae0074b986e5eef7c84011529e9902a0ffc6e9973b5cd0d217709\",\"value\":\"778582fc18b636314cc027a7772c1429028d44cdd17234f06e6d2d59bedee31d\"}},\"signature\":\"7bf882354b7cedd4b7ee74590cd3b091fef7545cb4ae8cd35c72b106ff858a0a3b1272ab7748cf7187d2383acda44bdae4bce1a7f9dccc11921fb0f19a70ee03\",\"type\":\"BJJSignature2021\"}]}"
DrivingLicenseSchemaType := "DrivingLicense"
KYCAgeSchemaType := "KYCAgeCredential"
holderDid := "did:polygonid:polygon:amoy:2qGg7TzmcoU4Jg3E86wXp4WJcyGUTuafPZxVRxpYQr"
holderDid := "did:polygonid:polygon:amoy:2qbhbai9AVMJKC4yk38PgyD5ieBuCSH43QBTrkpYGc"
expiration := int64(4089852142)
InitDevSdk()
Expand Down Expand Up @@ -108,7 +123,7 @@ package client
assert.NotNil(t, schema.Json)
assert.NotNil(t, schema.SchemaType)
receipt, err := identityClient.BuildCredential(issuer, schema.Cid, holderDid, expiration, 0).
res, err := identityCoreClient.BuildCredential(issuer, schema.Cid, holderDid, expiration, 0).
WithIntegerAttribute("license_type", 1).
WithDecimalAttribute("quantity_oil", 2.25555).
WithStringAttribute("nif", "54688188M").
Expand All @@ -120,12 +135,11 @@ package client
WithDecimalAttribute("precision_wheels", 1.10).
Build()
assert.NoError(t, err)
assert.NotNil(t, receipt.CredentialId)
assert.Equal(t, issuer.Did.Did, receipt.Credential.Issuer)
assert.Equal(t, "JsonSchema2023", receipt.Credential.CredentialSchema.Type)
assert.Equal(t, DrivingLicenseSchemaType, receipt.Credential.Type[1])
assert.NotNil(t, res.CredentialId)
assert.NotNil(t, res.Credential)
assert.Equal(t, DrivingLicenseSchemaType, res.CredentialType)
res, err := identityCoreClient.BuildCredential(issuer, schema.Cid, holderDid, expiration, 0).
receipt, err := identityClient.BuildCredential(issuer, schema.Cid, holderDid, expiration, 0).
WithIntegerAttribute("license_type", 1).
WithDecimalAttribute("quantity_oil", 2.25555).
WithStringAttribute("nif", "54688188M").
Expand All @@ -137,9 +151,10 @@ package client
WithDecimalAttribute("precision_wheels", 1.10).
Build()
assert.NoError(t, err)
assert.NotNil(t, res.CredentialId)
assert.NotNil(t, res.Credential)
assert.Equal(t, DrivingLicenseSchemaType, res.CredentialType)
assert.NotNil(t, receipt.CredentialId)
assert.Equal(t, issuer.Did.Did, receipt.Credential.Issuer)
assert.Equal(t, "JsonSchema2023", receipt.Credential.CredentialSchema.Type)
assert.Equal(t, DrivingLicenseSchemaType, receipt.Credential.Type[1])
credential, err := identityClient.GetCredential(receipt.CredentialId)
assert.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/bridge/proto/authenticity.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/authenticity_entities.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/authenticity_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/availability.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/availability_entities.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/availability_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/config.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/encryption.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/encryption_entities.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/encryption_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/identity.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/identity_core.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/identity_core_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/identity_entities.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/identity_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/integrity.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/integrity_entities.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/integrity_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/keys.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/keys_entities.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/keys_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/record.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/record_entities.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/record_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/shared.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/webhook.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion internal/bridge/proto/webhook_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 515b12a

Please sign in to comment.