| 490 | } |
| 491 | |
| 492 | func extractAuthInfo(authToken string) (*clientAPI.Attestation_Auth, error) { |
| 493 | if authToken == "" { |
| 494 | return nil, errors.New("empty token") |
| 495 | } |
| 496 | |
| 497 | parsed, err := token.Parse(authToken) |
| 498 | if err != nil { |
| 499 | return nil, fmt.Errorf("failed to parse token: %w", err) |
| 500 | } |
| 501 | |
| 502 | if parsed == nil { |
| 503 | return nil, errors.New("could not determine auth type from token") |
| 504 | } |
| 505 | |
| 506 | return &clientAPI.Attestation_Auth{ |
| 507 | Type: parsed.TokenType, |
| 508 | Id: parsed.ID, |
| 509 | }, nil |
| 510 | } |
| 511 | |
| 512 | // parseContractV2 attempts to parse a raw contract as V2 schema |
| 513 | func parseContractV2(rawContract *pb.WorkflowContractVersionItem_RawBody) *v1.CraftingSchemaV2 { |