pid

package
v0.5.5 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Document

type Document struct {
	*model.Identity
}

func (*Document) Marshal

func (d *Document) Marshal() (map[string]any, error)
Example
package main

import (
	"fmt"

	"github.com/SUNET/vc/pkg/model"
	"github.com/SUNET/vc/pkg/pid"
)

func main() {
	doc := &pid.Document{
		Identity: &model.Identity{
			AuthenticSourcePersonID: "person-001",
			Schema: &model.IdentitySchema{
				Name:    "SE",
				Version: "1.0.0",
			},
			FamilyName:     "Andersson",
			GivenName:      "Erik",
			BirthDate:      "1985-03-15",
			BirthPlace:     "Stockholm",
			Nationality:    []string{"SE"},
			IssuingCountry: "SE",
		},
	}

	m, err := doc.Marshal()
	if err != nil {
		fmt.Println("error:", err)
		return
	}

	fmt.Println("family_name:", m["family_name"])
	fmt.Println("given_name:", m["given_name"])
	fmt.Println("birth_date:", m["birth_date"])
	fmt.Println("birth_place:", m["birth_place"])
	fmt.Println("issuing_country:", m["issuing_country"])
}
Output:
family_name: Andersson
given_name: Erik
birth_date: 1985-03-15
birth_place: Stockholm
issuing_country: SE

Jump to

Keyboard shortcuts

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